Linux as an operating system is quite popular with professionals and people who like to have a neat, efficient, and secure work station. The operating system is way more secure than Windows, the most commonly used OS, as well as Mac OSX. Moreover, Linux really respects your privacy, which has resulted in all VPNs providing full support for Linux users. However, despite this, the fact remains that complete GUIs for Linux OS are too few in the VPN business, and the onus for setting up a VPN is on the user. We’ll help you out with that.
Setup your own Linux VPN
Linux requires the user to do some work in order to have a working VPN on the machine. The process isn’t difficult, and if you follow these steps, you can get it done in a few minutes:
All clients are allocated an IP address in Linux by the servers, therefore it’s important that you get the server configurations right.
i. Open the terminal and enter this:
sudo apt-get update
sudo apt-get install pptdp
‘get update’; is for system repositories, while ‘get install pptdp’ is for installing PPTP package on your Linux machine.
ii. The next step is editing the ‘pptd.conf’ file. It can be found in /etc/pptpd.conf. Enter “sudo gedit /etc/pptpd.conf” in the terminal for editing using Gedit, or enter “sudo nano /etc/pptpd.conf” in the terminal for direct editing.
iii. Next, add these lines to the file:
The first command ensures the local IP is used by the VPN server while the second command gives the range of addresses for the IPs.
iv. Follow step ii to edit “etc/ppp/chap-secrets”. To add new clients, use this method:
computer1 pptpd password *
computer2 pptpd password *
The different parts of this command are the client’s name, the server address, password for the client, and the IP address. The asterisk here means that any address within the range may be used.
v. To start the daemon, write “service pptpd start” in terminal.
vi. Next comes editing the “/etc/systl.conf” file. Find “net.ipv4.ip_forward=1” in this file or paste this text if you don’t find it. After doing this, update it using “systcl –p”.
vii. To allow inter-client communication, enter:
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save
#iptables –table nat –append POSTROUTING –out-interface ppp0 -j
# iptables -I INPUT -s 172.20.0.0/20 -i ppp0 -j ACCEPT
# iptables –append FORWARD –in-interface eth0 -j ACCEPT
“eth0” is the internet connection used by the server. It can be discovered using ifconfig or iwconfig.
Client Side Configurations
The following are the steps for a Debian-based client, though the client can be of any type.
I. The first step is the same for the clients and servers:
sudo apt-get update
sudo apt-get install pptp-linux
II. Load ppp_mppe module:
III. You will now need to open the “/etc/ppp/peers/” location and create a configuration there:
pty “pptp –nolaunchpppd”
This filename can be used to connect to a server:
pppd call filename
IV. Use the following for routing:
ip route add 172.20.0.0/20 dev ppp0
While it is true that most VPNs do not provide a full GUI-based client for Linux, there are a few that do so. These clients are quite similar to their Windows and Mac counterparts, and need only be downloaded and installed on the system for them to work.
In this article, we told you how you can setup a VPN in your Linux machine.