You might be using virtual private networks on a regular basis now. It has almost become a necessity, especially when connecting to a public network such as hotel wifi, an airport, or a park.
The best thing is that there are a lot of them. If you don’t feel like paying for it without testing you can easily get VPN trial and test its whole capabilities before purchasing it. But like we said, in this article, we will explore what actually happens when you connect to a VPN.
We will go through the whole tunneling process to make it clear for all those who are interested in learning how it works.
What is VPN Tunneling
Tunneling is a way of transferring data securely over a public network. In our case, we will use a VPN (Virtual Private Network) which is basically a secure connection between two computers with the help of encryption algorithms.
The main purpose of a VPN is to provide security by encrypting your traffic so that it cannot be intercepted by anyone else.
A VPN uses different protocols to achieve this goal. These protocols include PPTP, L2TP/IPSec, OpenVPN, etc.
PPTP protocol is used mainly for Windows devices while L2TP/IPSEC is used mostly for Macs. However, both these protocols work similarly.
So let’s see what exactly happens when you connect to any VPN.
Step 1: Connecting to Your VPN Server
When you open up your web browser and type in the IP address of the VPN server, your computer will try to establish a connection with the VPN server.
Your VPN software will first generate a random number called Session ID. Then it will send this Session ID to the VPN server along with some other information. Then the server will create a new session based on the received information and assign it a unique identifier.
This identifier will remain constant until you disconnect from the VPN. So whenever you want to reconnect to the same VPN server, you just need to give the VPN server the same Session ID.
This is why they call it a single sign-on service. Once you have connected to the VPN server successfully, you won’t have to enter any credentials again.
You can also set up multiple accounts for your VPN servers. For example, you could have one account for home WiFi and another for office WiFI.
Step 2: Encrypting Data
Once your device connects to the VPN server, it will start sending encrypted data packets to the VPN server. All the data sent to the VPN server will be encrypted.
Now here comes the part where things get interesting.
In order to decrypt the data, the VPN server needs to know the secret key. This secret key is generated randomly every time you connect to a VPN server.
The VPN server sends this secret key back to your device after receiving the encrypted data. Now the device has to decrypt the data using the secret key.
If everything goes well, your device should receive the decrypted data from the VPN server.
Step 3: Sending Data Back to You
After receiving the decrypted data, your device will now have to send the data back to the VPN server. Here is where the fun starts.
As mentioned earlier, the VPN server generates a random number called Session Key. It then sends this Session Key to your device along with the encrypted data.
Now your device will have to encrypt the data using the Session Key. If all goes well, the VPN server will receive the encrypted data and will be able to decrypt it using its own Session Key.
Step 4: Receive Data From Other Devices
Once your device receives the decrypted data, it will now have to send that data back to the VPN Server.
Here is where the fun really starts. The VPN server will use the Session Key to re-encrypt the data. And once again, it will send the encrypted data back to your device.
Now your device has to decrypt the newly encrypted data using its own Session Key and send it back to the VPN server which will finally decrypt the data and send it to the destination specified by you.
So how does the VPN server know what to do with the data? Well, when you are connected to the VPN server, the VPN server will keep track of the IP address of your device.
It will remember the last time you were connected to the VPN server. Based on this information, it will decide whether or not to re-encrypt or decrypt the data.
For instance, if you are connected to the same VPN server for more than 5 minutes, the VPN server knows that you are already connected to the VPN server and hence doesn’t bother to re-encrypt/decrypt the data.
On the other hand, if you are connected for less than 5 minutes, the data will be re-encrypted/decrypted before being sent back to you.
Conclusion
VPNs are very useful tools that help people stay anonymous online. They also provide better security as compared to regular connections.
This article explains the whole concept of a virtual private network tunnel and explains how it works.
We hope after reading it, you will have learned the core principle behind the whole tunneling concept. If you have enjoyed reading it please share it with your friends and family to let them know too.