How does a VPN server know what responses from websites are for what users?

Let’s say we have a VPN server that has some IP, and three people are connected to it. The first one is watching YouTube, the second one is scrolling through Reddit, and the third one is listening to Spotify.

Every moment, the server receives three packages of information: frames from YouTube, posts from Reddit and sounds from Spotify. YouTube, Reddit and Spotify set the target IP for their packages as the server’s IP, and they don’t know the IPs of the actual users.

If we assume that the server is owned by one of those no-logs VPN services, it also shouldn’t remember users’ IPs (should it?). If so, how can it define what data package should be sent to what users?

In Linux it’s netfilter which translates back and forth between private IP addresses usually used by VPN users and the public IP addresses used externally.

The private IP addresses are in turn used by the VPN driver to lookup information about the VPN user including endpoint address+port, that tells the driver where to forward packets to the user.

There’s a difference between logging and connection tracking (in the context of NAT). They can very easily abstain from logging anything, yet track live, short-lived connections for the purposes of moving packets.

You should read more and deepen your knowledge on topics such as:

  1. Network routing

  2. Network Address Translation - NAT

  3. Differences between external IP and internal IP

Part of the conversation includes both the source IP Address and port number. The server responds to the same port number. The VPN server (or your home router performing NAT) keeps track of those conversations and knows where to send responses for that port number.

So the data packages that my device sends contain its IP and port from which they were sent, and when the VPN server redirects them to the website, it changes the IP to its own (or the IP changes itself), but saves the port, and also saves the port and IP for a short period of time inside itself?

Then, when the website responds, its response has the same port included; the server checks what IP is associated with it, and redirects the response there?

Hi, I’m Vetted AI Bot! I researched the (“‘Pearson TCP IP Internetworking Volume One’”, ‘Pearson’) and I thought you might find the following analysis helpful.

Users liked:

  • Excellent reference for networking professionals (backed by 3 comments)
  • Clear and logical progression of technical material (backed by 3 comments)
  • Great primer on networking fundamentals (backed by 2 comments)

Users disliked:

  • Missing pages in the book (backed by 4 comments)

If you’d like to summon me to ask about a product, just make a post with its link and tag me, like in this example.

This message was generated by a (very smart) bot. If you found it helpful, let us know with an upvote and a “good bot!” reply and please feel free to provide feedback on how it can be improved.

Powered by vetted.ai

Almost! Generally it also changes the port number as well to something in a reserved range for NAT (Network Address Translation) and then changes both the IP and port back before sending it back to your device.