How to install the ifconfig and route utility on the Debian operating system

Since Debian 9 Strech, the popular ifconfig and route tools for managing the network at both interface and routing level are not available by default. iproute2 is the tool that is currently used to manage the entire Debian operating system network, both at the interface level and also at the routing level, in addition, iproute2 provides us with very important features such as the possibility of having several routing tables among many others functions. However, you may still want to use the popular ifconfig and route tools on your computer, today in this article we are going to show you how to install them.

What are ifconfig and route in Debian?

install the ifconfig and route utility on the Debian

We are sure that you have ever had to use the ifconfig tool to configure a network interface, either to drop the interface or lift it, to change the IP address and mask assigned to us by the DHCP server of the main router, and even to create subinterfaces among many other functionalities. Ifconfig has always been the tool par excellence both in Debian operating systems and in other Linux-based distributions.

The same happens with the command “route”, the tool par excellence to add static routes to our server or PC, to remove the static routes added previously, route is also used to configure the default gateway and to delete it from the system, for Of course, we can also see the current routing table and prioritize different routes over others.

Both tools, both ifconfig and router, are essential to manage the network correctly in any Linux operating system, and we are sure that many of you have used them both on the command line and also in your scripts to automate different actions.

Why are they not included since Debian 9 by default?

Although the two tools are essential for good network management, for many years we have had the iproute2 tool in all Linux-based operating systems. This suite of tools will allow us to manage network interfaces, static routes, the default gateway, and we can even configure various routing tables in our Linux-based operating system, and, of course, also in Debian.

For many years ifconfig and route have been considered “deprecated”, that is, old. However, many network administrators were still using it, and for this reason it did not begin to be removed from the different Linux-based distributions. After several years of iproute2 being used by administrators, it was decided that both ifconfig and router would not be incorporated into the operating system by default.

We must bear in mind that iproute is a much better, more complete, more intuitive tool because the commands are very similar to Cisco syntax, and we will be able to perform advanced configurations such as configuring several routing tables and several default gateways.

If in a Linux-based operating system we try to execute “ifconfig” or “route”, it will automatically return an error. Starting with the Debian 9 version, you will have to install it manually, and if you use other Linux distributions in their latest versions, exactly the same thing happens, we must install it in order to use it.

Once we have verified that in Debian 9 and later versions it is not installed by default, we are going to do it manually. There is still third-party software that internally uses automatic scripts for the installation of their software, these scripts still usually use ifconfig and route, so it is totally necessary to have these tools installed if we want to execute these scripts correctly and that they do not return any type of error.

Ifconfig and route installation on Debian 9 or higher

Installing the old suite of ifconfig and route networking tools is really simple, the first thing we have to do is open a terminal, log in in root mode or use the “sudo” command, and install a package called “net-tools” . This package integrates all the “old” tools that we have been using for many years. If in the installation we have chosen to do “sudo” to promote superuser to install packages, we type:

sudo apt install net-tools

If we have incorporated a superuser password, we must put «su» in the console to promote superuser and then type:

apt install net-tools

When we have installed it, if we execute ifconfig we will get the interface configuration summary:

This ifconfig command can be used together with the typical iproute2 commands such as “ip link show” or “ip addr show”, there is no problem of using both tools simultaneously. However, certain changes we make with iproute2 may not be reflected if we use ifconfig to display data.

Another important change in Debian 9 or higher is that the names eth0, eth1 and ethX no longer exist on Ethernet network interfaces. Now it is a random name and it looks like “ens32”, “ens33” or similar, however, when executing the “ip addr show” or the “ifconfig” we can see the name of our network interface without problems. Another command you can run is the following to see the name:

dmesg | grep -i eth

Of course, with the installation of «net-tools» we will also have at our disposal the «route» command to view and configure the static routes and the default gateway of the operating system. The commands that we must execute to add or delete static routes are the same as always, the same happens if we want to put the default gateway or gateway, in these cases nothing has changed.

In the following screenshot you can see that the operation of this command is now perfect, since it works correctly.

If you missed the possibility of using ifconfig or route in your operating system, thanks to the installation of “net-tools” you will be able to use it again without problems with the same commands as always. From this article we recommend using iproute2 because it is much more complete, efficient, fast and current, in addition, we have a complete tutorial where you can learn all the commands that can be executed. We must not forget that the new iproute2 allows us to configure several routing tables, ideal for having several gateways in the event that you have several network interfaces on your computer or server.