The ifconfig command without any argument is used to check the IP address assigned to the server and displays all the active interfaces details. Here eth0
is one of the network interfaces and lo
is a loopback device.
# ifconfig
Here it displays the IPv4 and IPv6 addresses, broadcast address and netmask:
In the below command the argument a
is used to display the details of all active and inactive network interfaces.
# ifconfig -a
Display the details of a specified network interface.
# ifconfig <interface name>
In the below image it displays the details about the eth0
network interface:
Enable a Network interface.
# ifconfig <interface name> up
OR
# ifup <interface name>
Here up
or ifup
flag with the network interface eth0
will activate the network interface if it is not in active state.
Disable a Network interface.
# ifconfig <interface name> down
OR
# ifdown <interface name>
Here down
or ifdown
flag with the network interface eth0
will deactivate the network interface if it is in active state.
The IP command is used to assign an address for a network interface and configure the network interface on a Linux system. The below command shows all IP addresses of all network interfaces whether it is enabled
or disabled
.