ifconfig

On this page 7

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.

FieldMeaningExample value
flagsState such as UP, RUNNING, BROADCASTUP,BROADCAST,RUNNING,MULTICAST
mtuMaximum transmission unit in bytes1500
inetIPv4 address with netmask and broadcast192.168.1.20 netmask 255.255.255.0
inet6IPv6 address with prefix length and scopefe80::1 prefixlen 64 scopeid 0x20
etherMAC address of the interface52:54:00:12:34:56
RX and TX packetsReceived and transmitted countersPackets, bytes, errors, dropped
Fields in ifconfig output

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.

Taskifconfig commandEffect
List active interfacesifconfigShows interfaces that are up
List all interfacesifconfig -aIncludes interfaces that are down
Assign an addressifconfig eth0 10.0.0.5 netmask 255.255.255.0Sets the primary IPv4 address
Bring an interface upifconfig eth0 upActivates the link
Change the MTUifconfig eth0 mtu 9000Enables jumbo frames
Enable promiscuous modeifconfig eth0 promiscReceives all frames on the segment
Typical ifconfig commands

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 commandModern equivalentNotes
ifconfigip address, ip linkShows all addresses, not only aliases
ifconfig eth0 upip link set eth0 upSame effect, Netlink-based
route -nip routeSupports multiple routing tables
arp -nip neighborCovers IPv4 and IPv6 neighbors
netstat -tulpnss -tulpnFaster on busy systems
ifconfig -sip -s linkInterface statistics
Legacy net-tools commands and their replacements

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.

SymptomLikely causeNext step
Rising RX errorsCabling, duplex mismatch or faulty NICCheck link settings with ethtool
Rising RX droppedReceive buffers full under loadInspect ring sizes and CPU load
TX carrier errorsPhysical link flappingCheck cable, switch port and logs
OverrunsInterface faster than the host can drainTune interrupts or offloads
Zero RX packetsInterface down, wrong VLAN or no linkVerify flags and switch configuration
Counter symptoms and likely causes

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.

SituationRecommended approachReason
New Linux scriptsUse ip with -json output where availableMaintained, complete, parseable
Legacy Linux scriptsMigrate gradually, test alias handlingHidden secondary addresses cause bugs
BusyBox systemsifconfig is acceptableOften the only tool present
FreeBSD or macOSUse native ifconfigPrimary, maintained utility there
Quick interactive checkEither toolLow risk when only reading
Practical guidance by situation
  • 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.