How to Install ifconfig on Debian

If you are trying to get your IP address or network details using the ifconfig command in Debian 10, you'll encounter the 'ifconfig: command not found' error.

-bash: ifconfig: command not found

The ifconfig package is not installed by default on Debian. It's because ifconfig is being deprecated in favor of the new ip command. This ip command is now responsible for modifying or showing routing, network devices, interfaces and tunnels.

💡
In some cases, even if ifconfig is available, you need to run it with sudo to avoid this error.

If you still want to use the good old ifconfig command, you'll have to install it explicitly.

Installing ifconfig command in Debian

If you try to install ifconfig command directly, your Debian system will not find this package.

root@debian:~# apt install ifconfig
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ifconfig

It is because ifconfig is not a package in its own. It is installed with net-tools package that has some additional networking tools.

So to get ifconfig, you need to install net-tools package like this:

sudo apt install net-tools

Once installed, you use the ifconfig command:

root@debian:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.124.55.175  netmask 255.255.255.0  broadcast 172.124.55.255
        inet6 2400:8966::f03c:92ff:fe32:ffef  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::f03c:99ff:fe32:ffef  prefixlen 64  scopeid 0x20<link>
        ether f2:3c:92:32:ff:df  txqueuelen 1000  (Ethernet)
        RX packets 1623  bytes 421318 (411.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 876  bytes 108871 (106.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

However, I strongly advise you should start using the IP command. Sooner or later, net-tools will be completely deprecated and you won't be able to install it.