Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get my locally assigned IP address from Ubuntu 10.04 LTS with ifconfig and what I'm getting is my external IP address (in other words, it's the same IP I see on

When running ifconfig eth0, inet addr shows my external IP address instead of the local address.

How do I get my local IP address ?

share|improve this question
up vote 7 down vote accepted

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?

share|improve this answer

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.

share|improve this answer

You'll have to use a router for it: so the router will have the public ip and your box will have its local ip delivered by DHCP.

Just out of curiosity: why aren't you ok with external ip? Security issues?

share|improve this answer

Try ip route The first or second match with this regex is your local IP:


If this returns also your external IP, then I think you don't have a router....

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .