问题
I'm trying to understand NAT (Network Address Translation) .
Can someone explain how can I determine if my computer is using a NAT (behind a NAT) , or if it using its own IP address ?
回答1:
What Barmar said in the comments is the easiest way. Obtaining your IP address over HTTP is indicative that you are behind either a NAT or an HTTP Proxy server. (I suppose it's possible you could have a public IP address, but your device is configured to route HTTP over a caching proxy).
Formal NAT detection and NAT classification can be done with the STUN protocol or equivalent protocol in which a UDP or TCP service echoes back the IP address back to the client that connected to it.
Another telling sign if you are behind a NAT is that your local IP address is in a private IP address range such as the 192.168.x.y range, the 10.x.y.z range, or then 172.16.0.0-172.31.255.255 range.
And pretty much any Wi-Fi setup is going to be a NAT configuration.
回答2:
The NAT detection technique is based on two observations about the IP TTL (Time To Live) field.
- Host operating systems have characteristic initial TTL values. This property of individual operating system implementations of TCP/IP is well known and can be used as part of a "fingerprint" to identify the operating system that a host is running merely by examining its traffic.
- NAT devices or gateways decrement the TTL on packets that they forward.
For more details visit: http://www.sflow.org/detectNAT/
来源:https://stackoverflow.com/questions/21250097/how-can-i-know-if-my-computer-is-behind-nat