VPN server

From WickyWiki


Install

Install pptpd VPN server:

sudo apt-get install pptpd

Configure local IP addresses

Configure server side IP's:

  • localip = IP of your VPN server within your local network
  • remoteip = IP address pool for clients within your local network
sudo gedit /etc/pptpd.conf
localip 192.168.1.8
remoteip 192.168.1.100-101

Note:

  • make sure the remoteip addresses are excluded from the DHCP IP address pool.
  • you will also use the address poll to limit the numer of possible connections.

Configure user and password

Configure client-login:

sudo gedit /etc/ppp/chap-secrets
# client     server  secret                IP addresses
wilbert      pptpd   **vpn-password-w**    *
judy         pptpd   **vpn-password-j**    *

Note:

  • the user / password combination is the only thing preventing others from using your VPN tunnel.
  • the chap-secrets configuration file can only be viewed with root privileges
  • client IP address '*' allows all external IP addresses, it is safer to limit this
  • you need to forward VPN port 1723 in your router

Restart

sudo /etc/init.d/pptpd restart

View log

cat /var/log/syslog | grep 'pptpd\|pppd'|tail -n25

Problem

Jan 18 16:38:16 WJV5 pptpd[1911]: CTRL: Client 92.65.229.225 control connection started
Jan 18 16:38:16 WJV5 pptpd[1911]: CTRL: Starting call (launching pppd, opening GRE)
Jan 18 16:38:16 WJV5 pppd[1913]: Plugin /usr/lib/pptpd/pptpd-logwtmp.so loaded.
Jan 18 16:38:16 WJV5 pppd[1913]: pppd 2.4.5 started by root, uid 0
Jan 18 16:38:16 WJV5 pppd[1913]: Using interface ppp0
Jan 18 16:38:16 WJV5 NetworkManager[781]:    SCPlugin-Ifupdown: devices added 
  (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Jan 18 16:38:16 WJV5 NetworkManager[781]:    SCPlugin-Ifupdown: device added 
  (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found.
Jan 18 16:38:16 WJV5 pppd[1913]: Connect: ppp0 <--> /dev/pts/0
Jan 18 16:38:16 WJV5 pptpd[1911]: GRE: Bad checksum from pppd.
Jan 18 16:38:46 WJV5 pppd[1913]: LCP: timeout sending Config-Requests
Jan 18 16:38:46 WJV5 pppd[1913]: Connection terminated.
Jan 18 16:38:46 WJV5 avahi-daemon[783]: Withdrawing workstation service for ppp0.
Jan 18 16:38:46 WJV5 NetworkManager[781]:    SCPlugin-Ifupdown: devices removed 
  (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Jan 18 16:38:46 WJV5 pppd[1913]: Modem hangup
Jan 18 16:38:46 WJV5 pppd[1913]: Exit.
Jan 18 16:38:46 WJV5 pptpd[1911]: GRE: read(fd=6,buffer=611660,len=8196) from PTY failed: status = -1 
  error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs
Jan 18 16:38:46 WJV5 pptpd[1911]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
Jan 18 16:38:46 WJV5 pptpd[1911]: CTRL: Reaping child PPP[1913]
Jan 18 16:38:46 WJV5 pptpd[1911]: CTRL: Client 92.65.229.225 control connection finished