How to Setup a VPN connection in Linux
Heidi Finigan | Last Updated:
VPN Streaming Expert
Linux is a popular operating system among people who want something that is smoother to use and is also more secure than Windows systems. The fact that Linux is free to use on top of these other things makes it all the more popular among people who simply want a system for professional purposes. Although most software like Skype and Music players can be installed easily using the software repositories on Linux systems, setting up a VPN takes some work.
Since VPNs can help you with a lot of stuff like providing you online privacy and anonymity as well as helping you access geo-restricted content, Linux users want to get in on the action as well. Therefore, we provide you this guide for setting up a VPN on Linux systems.
Setting up a VPN connection on Linux
The process of setting up a VPN on Linux is not quite difficult. It does not take someone to be really familiar with Linux to set up a VPN on this operating system. Simply follow these server side and client side instructions and you will be good to go:
Since the server is responsible for allocating an IP address to each and every client on the network, you need to tweak some things.
- Open the terminal and paste the following:
sudo apt-get update
sudo apt-get install pptdp
These are required to update the repositories and install the PPTP package on your system respectively.
- Edit the file pptd.conf which can be found in /etc/pptpd.conf. The editing can be done using an editor like Gedit by entering “sudo gedit /etc/pptpd.conf” in the terminal or directly in terminal using “sudo nano /etc/pptpd.conf”.
- Add the following to the file:
This makes the VPN server use the localip while using a VPN and allocated IPs between 172.20.0.100 to 300 to clients.
- Edit the file “etc/ppp/chap-secrets” using any of the abovementioned methods. New clients can be added like:
computer1 pptpd password *
computer2 pptpd password *
These are the client’s name, server name, password, and the IP. Having an asterisk for IP means any IP in the range can be assigned.
- Now that you have set up the server, you need to start the daemon. Simply enter “service pptpd start” in terminal.
- You need to edit “/etc/systl.conf” now. Look for “net.ipv4.ip_forward=1”. If it is not there then paste it in that file and update the file using “systcl –p”.
- Add the following rules if you want to enable inter-client communication:
# 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
The “etho” in the first and last rule is the internet connection used by the server and can be found using ifconfig or iwconfig.
You can have any kind of system using the VPN created on Linux. We provide the steps for Debian-based client.
- Install PPTP on client system using
sudo apt-get update
sudo apt-get install pptp-linux
- Load ppp_mppe module using
- Create a configuration file in /etc/ppp/peers/ and add this to it:
pty “pptp –nolaunchpppd”
The name of this file can be used to connect to server like
pppd call filename
- Enter the following to have proper routing:
ip route add 172.20.0.0/20 dev ppp0
These steps can be repeatedly used to add several clients.
The instructions provided in this article will help you establish a working VPN connection on a Linux system. Even if you are not experienced in using Linux you can just follow these steps to setup a VPN on Linux.
PRIVACY ALERT: Websites you visit can see your current IP Address:
- Your IP Address: 220.127.116.11
- Your Location: Ashburn, US
- Your Internet Provider: Amazon.com, Inc.
* Scammers, Governments, and Advertisers can use this information to track and target you.
Our recommended vpn service provider for general all-round internet security and online privacy is ExpressVPN. It offers an excellent selection of online security and internet privacy features, excellent speed, and the ability to unblock your favorite streaming services (Netflix, Hulu, Amazon Prime, BBC iPlayer).Visit ExpresssVPN