3
$\begingroup$

What we see on our devices is essentially the private IP given to us by the ISP; thereby, whenever we access the internet, this private IP is first converted to public IP (by ISP through NAT), following which requests are made on the internet. If the assumptions above are right, then how does a website gets my private IP? Do websites/servers interact with me over my public IP or the private IP?

I am a bit confused over this topic as books often say that only private IP goes in the internet (i.e., the one assigned by the ISP) but websites/servers are able to make a log of your private IP. This gets me confused.

$\endgroup$

1 Answer 1

2
$\begingroup$

A private IP is not necessarily assigned by an ISP. It is actually a much more general concept: Any node (or cluster of nodes) realizing NAT separates two networks, a public and a private one. Most routers in home networks separate your internal network (private) from your ISP's or the wider internet (public). In the case of an ISP, it might be so that the ISP uses NAT to separate its own network of subscribers (private) from the wider internet (public), though not all ISPs have such a policy; actually some ISPs may even provide you with a reserved public IP (i.e., an IP which is accessible from the wider internet and which is statically assigned to you).

A private IP is only valid within its own network. In fact, the values for private IPs are standardized and are not routed in the wider internet. Thus, even if a node (e.g., a webserver) in the internet came to know the IP of your device in its private network—which, up to exploits, is unfeasible because of NAT—, it cannot really do anything with that IP unless it is also part of the device's private network: any packets sent to that IP will be immediately dropped (i.e., not routed) by the next node. Rather, what is logged in webservers and the like is the public IP of the NAT node through which you are accessing it.

$\endgroup$
6
  • $\begingroup$ Considering the most likely scenario that the ISP does the network address translation so now my IP (say X) has been converted into another IP (say Y). So how does the website still logs the my ip address (X)? As far as I know, if a tcp packet is sent on the network then only 2 IP addresses can be listed on the tcp packet (sender and private). Please help me here. $\endgroup$ Commented Dec 22, 2018 at 11:06
  • $\begingroup$ @Anonymous Developer My point is the webserver is unable to log X because it does not even see it (unless exploits, etc.). Because of NAT, the server only ever sees the address Y of the NAT middlebox. Also, I would not say ISPs using NAT for customers would be the "most likely scenario" (in my experience), though YMMV. $\endgroup$
    – dkaeae
    Commented Dec 22, 2018 at 11:27
  • $\begingroup$ Oh got it sorry for the trouble, was a stupid question anyway don't know how I got confused I always thought it to be the private IP that is logged but it's clear now. Thanks a lot for the help! $\endgroup$ Commented Dec 22, 2018 at 11:35
  • $\begingroup$ @Anonymous Developer No question is "stupid" if answering it leads to the propagation of knowledge :) $\endgroup$
    – dkaeae
    Commented Dec 22, 2018 at 11:50
  • $\begingroup$ @Anonymous Developer Also, if you are satisfied with the answer, do not forget to click the tick mark to the left to mark it as an "accepted" answer. $\endgroup$
    – dkaeae
    Commented Dec 22, 2018 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.