Getting the local IP address in Ubuntu 10.04 LTS
Solution 1:
If ifconfig eth0
returns an externally routeable IP address, you're almost certainly not behind any NAT. ifconfig
has no way to know what any non-NATed IP address would be, it can only report the IP address actually associated with the interface.
Why do you think that the IP address shown is incorrect?
Solution 2:
ip addr
shows you every address your machine has. That includes ipv4, ipv6, mac, link-local and global, avahi…
If you don't see an rfc1918 private address, it means you aren't behind a NAT. Your router is acting like a modem and doesn't have an ip address of its own.