Due to NAT, is the IP access count imperfect?

Asked

Viewed 265 times

1

I found it difficult to find content on the internet about this. I would like to know in general what is NAT (Network Address Translation), how it maps private Ips on a public IP and mainly where this is currently used.

When I contract an internet plan at home if two people access an application on the internet at the same time of this network, will the IP of the sender present in the packets that arrive at the server of this application be the same? That means they’re behind a NAT?

Some web applications use the IP address for certain purposes, such as counting how many times a link has been accessed. If I implement an application that counts all the clicks on the link, the same person can click several times on the link and this will be counted.

But counting the number of Ips that accessed the link is also not perfect. I wanted to better understand the NAT to know in which situations using the sender IP can be useful.

  • 2

    The article in Portuguese is a bit weak, but it’s a good start https://pt.wikipedia.org/wiki/Network_address_translation - As usual, the English version is more complete https://en.wikipedia.org/wiki/Network_address_translation - A little of the difficulty of national content is thanks to some "colonels" of Wikipedia, that on the pretext of helping to organize the site, make sure to disturb the national editors wanting to put their hand in all articles even without understanding the subject (however, voluntary translation they accept without question so much, even if the original contains nonsense).

  • 2

    I think there’s confusion between the provider and your home network. Whether you do NAT in your home or not depends on you (for example, to have multiple pcs on the same network). The provider usually gives you a real IP (but I’ve seen cases where they give you a NAT-based IP, in precarious situations).

  • 2

    It’s up to you. When I used Virtua, from Net, on one PC, I used the real IP. Then I started using NAT to have more Pcs on the network. My clients usually use the real IP on the server, and NAT for the rest of the network (I usually let the server do the NAT, when it is case of a server only in small company, and the server meets external thing).

  • 2

    Even in ADSL, whether you will use NAT or not depends basically on how you configure the router or PC. For example, if your PC makes the PPPOE connection, which is common in these cases, it will usually take the external IP. The most important thing is to understand that NAT is a technique for making different machines use the same IP, no more, no less. Whether this IP will be valid on the internet or not, whether it will be used on internal networks, whether it will have one NAT after another or not, are unrelated issues.

1 answer

5


The best way to understand the NAT is to think that every package TCP/UDP coming from a network or a given IP can be changed on the output by your router/gateway (as long as it has a NAT function), when a NAT rule is applied the header of this package that defines the source IP is changed to a new IP (public or otherwise).

The change process occurs when the package leaves the source equipment with the IP of its internal network and reaches the gateway of its internal network that will be performing a NAT, porting when the packet arrives at the gateway the NAT performs the IP exchange inside the packet header and sends the request forward, this process allows communications with other networks that do not have routes to your private network, the destination will not know which IP from within your private network made this communication, as all requests have been translated to a specific IP!

where this is currently used?

Simply everywhere, this process allows entire internal networks to access the internet, when you have an internal network with private IP’s the only way out so that all these IP’s can navigate to the internet is to make a NAT of your entire class or the desired Ips for the public IP of your contracted link, this is an example that may be simple to view, but of course the NAT can also be used to perform the translation internally within your network where you may need to use these tricks for something specific and punctual.

When I hire a home Internet plan if two people access it an application on the internet at the same time, your public IP seen from server will be the same? This is a NAT?

Most of your questions were answered in the previous answer I believe, got confused the "Server" part, but it’s what I said, for the rest of the world no matter how many IP’s different from your internal network access, everyone will only know the public IP, that is, all the accesses of your internal network are translated to the public IP.

Counting access only by looking at IP’s will never be the best way, in general is made an analysis of the logs on the server that is receiving access, in these logs besides containing the source IP (Nateado or not, your application will never know), also will have information of the OS used, browser version, and it is assumed that if the same IP has accessed with different browsers and OS, then possibly it will be different people. There is no 100% safe way to calculate access information, most of the time it is an estimate. Now if you develop the clients that will access your application, then it is possible to start from the same logging principle, you can then generate unique Ids for each client and that somehow you have this information archived via log on your server, this way any independent IP request with Nat or will not have a single record in your server logs.

  • The answer was very good! But it seems that people thought the question is not in the scope of the site. So I switched to try to relate a little more to programming! If you can edit the answer to the modified question, then I accept it :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.