What is a VPN and How to Setup a VPN in Windows, Mac & Linux?

VPN is also known as Virtual Private Network. Basically it’s a short form of Virtual Private Network. If you are into Computing then you might have heart about this word. VPN is a method which is used to give your private and public networks a complete security and privacy. VPN is also pronounce as a separate system to transfer important data over the Internet. The term is a very useful within the Computer world for a great security and privacy to your entire system or company or firm. If you are yet to aware about this term and its setup, just follow us here, as we have prepared a report to describe everything starting from What is a VPN, how it works and why do you really need it. You can even learn how you can Setup a VPN in Windows, Mac & Linux system from here.

VPN Setup


What is a VPN and How it Works?

The World runs on Internet and that’s a fact. Nowadays, one can not spend even a single day without using Internet. You can see computers and smartphones everywhere to manage most of your daily important tasks done without anyone’s help. Smartphones and their super useful apps. There are many ways to use Internet such as Wi-Fi, Wi-Fi hotspots, LAN and a few other more. VPN adds security and privacy to all such networks with which you are currently accessing the Internet to surf sites.

Virtual Private Networks are mostly use in big corporations and other high level firms where things get transferred over the Internet. Such big companies don’t want their data to get stolen by anyone. In such cases, they prefer to use a VPN so that all the important data will be secured enough.

Furthermore, you must be wondering why there’s a need to use a VPN and how can it be helpful to our system? If you are a computer savvy, you must be using a good security tool on your system. There are a number of Antivirus tools available in the market to secure a PC from unwanted malware attacks and viruses. VPN is a whole lot different thing which offers a unique way to keep your identity and other data safe from others.

You might be aware about IP address. It’s a special identity of each computer so that it can be recognised easily. IP address also show your current location and other details of your PC and system which can be harmful for you if you want to surf securely. In such case, you need to add VPN to your system. VPN provider changes the original IP of your system with a new one, which means you can work from wherever you are, but the IP of your system will show a complete different location. Your identity will remain safe and no one can locate you easily.

VPN Security

VPN has a complete different and unique way to transfer data between two different networks. It encrypts the data which is not readable by anyone. The company network and the remote user, both have the access to read the data because it is shared between them only over a VPN. No one else can read the transmitted data via VPN from these systems. The entire setup contains a number of elements to keep things secured with encryptions of data. In order to give your system a good security, you have to be up-to-date with your system’s security such as Antivirus. First a Firewall between the two systems which is an essential thing to protect your systems. It establishes an authentication with the Firewall. The other way is by encryption. This method encrypts all the data which means all of your data will be encrypted which is not readable by anyone.

Just like software and other applications, there’s a unique process to Setup a VPN in Windows, Mac & Linux. Whichever system you are currently using, you can find out a solution here.

Setup a VPN in Windows System

Windows is undoubtedly the most popular Operating System in the World with top number of users. In Windows, there are a number of other versions of it available. Windows 7 is the best one among them all. The following tutorial is based upon the same, Windows 7. You can find out the same options by exploring various options if you are using a different version of Windows.

Outgoing VPN – Connection

Step 1 :

Click the Start button and search for the VPN. Select Set up a virtual private network (VPN) connection from the given options.

Step 2 :

Now, you have to enter an IP address or domain name of the server to connect to it.

Note : Make sure to enter a proper IP Address and other required details accurate.

Step 3 :

Now, you have to put other options details in the given fields, otherwise you can even leave them blank as well.

Step 4 :

After this, you have to click on to the Next button.

Step 5 :

Now, the main connection Window will be presented to you. You can enter your Username and Password there, hit the Connect option.

Step 6 :

In order to connect to this VPN, you need to right click on the icon of Windows network then select VPN option.

Step 7 :

Put required login credentials to the blank fields and you’ll be connected itself.

Note : If you are not connecting to the network, you have to check your server configuration. You need to configure a proper VPN connection first before setting up things.

Incoming VPN – Building up

Step 1 :

Click the Start button and you’ll be allowed to search for anything on the Windows system. Type Network and Sharing by using your PC’s Keyboard.

Step 2 :

Now, click Adapter Settings from the left side bar.

Step 3 :

Click the File option and then New Incoming Connection option from the same Window.

Step 4 :

Select the users to share your access with and then hit the Next button.

Step 5 :

Now, you would see Through the Internet option here. Select it out and hit the Next button.

Step 6 :

After this, you need to select the Protocol to be used for this particular connection. By default TCP/IPv4 Protocol will work for almost every PC.

Step 7 :

At the end, click on to Allow access. You’re done, you’ve setup a new VPN connection on your Windows system.

This tutorial was prepared for Windows 7 system, although you can find out the same options for other Windows versions as well.

Setup a VPN in Mac OS

In order to make a connection to a VPN from your Mac OS X, first you need to have an Administration permission with a Password or a Certificate. Every VPN provider give you a proper VPN Settings file to get them import directly. Just double click on to the file and import them to the System preferences. If it doesn’t open, just click out the Apple menu> System Preferences and then select Network option. After this, choose System configuration option to import that VPN Settings file. Follow the below given steps for more information.

Step 1 :

Click the Apple Menu> System Preferences and then select Network option from there.

Step 2 :

Click Add (+) at the bottom of the network connection services list.

Step 3 :

A new pop-up Window will be presented, you need to select VPN from this menu.

Step 4 :

Give your new connection a proper name and for what purpose you are using this VPN, you need to mention both the things very carefully.

Step 5 :

Enter Server address and VPN name here.

Step 6 :

Click Authentication Settings. Here you need to put all the information given by the Administrator.

Step 7 :

After this, just click on to Ok button and then hit the Connect button.

That’s all you have to do in order to setup a VPN on a Mac OS X. You can easily show the status of this new VPN connection by selecting “Show VPN status in menu bar”. In order to remove this VPN connection from your system, you just need to select Delete (-) option.

Setup a VPN in Linux

Configuring OpenVPN – Server Side

Step 1 :

Install OpenVPN

First, install the openvpn package on both the server and the client system.

$ sudo apt-get install openvpn

After this, you have to use the respective package manager of the distribution that you are working. For instance, if you are using yum, do the following

$ yum install openvpn

Step 2 :

Create Directories and set Env Variables

Here, you have to create a directory inside /etc/openvpn and copy the easy-rsa contents to it. By doing so, the changes which will be done will not affect the current system and its configuration. Change the owner as current user so that current user has permission to create files and delete them as well.

$ sudo mkdir /etc/openvpn/easy-rsa

$ sudo cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa

$ sudo chown -R $USER /etc/openvpn/easy-rsa/

After this, Edit the /etc/openvpn/easy-rsa/vars to adjust it according to your environment.

export KEY_CITY="CHN"
export KEY_ORG="tgs"
export KEY_EMAIL="admin@thegeekstuff.com"

Step 3 :

Creating the CA – Certificate Authority or Root Certificate

The next step in building openvpn server is to establish a Public Key Infrastructure, to authenticate server and client.

$ cd /etc/openvpn/easy-rsa/

$ source vars

$ ./clean-all

$ ln -s openssl-1.0.0.cnf openssl.cnf

$ ./build-ca

Generating a 1024 bit RSA private key
unable to write 'random state'
writing new private key to 'ca.key'
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [IN]:
State or Province Name (full name) [TN]:
Locality Name (eg, city) [CHN]:
Organization Name (eg, company) [tgs]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [changeme]:
Name [changeme]:lakshmanan
Email Address [mail@host.domain]:admin@thegeekstuff.com

Once ./build-ca is completed, you will see a file named “ca.key” and “ca.crt” inside /etc/openvpn/easy-rsa/keys/

.key” This files has to be kept confidential.

Step 4 :

Creating certificate for Server

Now, create a certificate for your own Openvpn server.

$ /etc/openvpn/easy-rsa/build-key-server vpnserver

Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y

The above command will create certificate and other required data for your server.

Step 5 :

Creating certificate for client

The given VPN client also needs a certificate to authenticate with the server. If you are trying to connect with multiple VPNs, you have to create a Certificate for each VPNs.

$ ./build-key vpnclient1

Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y

vpnclient1 is the hostname of the client.

Above command will create the certificate and key files for the client generated by you.

Step 6 :

Create Diffie Hellman parameters

$ ./build-dh

After completing this, you will have many key and certificate files inside /etc/openvpn/easy-rsa/keys.

Step 7 :

Copy the certificates to respective locations

Now, you have to copy all three Certificate to a different location.

$ cd /etc/openvpn/easy-rsa/keys/

$ sudo cp ca.crt vpnserver.crt vpnserver.key dh1024.pem /etc/openvpn/

$ scp ca.crt vpnclient1.key  vpnclient1.crt root@vpnclient1:/etc/openvpn

Now we have copied the client certificate and key to the client machine.

Step 8 :

Configuring the Server

OpenVPN provide a default server.conf, you can change this according to your need.

$ sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/ $ sudo gzip -d /etc/openvpn/server.conf.gz

Edit the “/etc/openvpn/server.conf“.

ca ca.crt
cert vpnserver.crt
key vpnserver.key
dh dh1024.pem

Start the OpenVPN server :

$ sudo /etc/init.d/openvpn start
 * Starting virtual private network daemon(s)... 
 * Autostarting VPN 'server'

$ ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:  P-t-P:  Mask:

Here, openVPN will log errors in syslog file.

Configuring OpenVPN – Client Side

Step 9 :

Setup Client Config Files

Now, configure the openVPN to work as client.

Copy the sample client.conf to /etc/openvpn.

$ sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn/

Edit the /etc/openvpn/client.conf.

# Specify that this is openvpn client

remote vpnserver 1194

ca ca.crt

cert vpnclient1.crt

key vpnclient1.key

Start the OpenVPN in client

$ /etc/init.d/openvpn start
 * Starting virtual private network daemon(s)... 
 * Autostarting VPN 'client'

$ ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:  P-t-P:  Mask:

Step 10 :

Test the VPN Setup

Now, Ping the vpnserver from the client machine just to see whether VPN is working or not.

$ ping

PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=64 time=2.14 ms


Priyank Patel

Hey people! I'm Priyank from India, loves to get into Technology and its devices. Here to share what I experience on my Computing life. Stay tuned and read me out!

Leave a Reply

Your email address will not be published. Required fields are marked *