ifconfig Command: Tutorial & Examples
Display information about network interfaces
The ifconfig
command is a command-line utility that is used to configure network interfaces on a device running the Linux operating system. It is typically used to view or set the IP address and other network configuration options for a network interface.
You can use the ifconfig
command to view the current configuration of a network interface by running the following command:
ifconfig
This will display a list of all the network interfaces on the device, along with their current configuration. For each interface, you will see information such as the interface name, the IP address, the netmask, and the broadcast address.
You can also use the ifconfig
command to set the configuration of a network interface by running the following command:
ifconfig interface_name IP_address netmask
Replace interface_name
with the name of the network interface you want to configure, IP_address
with the IP address you want to assign to the interface, and netmask
with the netmask you want to use for the interface.
Here is an example of how to set the IP address and netmask of the eth0
interface:
ifconfig eth0 192.168.1.10 255.255.255.0
This will set the IP address of the eth0
interface to 192.168.1.10
and the netmask to 255.255.255.0
.
In addition to setting the IP address and netmask, the ifconfig
command can also be used to bring a network interface up or down, enable or disable promiscuous mode, and perform other network configuration tasks.
Warning: Note that the ifconfig
command has been deprecated and will be removed in future Linux version. It is recommended to use the ip
command instead.