ifconfig is the classic Unix command-line utility for displaying and configuring network interfaces: their IPv4 and IPv6 addresses, netmasks, hardware addresses, MTU and up or down state. In Linux networking it comes from the net-tools package and is today considered deprecated in favor of the ip command from iproute2, although it remains installed or installable on many systems and is still the standard tool on BSD and macOS.
The name is short for interface configuration. Run without arguments, ifconfig lists active interfaces; with arguments, it changes interface settings immediately, but not persistently, because the change is lost at reboot unless a network configuration system reapplies it. Understanding ifconfig is still useful for reading older runbooks and scripts and for working on systems where it is the only tool available.
How ifconfig works on Linux
On Linux, ifconfig talks to the kernel through ioctl system calls on a socket, such as SIOCGIFADDR to read an address and SIOCSIFFLAGS to change interface flags. This interface predates the Netlink protocol that modern tools use, and it cannot express several features added to the Linux network stack since the late 1990s.
The most visible limitation concerns multiple addresses per interface. The ioctl interface handles one primary IPv4 address per name, so additional addresses must be created as aliases with a colon suffix, such as eth0:1. Addresses added with the ip command without a label are therefore invisible to ifconfig, which can mislead an administrator during troubleshooting.
The fields printed for each interface are summarized below.
| Field | Meaning | Example value |
|---|---|---|
| flags | State such as UP, RUNNING, BROADCAST | UP,BROADCAST,RUNNING,MULTICAST |
| mtu | Maximum transmission unit in bytes | 1500 |
| inet | IPv4 address with netmask and broadcast | 192.168.1.20 netmask 255.255.255.0 |
| inet6 | IPv6 address with prefix length and scope | fe80::1 prefixlen 64 scopeid 0x20 |
| ether | MAC address of the interface | 52:54:00:12:34:56 |
| RX and TX packets | Received and transmitted counters | Packets, bytes, errors, dropped |
Common ifconfig operations
ifconfig combines inspection and configuration in a single syntax: the interface name comes first, followed by addresses or keywords. All configuration changes require root privileges, and they take effect immediately.
| Task | ifconfig command | Effect |
|---|---|---|
| List active interfaces | ifconfig | Shows interfaces that are up |
| List all interfaces | ifconfig -a | Includes interfaces that are down |
| Assign an address | ifconfig eth0 10.0.0.5 netmask 255.255.255.0 | Sets the primary IPv4 address |
| Bring an interface up | ifconfig eth0 up | Activates the link |
| Change the MTU | ifconfig eth0 mtu 9000 | Enables jumbo frames |
| Enable promiscuous mode | ifconfig eth0 promisc | Receives all frames on the segment |
ifconfig does not manage routes; on Linux that was the job of the separate route command from the same package. A complete legacy configuration therefore needed several tools, while the ip command covers addresses, links, routes and neighbors in one consistent syntax.
ifconfig compared with the ip command
The net-tools package received very little maintenance for many years, and most major distributions stopped installing it by default during the 2010s. The ip command from iproute2 is the maintained replacement and uses Netlink, which gives it access to the full feature set of the kernel.
| Legacy command | Modern equivalent | Notes |
|---|---|---|
| ifconfig | ip address, ip link | Shows all addresses, not only aliases |
| ifconfig eth0 up | ip link set eth0 up | Same effect, Netlink-based |
| route -n | ip route | Supports multiple routing tables |
| arp -n | ip neighbor | Covers IPv4 and IPv6 neighbors |
| netstat -tulpn | ss -tulpn | Faster on busy systems |
| ifconfig -s | ip -s link | Interface statistics |
Neither ifconfig nor ip writes persistent configuration. On current distributions, persistence comes from NetworkManager, systemd-networkd or Netplan, and changes made by hand may be overwritten when those services reapply their profiles.
Reading interface counters for troubleshooting
The RX and TX counters at the end of each ifconfig entry are a quick first indicator of link health. They are cumulative since the interface was created, so a single reading says little; comparing two readings a few seconds apart shows whether problems are current or historical.
| Symptom | Likely cause | Next step |
|---|---|---|
| Rising RX errors | Cabling, duplex mismatch or faulty NIC | Check link settings with ethtool |
| Rising RX dropped | Receive buffers full under load | Inspect ring sizes and CPU load |
| TX carrier errors | Physical link flapping | Check cable, switch port and logs |
| Overruns | Interface faster than the host can drain | Tune interrupts or offloads |
| Zero RX packets | Interface down, wrong VLAN or no link | Verify flags and switch configuration |
The same counters are available through ip -s link, ethtool -S for driver-specific statistics and the files under /sys/class/net, which are the most reliable source for monitoring scripts because their format does not change.
When ifconfig still appears and how to use it safely
ifconfig remains relevant in mixed environments and older documentation. Administrators meet it in legacy scripts, embedded systems with BusyBox, older enterprise releases and BSD-derived systems where it is the native and actively maintained tool with a richer feature set.
| Situation | Recommended approach | Reason |
|---|---|---|
| New Linux scripts | Use ip with -json output where available | Maintained, complete, parseable |
| Legacy Linux scripts | Migrate gradually, test alias handling | Hidden secondary addresses cause bugs |
| BusyBox systems | ifconfig is acceptable | Often the only tool present |
| FreeBSD or macOS | Use native ifconfig | Primary, maintained utility there |
| Quick interactive check | Either tool | Low risk when only reading |
- Parsing ifconfig output is fragile, because its format changed between net-tools versions.
- Interface names are now predictable names such as enp3s0 rather than eth0 on most systems.
- Changing addresses over SSH on the same interface can cut off the session; use a console or a timed rollback.
The simple explanation
ifconfig is an old command that shows how a computer is connected to a network. It lists each network card, its address and whether it is switched on.
It can also change those settings, a bit like a phone settings screen for Wi-Fi. On modern Linux systems, a newer tool called ip does the same job more completely, so ifconfig is mostly kept for habit and compatibility.
How it is used in practice
A network engineer troubleshoots a Linux virtual machine that answers on one of its two service addresses but not the other. A legacy health-check script uses ifconfig and reports only 192.168.10.15 on the interface, so the second address seems to be missing.
Running ip address show reveals that the second address, 192.168.10.16, is configured but has no alias label, which is why ifconfig never displayed it. The real fault is a firewall rule. The engineer fixes the rule and rewrites the health check with the ip command, removing the false alarm for good.