On Ubuntu and other Linux distributions, command line tools are often the best way to interact with the inner workings of the computer. The ifconfig command is used to configure network settings in Linux.
Ifconfig is an older version of the ip command, but ifconfig is still preferred by many due to its simpler syntax and ease of use. But how exactly is ifconfig used for network interface configuration? Here is a walkthrough.
Installation of Network Tools : How to Use ifconfig?
The ifconfig command is not installed by default on Linux distributions. Most system administrators will install the package it belongs to during setup, but in some cases it may be missing from your computer. You can easily install it.
If you try to use the ifconfig command on a system that doesn’t have it installed, you’ll get an error message, along with instructions on how to install it. Just enter the command:
sudo apt install network tools
This will install ifconfig and a few other network configuration utilities. Note that sudo is required to install ifconfig and enable or disable networking.

Viewing network information using ifconfig
The easiest way to use the ifconfig command is to run it directly without any parameters. This displays information about all active interfaces, including Ethernet and wireless connections.

This provides all relevant information about network interfaces, including MTU (maximum transmission unit) value, IP addresses, and packet history. If you just want the tech specs in a more digestible format with interface names, enter ifconfig -s.

However, both versions do not include currently inactive networks. To see all network interfaces, use the ifconfig -a command instead.

When you already know the name of the networks and only want to know the status of a particular interface, you can add its name to the ifconfig command. Like that:
ifconfig eth0

Enable and disable networks with ifconfig
Monitoring the status of running networks isn’t the only thing you can do with ifconfig. You can also use the command to configure almost every aspect of these interfaces, down to the MTU and masking used.
The simplest use case is to start or stop networks. You can do this using the following command:
sudo ifconfig name above
The “name” parameter is the actual name of the network. This can be used to enable one of the down interfaces detected using the ifconfig -a command.

To disable a network, just use below instead of above:
sudo ifconfig dummy0 below
This will disable the interface.
Network configuration with ifconfig
Changing any value associated with a network interface is easy. Remember to precede the command with sweat, as all of these changes require administrator privileges to take effect.
The most common use of this feature is to assign a custom IP address to a network. For example, here’s how to give the dummy0 interface a new IP address:
sudo ifconfig dummy0 29.95.245.112

You can enter any valid IP address after the network name to assign it. You will only receive a message if you have entered something incorrectly. Otherwise, the change will take effect immediately.
You can also specify a netmask like this:
sudo ifconfig dummy0 netmask 255.255.255.0

The syntax for setting a broadcast address is similar:
sudo ifconfig dummy0 broadcast 77.40.108.115

If you want to change all these IP addresses for a network, it is more efficient to group all the commands together. Like most Linux commands, you can include multiple arguments on the same line.

A network interface can also have one or more aliases. These are specified using the syntax of name:xwhere name is the name of the network and X a digit For example, here’s how to add an alias IP address to the dummy0 network.
sudo ifconfig dummy0:0 69.72.169.2

You can confirm it worked by using ifconfig to get its status.
dummy ifconfig0:0

What else can you do with ifconfig?
The ifconfig command has a long list of arguments that you can use to modify many other variables of a network interface. You can enable multicast, set MTU, and enable promiscuous mode, among others.
The official man pages contain a complete list of all the arguments that can be used with ifconfig, along with a technical definition of what each does. You can of course invoke the manual from the terminal itself using the man ifconfig domain.

When should I use ifconfig?
For most users, there is no reason to use the ifconfig command. The automatic configuration provided by default is sufficient for normal Internet use.
But if you’re a system administrator who wants finer-grained control over your network interfaces, ifconfig is the tool for you. You can use the command at system startup to properly configure network interfaces and then forget about it.
It is also useful for diagnosing network problems because you can query the status of any network interface and configure it. You can use ifconfig to restart networks or even change technical settings until it works better.