Vpn-server configuration based on pptpd service in ubuntu.
1) Install pptpd in any way you like.
2) enable forwarding packets between interfaces:
$ sudo sysctl -w net.ipv4.ip_forward=1
Check configuring:
$ cat /proc/sys/net/ipv4/ip_forward 1
3) The file /etc/pptpd.conf should look like this:
option /etc/ppp/pptpd-options logwtmp localip 10.0.0.1 remoteip 10.0.0.100-200
localip — address of virtual network interface ppp0 (that appears after connecting the client to the server)
remoteip — the range of addresses for customers
4) The file /etc/ppp/chap-secrets should look like this:
box1 pptpd 11 "*" box2 pptpd 22 "10.0.0.101"
box1 and box2 — are the user's names (login)
11 and 22 — are user's passwords (password)
"*" - assigning any address from the address range
"10.0.0.101" — assigning a specific address
5) The file /etc/ppp/pptpd-options should look like this:
name pptpd refuse-pap refuse-chap require-mschap-v2 refuse-mschap require-mppe-128 ms-dns 8.8.8.8 ms-dns 8.8.4.4 mtu 1400 mru 1400 nodefaultroute proxyarp lock nologfd noipx nobsdcomp novj novjccomp
6) Restart the server:
service pptpd restart
checking that pptpd - server is working:
$ sudo netstat -alpn | grep :1723 tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 28401/pptpd
but at that time the output of the command ifconfig will not show the presence of interface ppp0
On client side in ubuntu we create the connection using:
«Change connection» -> VPN
Settings for the new vpn-connection:
Gateway — 192.168.1.10 (address of eth0 interface)
Name of user — box1
Password — 11
Authentification only mschapv2
Encryption MPPE (any available)
Comression all disable
After user connection there will be the interface on the server:
$ ifconfig ppp0 Link encap:Протокол PPP (Point-to-Point Protocol) inet addr:10.0.0.1 P-t-P:10.0.0.100 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1 RX packets:18 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:784 (784.0 B) TX bytes:84 (84.0 B)
На клиенте появиться соединение:
$ ifconfig ppp1 Link encap:Протокол PPP (Point-to-Point Protocol) inet addr:10.0.0.100 P-t-P:10.0.0.1 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1400 Metric:1 RX packets:6 errors:0 dropped:0 overruns:0 frame:0 TX packets:43 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:84 (84.0 B) TX bytes:3781 (3.7 KB)