ifconfig is a Unix command which is used for viewing or configuring the status of the network interfaces. Running ifconfig with no arguments on a networked machine will give output similar to the following:

eth0      Link encap:Ethernet  HWaddr 00:01:02:A4:33:B7  
          inet addr:131.111.20.22  Bcast:131.111.255.255 Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:74317677 errors:0 dropped:0 overruns:35 frame:0
          TX packets:33354974 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:4250835559 (4053.9 Mb)  TX bytes:1946228848 (1856.0 Mb)
          Interrupt:11 Base address:0xec00 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:3904  Metric:1
          RX packets:3056870 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3056870 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:389462829 (371.4 Mb)  TX bytes:389462829 (371.4 Mb)

From this output, we can see that this machine has two network interfaces running: eth0 (Ethernet) and lo (loopback). Looking at the eth0 section, we see that its MAC address is 00:01:02:A4:33:B7, its IP address is 131.111.20.22, its broadcast address is 131.111.255.255, and its netmask is 255.255.0.0. The remaining lines give some diagnostic information about the amount of data being sent over the network.

If the machine is not on a network, or its networking is down, then only the loopback section will appear. If it has a dial-up connection to the Internet, there will be a ppp0 section instead of the eth0 section. The eth0 section may also have other names; for example, on HP-UX it is called lan0.

If you are root, you can use ifconfig to set up a network interface like this:

ifconfig eth0 netmask 255.255.0.0 broadcast 131.111.255.255 131.111.20.22

You don't need to do this very often, because it is run automatically during the boot process, getting its data from a file like /etc/network/interfaces (under Debian Linux) or /etc/rc.config.d/netconf (under HP-UX 10).

Log in or registerto write something here or to contact authors.