2

How do I find out my IP address on a unix box? I've tried

ifconfig

but it doesn't exist on the system.

1
  • Did you try as root? Also what OS?
    – Adam
    Jul 15, 2009 at 16:41

3 Answers 3

13

ifconfig is usually in /sbin. Depending on what system you're running this mightn't be on your path (in particular, RedHat systems don't include this on the default path)

Try:

$ /sbin/ifconfig

If it works then that's the issue, and you should change your path via your .bashrc (or whatever shell you're using).

export PATH=$PATH:/sbin:/usr/sbin
1
  • 1
    Some unix variants need the "-a" option passed to ifconfig to get informative output.
    – freiheit
    Jul 15, 2009 at 16:48
0

I would suggest looking at the host command. Of course, you will have to specify the name of the machine that you are on.

1
  • 2
    This makes the assumption that the computer is on the internet, not behind NAT, has a working DNS server configured, and a hostname. If you're on a TCP/IP network that isn't connected to the internet, then this won't work.
    – Ernie
    Jul 15, 2009 at 17:43
0

If you are behind some sort of NAT device, that device probably has an http interface that provides this information. First, find out its IP address either from the documentation or from the output of the route command. There should be a line that looks like this:

default         192.168.2.1     0.0.0.0         UG    0      0        0 ath0

Then connect to that IP address with your browser and see what you can find out. The rest depends on what kind of NAT device you're using.

You must log in to answer this question.