Why is ip different from inet?
Andrew Henderson
From command line
$ ip asays that inet 10.238.115.9
From
I get 73.93.142.197
Why are these different?
3 Answers
The short answer:
10.238.115.9 is the IP your machine is getting from the router, whereas 73.93.142.197 is the IP your router gets from your ISP. And since 10.238.115.9 is a private address it is not visible to the outside.
Because you have a NATing router in front of you.
NAT, or Network Address Translations, translates IPs, rewriting outgoing packets from your internal IP, to the routers IP. When replies are received by the router, the router rewrites the destination IP to your internal IP.
This way, you can have multiple computers accessing the Internet from one public IP, reducing IP use. Thus, NAT became popular (and ubiquitous) as IPv4 address space was exhausted.
The drawback is that it breaks the end-to-end-connectivity between hosts on the internet, without special configuration.
With IPv6 we will not have this situation.
The 10.238.115.9 is your LAN IP address - the machine address on the local network. This is what your computer has on the network that is under your router's control. Usually it is assigned dynamically, but some residential routers might remember your MAC address and give you the same LAN IP address again.
73.93.142.197 is your router's IP address, aka the public IP address that internet resources will see. For enterprise machines usually IP address like this remains static. It is assigned dynamically for most residential routers, and may change within a couple weeks or renewed by simply powering off the router and on.
Information is encapsulated in TCP/IP packets, and internet resources such as website are only concerned with returning information to your router's address. Router itself has a translation table to send proper information to 10.238.115.9 when it receives a response.
As for why the IP addresses are different, it is due to difference in networks and who gives out IP addresses. Router gives out private addresses to your computers on LAN, while Internet Service Provider gives public addresses. Internet service providers usually have specific range of addresses for public use. For private use there is RFC1918 standard: the 10.x.x.x falls into class A network. It is common within small businesses, such as coffee shops, college campuses, etc. Another common residential class is C, which often ranges 192.168.0.0 – 192.168.255.255, so it is very common for home routers to assign this type of address. Public addresses are handled by IANA organization. Some of the ranges are presented in related answer on superuser.