DEV Community

Cover image for What is a VPN? How does a VPN work? Is it safe to use a VPN?
shreegowtham27
shreegowtham27

Posted on

What is a VPN? How does a VPN work? Is it safe to use a VPN?

What is a VPN?

A VPN is software, which is basically used to bypass your Internet Service Provider by using some other server from a different country or state. Meaning, from a different region.
How does VPN work?

Before that, You need to know how actually your connection works.

  1. You request a Website, let's say example.com,

  2. Your request will be sent to the ISP or Network Provider.

  3. Then DNS lookup will happen.

  4. You get the response from the example.com server.

DNS lookup is nothing, just checking if the given domain is a Valid domain you're requesting and if it is valid, what is the IP Address of that server.

So now you know, how this basic stuff works. Now let's see how VPN works.

  1. Whenever you start a VPN application, it creates a port in your device, Let's say, port Number 45450.

  2. All the Web Traffic which are happening at port 80 (HTTP) and 443 (HTTPS) will be routed from their respective port to the 45450 port, where the VPN client is listening.

  3. Now, the VPN client will send those traffics to the VPN server.

  4. VPN server will make a DNS Lookup.

  5. Once the VPN server receives the data from example.com, The VPN server sends the response to the VPN client, and then we can get the data.

Simple As That, Cool.

Why does it take a lot of time to receive data from VPN?

  1. If you use free services, your VPN provider will use them on budget servers only. So when the bandwidth of the VPN server is low, obviously your surfing speed will be poor.

  2. When the server is on heavy load, you will be ending up with a poor surfing speed.

  3. Latency - This also plays a major role. However, if you're in India, you will be using a VPN from Europe, the US, or Singapore. We also do have something called a CDN - Content Delivery Network. The only work of CDN is to send data to the client from the nearest region. Let's say, you're from Gujarat and looking for a site hosted in AWS, obviously, they should be served from Mumbai region, so that the content will load faster reducing your latency. But in this case, even though you're in Mumbai, you're asking for content from a VPN server, which is located in Singapore.

So, the request will be something like this.

  1. Your request from the browser.

  2. Routed to VPN Client port.

  3. Your request reaching the VPN server

  4. VPN Server does the DNS lookup things.

  5. VPN server gets the website IP address.

  6. VPN server sends requests to the website IP address.

  7. Nearest CDN sends the response to the VPN server (Singapore CDN).

  8. VPN server provides the response to the VPN client.

  9. VPN client, shows the Data to us.

PS: Since you're requesting the website from a Singapore IP Address, The website will think that you're really from Singapore and serve you from Singapore CDN.

What is the purpose of a VPN?

1. Censorship.

Some countries ban some websites, for various reasons. To access those banned resources, VPN is used widely.

2. Anonymity.

Anonymity is just to hide who you really are and where you're from. To have your privacy with yourself and not leave any digital footprints, VPN is used.

Is it safe to use a VPN?

We can't actually say that the data are not logged in to the VPN server. If the VPN company sells out our data, IP Address, and search history, it is more than enough. this is one of the major reasons to use a VPN. We can't actually say that we are safe when we use a VPN.

So the next time, when you turn ON your VPN, know how VPN is able to open this example.com and without a VPN, the same example.com is not accessible.

Top comments (0)