Determining one's own IP address.

Scott Leadley leadley at uhura.cc.rochester.edu
Sat Dec 9 07:48:29 AEST 1989


In article <601 at bmers58.UUCP> davem at bnr-public.UUCP () writes:
>How can one determine his own IP address without looking it up in the
>hosts file?

	Assuming (a lot of things, but primarily that) you wish to do this from
the shell command line and that you know the network interface name:

	% ifconfig de0
		   ^^^ VAX-ism, substitute the correct name here
	de0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>
		inet xxx.xxx.xxx.xxx netmask ffffff00 broadcast xxx.xxx.xxx.xxx

If you don't know what interfaces are connected to the machine try:

	% netstat -i
	Name  Mtu   Network     Address      Ipkts   Ierrs Opkts   O...
	de0   1500  x-net       x-machine    15890511 4     14812969...
	lo0   1536  127         localhost    134349  0     134349  0...
-- 
					Scott Leadley - leadley at cc.rochester.edu



More information about the Comp.unix.wizards mailing list