views:

527

answers:

5

What command do I want to issue when I want to know the IP address of the Solaris machine I'm logged onto?

Thanks in advance for any suggestions.

--James

+3  A: 

Try the ifconfig command.

Alan
+4  A: 

If you're a normal user (i.e., not 'root') ifconfig isn't in your path, but it's the command you want.

More specifically: /usr/sbin/ifconfig -a

Andrew
Of course, there may be many interfaces on the box, each with its own IP.
chris
Sure. You'll generally have at least two -- the local loopback (lo0) and one or more ethernet connections (on my machine, ce0).
Andrew
A: 

This worked pretty well for me:

ping -s my_host_name

James Adams
A: 
/usr/sbin/host `hostname`

should do the trick. Bear in mind that it's a pretty common configuration for a solaris box to have several IP addresses, though, in which case

 /usr/sbin/ifconfig -a inet | awk '/inet/ {print $2}'

will list them all

Chris May
A: 

hostname and uname will give you the name of the host. Then use nslookup to translate that to an IP address.

bobmcn