Using ifconfig command

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.

The ifconfig utility is a part of the net-tools package. If this package is not installed on the system, then you may not get access to this utility on CentOS 7.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.95.244