Our Knowledge Base provides step-by-step guides, troubleshooting tips, and expert insights to help you manage VPS, dedicated servers, domains, DDoS protection, and more — all designed to make your experience with us fast, secure, and stress-free.
ifconfig (interface configuration) is a network management tool. It is used to configure and view the status of the network interfaces in Linux operating systems. With ifconfig, you can assign IP addresses, enable or disable interfaces, manage ARP cache, routes, and more.
The ifconfig command is deprecated and replaced with ip and may not be included in the newer Linux distributions.
If you get an error message saying “ifconfig: command not found”, it means that the package that contains the command is not installed on your system.Install ifconfig on Ubuntu/Debian
On Ubuntu and Debian-based based Linux distributions, run the following command to install ifconfig:
To install ifconfig on CentOS and other RHEL based Linux distros, type:
The basic syntax of the ifconfig command is shown below:
Where:
The configurations set with the ifconfig command are not persistent. After a system restart, all changes are lost. To make the changes permanent, you need to edit the distro-specific configuration files or add the commands to a startup script.
Only root or users with sudo privileges can configure network interfaces.
When invoked without any options, ifconfig displays the configuration information of all network interfaces and associated ip address:
The output includes information about all active and inactive network interfaces:
To display the configuration information of any specific network interface, write the interface name after the command:
The output will look something like this:
With the ifconfig command, you can assign an IP address and netmask to a network interface.
Use the following syntax to assign the IP address and netmask:
For example, to assign the IP address 192.168.0.101 and netmask 255.255.0.0 to the interface eth0, you would run:
You can also assign a secondary IP address to a network interface using the interface aliasing:
Sometimes, you may need to reset the network interface. In this case, the ifconfig command can be used to enable or disable a network interface.
To disable an active network interface , enter the device name followed by the down flag:
To enable an inactive network interface, use the up flag:
Promiscuous allows a network interface to access and view all packets in a network. You can use the ifconfig command to enable and disable the promiscuous on a specific network device.
To enable the promiscuous mode on a network interface, enter the promisc flag after the device name:
To disable the promiscuous mode, use the -promisc flag
The MTU “Maximum Transmission Unit” allows you to limit the size of packets that are transmitted on an interface.
You can change the MTU value using the syntax:
For example, set the MTU value of a network interface eth0 to 500, run the following command:
The MAC “Media Access Control” is the physical address that uniquely identifies the devices on a network.
To change the MAC address of a network interface, use the hw ether flag to set the new MAC address:
We’ve shown you how to use the ifconfig command to configure and display information about a network interface.