patternMinor
Private IP and public IP
Viewed 0 times
andpublicprivate
Problem
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.
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.
Solution
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.
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.
Context
StackExchange Computer Science Q#101931, answer score: 2
Revisions (0)
No revisions yet.