This is an older command used to display or modify the current configuration of network interfaces. The usage of ifconfig command is now obsolete and it is replaced with the newer ip utility. Now, the ip addr and ip link commands are preferred to display network interface information in place of ifconfig.
The following table lists the popular options of ifconfig with their descriptions:
Command |
Description |
$ ifconfig |
Display the current configuration of active interfaces only |
$ ifconfig -a |
Display all interfaces information which are available in system, whether they are active or inactive |
$ ifconfig eth0 |
Display the configuration of the specified interface eth0 |
$ ifconfig eth0 up |
Activate the network adapter eth0, if it is down. |
$ ifconfig eth0 down |
Deactivate the network adapter eth0, if it is up. |
The ifconfig command can be used to assign an IP address and netmask to a network adapter. These are runtime changes and are lost after reboot. Following command line shows how to use ifconfig for making runtime assignment of IP address and netmask to an interface:
$ ifconfig eth0 192.168.1.51/24
or
$ ifconfig eth0 192.168.1.51 netmask 255.255.255.0
Some naive users still find, the older ifconfig command easier to use, in comparison to the new and more versatile ip command.