Ubuntu’s server cloud images don’t include ifconfig, and neither does a minimal Debian install. On a fresh machine the command fails until you add the net-tools package. On Ubuntu that is one apt command. Debian adds a second trap: after the install, a normal user still gets ifconfig: command not found, because the binary lands in a directory that is not on a non-root user’s PATH.
This guide shows you how to install ifconfig on Ubuntu and Debian with apt install net-tools, fix the Debian PATH problem, and read the output. It also covers the one thing ifconfig gets wrong on modern systems and the ip commands that replace each ifconfig habit, including what to run if you came looking for ipconfig on Ubuntu. We ran every command on fresh Ubuntu 26.04 and 24.04 cloud images and Debian 13 in October 2026, and checked the Debian 12 package and PATH rules in a container.
Install ifconfig on Ubuntu and Debian
ifconfig ships in the net-tools package on both distributions, and the package name hasn’t changed across any of the four releases. Ubuntu’s command-not-found helper says as much the first time you try it:
ifconfig
On Ubuntu 24.04 and 26.04 the shell tells you exactly which package to add:
Command 'ifconfig' not found, but can be installed with:
sudo apt install net-tools
Debian gives no hint at all, just bash: ifconfig: command not found, but the package and the fix are the same. Refresh the package index and install it:
sudo apt update
sudo apt install net-tools
The package is small. On Ubuntu 26.04 apt reported a 151 kB download and 680 kB of disk, and the whole install took under three seconds:
Installing:
net-tools
Summary:
Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 5
Download size: 0 B / 151 kB
Space needed: 680 kB / 16.5 GB available
Selecting previously unselected package net-tools.
Preparing to unpack .../net-tools_2.10-2ubuntu1_amd64.deb ...
Unpacking net-tools (2.10-2ubuntu1) ...
Setting up net-tools (2.10-2ubuntu1) ...
Processing triggers for man-db (2.13.1-1build1) ...
Every release packages the same upstream net-tools 2.10, so the commands and output fields below match on all four. One visible difference: Ubuntu patches the byte counters to decimal units (MB, KB), while Debian prints binary units (MiB, KiB). The package versions differ only in patch level:
| Release | net-tools package | Installed by default | /usr/sbin on a user’s PATH |
|---|---|---|---|
| Ubuntu 26.04 LTS | 2.10-2ubuntu1 | No (cloud image) | Yes |
| Ubuntu 24.04 LTS | 2.10-0.1ubuntu4.4 | No (cloud image) | Yes |
| Debian 13 | 2.10-1.3 | No | No |
| Debian 12 | 2.10-0.1+deb12u2 | No | No |
Some VM templates add net-tools on top of the stock image, so check with dpkg -l net-tools before assuming it’s missing. Our own Ubuntu 26.04 template had it, and the apt history showed it came from the template build, not from Canonical’s cloud image manifest.
Once the install finishes, run ifconfig again. On Ubuntu it works straight away as your normal user:
ifconfig
You should see each interface with its IPv4 address, netmask, MAC address and packet counters:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.1.50 netmask 255.255.255.0 broadcast 10.0.1.255
inet6 fe80::be24:11ff:fe58:15fd prefixlen 64 scopeid 0x20<link>
ether bc:24:11:58:15:fd txqueuelen 1000 (Ethernet)
RX packets 205694 bytes 400171486 (400.1 MB)
RX errors 0 dropped 697 overruns 0 frame 0
TX packets 136734 bytes 10578793 (10.5 MB)
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 152 bytes 16152 (16.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 152 bytes 16152 (16.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Our cloud-image VMs named the NIC eth0, with enp0s18 listed as an alternative name. A bare-metal or desktop install usually shows the predictable name instead, so substitute yours wherever a command takes an interface.
Fix ifconfig command not found on Debian
Installing net-tools on Debian does not make ifconfig work for your normal user, and that’s by design rather than a broken package. Debian’s /etc/profile gives root a PATH with /usr/sbin in it and gives everyone else /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games, and ifconfig lives in /usr/sbin. A command run over SSH without a login shell gets sshd’s even shorter default, which is the PATH in the capture below; neither includes /usr/sbin. Ubuntu’s /etc/environment puts /usr/sbin on everyone’s PATH, which is why the same package behaves differently on the two.
This capture is from Debian 13 right after a clean apt install net-tools:

The package is installed, command -v can’t find the binary, and the PATH explains why. You have three ways round it, depending on how often you use the tool:
sudo ifconfig, since sudo’ssecure_pathincludes/usr/sbin- the full path,
/usr/sbin/ifconfig, which works for reading interfaces without sudo /usr/sbinadded to your own PATH, if you type it often
A Debian install where you set a root password in the installer has no sudo rights for your user. Switch to root with su -, including the dash, then run apt install net-tools. Plain su without the dash keeps your own PATH (Debian changed this in Debian 10), so ifconfig stays “not found” even as root.
For the third option, append the directory to your ~/.bashrc and reload it:
echo 'export PATH=$PATH:/usr/sbin' >> ~/.bashrc
source ~/.bashrc
After that, command -v ifconfig returns /usr/sbin/ifconfig and the bare command works without sudo. Reading interface details never needs root, so this is safe; anything that changes an interface still has to go through sudo. The same PATH rule explains why route and arp also go missing for Debian users, since net-tools puts every tool except netstat in /usr/sbin.
Run route, netstat and arp
The package brings back more than ifconfig. These are the ones people still reach for, all from the same install:
route -nfor the routing tablenetstat -tulpnfor listening ports and the process behind eacharp -nfor the neighbour (ARP) cacheifconfig -sfor a one-line-per-interface summary with error counters
netstat needs sudo to show process names for sockets other users own. On Ubuntu 26.04 it showed SSH listening under PID 1, because sshd is socket-activated by systemd there:
sudo netstat -tulpn
The output lists each listening socket with the owning process:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 15822/systemd-resol
tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN 15822/systemd-resol
tcp6 0 0 :::22 :::* LISTEN 1/systemd
udp 0 0 127.0.0.54:53 0.0.0.0:* 15822/systemd-resol
udp 0 0 127.0.0.53:53 0.0.0.0:* 15822/systemd-resol
udp 0 0 10.0.1.50:68 0.0.0.0:* 10707/systemd-netwo
udp 0 0 127.0.0.1:323 0.0.0.0:* 28840/chronyd
udp6 0 0 ::1:323 :::* 28840/chronyd
The routing table reads the same way it did ten years ago, which is the main reason these tools survive in scripts and runbooks:
route -n
Here the default route goes through the gateway on eth0:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.1.1 0.0.0.0 UG 100 0 0 eth0
10.0.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
10.0.1.1 0.0.0.0 255.255.255.255 UH 100 0 0 eth0
In the Flags column, G marks a route through a gateway and H marks a route to a single host.
Check for missing secondary IPs
ifconfig shows only one IPv4 address per interface, so it silently hides any extra address added the modern way. Cloud-init, netplan, keepalived and ip addr add all assign secondary addresses without the old eth0:1 alias labels, and ifconfig was written for the alias model. If you are checking whether a floating IP or a VIP landed on a box, ifconfig can tell you it is not there when it is.
We added a second address to the 26.04 VM to show it. If you try this, use a free address in your own subnet rather than 10.0.1.60:
sudo ip addr add 10.0.1.60/24 dev eth0
ifconfig eth0 | head -n 3
ifconfig still lists only the original address:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.1.50 netmask 255.255.255.0 broadcast 10.0.1.255
inet6 fe80::be24:11ff:fe58:15fd prefixlen 64 scopeid 0x20<link>
The ip command shows both addresses on the same interface:
ip -br address show eth0
Both IPv4 addresses appear on one line:
eth0 UP 10.0.1.50/24 metric 100 10.0.1.60/24 fe80::be24:11ff:fe58:15fd/64
Remove the test address when you’re done:
sudo ip addr del 10.0.1.60/24 dev eth0
The same goes for changes you make with ifconfig. They go straight into the running kernel and nothing writes them to netplan or /etc/network/interfaces, so they vanish at the next boot. On the 24.04 VM, sudo ifconfig eth0 mtu 1400 took effect at once and the interface was back at mtu 1500 after a reboot. For anything permanent on Ubuntu, put it in netplan; our static IP guide for Ubuntu 26.04 walks through the file.
Replace ifconfig with ip commands
ip from iproute2 is already installed on every standard Ubuntu and Debian install and cloud image, so it is the tool to learn if you only want to read your IP address. Anyone searching for ipconfig on Ubuntu wants this too: ipconfig is the Windows command, and the closest Linux equivalents are ip -br address for every interface or hostname -I for just the addresses.
| Task | net-tools | iproute2 |
|---|---|---|
| Show all interfaces | ifconfig -a | ip address |
| Short summary | ifconfig -s | ip -br address |
| Show only IP addresses | the inet lines of ifconfig | hostname -I |
| Bring an interface up | sudo ifconfig eth0 up | sudo ip link set eth0 up |
| Add an address | sudo ifconfig eth0:1 10.0.1.60 netmask 255.255.255.0 | sudo ip addr add 10.0.1.60/24 dev eth0 |
| Change the MTU | sudo ifconfig eth0 mtu 1400 | sudo ip link set eth0 mtu 1400 |
| Routing table | route -n | ip route |
| Listening ports | netstat -tulpn | ss -tulpn |
| ARP cache | arp -n | ip neigh |
Give ifconfig the netmask every time. Without it, sudo ifconfig eth0:1 10.0.1.60 on the 26.04 VM assigned the old classful mask: 10.0.1.60/8 with a 10.255.255.255 broadcast. The kernel then added a 10.0.0.0/8 route out of eth0, which quietly captures the whole range. ip addr add errs the other way: leave the prefix off and you get a harmless /32. If you already ran the bare ifconfig form, sudo ifconfig eth0:1 down removes the alias and its /8 route.
Our ifconfig vs ip usage guide goes through each pair with more options, and the nmcli guide for Ubuntu and Debian covers desktops where NetworkManager owns the interfaces. If you also manage RHEL-family servers, the ifconfig install on RHEL uses the same package name with dnf. Keep net-tools installed if old scripts depend on it, but read addresses with ip so a secondary IP never goes missing on you. The net-tools project page lists what upstream still maintains.