Q. How do I find out my Linux / UNIX system ip address, subnet and related networking information from a command prompt?
A. To find out IP address of Linux/UNIX/BSD/Unixish system you need to use command called ifconfig. It is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed. If no arguments are given to ifconfig command it displays the status of the current active interfaces. It displays Ethernet IP address, Mac address, subnet mask and other information. Type /sbin/ipconfig command to display IP address:
Code:
$ /sbin/ifconfig
OR type the following command:
Code:
$ /sbin/ifconfig | less
Under Solaris and other Unixish oses you may need to type ifconfig command with -a option as follows:
Code:
$ /sbin/ifconfig -a
Output of above commands:
eth0 Link encap:Ethernet HWaddr 00:0F:EA:91:04:07 inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20f:eaff:fe91:407/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:31167 errors:0 dropped:0 overruns:0 frame:0 TX packets:26404 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38338591 (36.5 MiB) TX bytes:3538152 (3.3 MiB) Interrupt:18 Base address:0xc000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1994 errors:0 dropped:0 overruns:0 frame:0 TX packets:1994 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:188041 (183.6 KiB) TX bytes:188041 (183.6 K