OpenVPN on a Raspberry Pi¶
Source: www.kuketz-blog.de
Create an openvpn user¶
To avoid conflicts with other users, create a new user for the VPN service and set a password for this user. In my case the user is called «openvpn».
1 2 3 4 5 6 | # adduser «openvpn» # passwd «openvpn» # sudo usermod -a -G sudo «openvpn» # mkdir /home/«openvpn» # chown /home/openvpn «openvpn» # chgrp /home/openvpn «openvpn» |
Log in as «openvpn».
1 | $ su - «openvpn»
|
Run the PiVPN install script¶
1 2 | $ curl -L install.pivpn.io > pivpn.sh $ chmod +x pivpn.sh |
Once you are sure the script is not harmful in any way, run the installation script.
1 | $ ./pivpn.sh |
- Confirm the current network settings and make sure the shown IP address (eg. 192.168.2.110) is always assigned to this device by the router.
- Choose the user «openvpn».
- When asked, select UDP as a protocol.
- Confirm the default OpenVPN port 1194.
- Select ECDSA encryption strength. (Recommended: 256-bit)
- If you use DNS, enter the domain name.
- Reboot after the installation has finished
Add clients¶
To generate a client configuration, use:
1 | $ pivpn add
|
Select a different username and password for each client. Copy the resulting ovpn
file to your client device via scp and use it in your OpenVPN client.