Raspberry Pi – VPN Server


Connecting from the University network, I often incur into a very annoying issue, that of blocked ports. I have therefore decided to configure a personal VPN (Virtual Private Network) server where to connect to from university and have true freedom of access to whichever service I would need to use.

The configuration is pretty straight forward, starting by installing the Poptop (pptpd) VPN daemon as follows:

# apt-get install ppp pptpd

To specify the local IP address range the VPN server should assign to the client, edit the file /etc/pptpd.conf:

# nano /etc/pptpd.conf

and add the IP range at the bottom of the file:

localip 192.168.1.xxx
remoteip 192.168.1.110-120

Where xxx is the last byte of the RasPi ip of your choice, and 110-120, for instance, the last byte of the custom range of ip assigned to the clients.

To configure the VPN users, proceed as follows:

# nano /etc/ppp/chap-secrets

and add each user with the syntax:

username * password *

Adapt the line above as needed.

Restart the daemon to apply the changes:

# service pptpd restart

Finally, we need to enable IP forwarding:

# nano /etc/sysctl.conf

by adding or uncommenting:

net.ipv4.ip_forward=1

and apply the changes without the need to reboot the machine:

# sysctl -p

Important note: For the VPN server to work, we need to enable on the router IP protocol 47 (GRE) and forward the TCP port 1723 to the RasPi ip address.

Comments:


Leave a Reply

One thought on “Raspberry Pi – VPN Server

Loading Facebook Comments ...