ipconfig.co.uk

ifconfig: the complete reference

ifconfig (interface configuration) is the original Unix tool for viewing and setting network interface parameters. It first appeared in 4.2BSD in 1983 and still ships on macOS and every BSD. On Linux it belongs to the net-tools package, is deprecated in favour of ip, and is often not installed. This page covers all three families, because the output and the syntax differ more than most guides admit.

Quick reference

CommandWhat it doesRoot?
ifconfigShow all interfaces that are up (Linux, macOS, BSD show all by default on some versions; see notes)No
ifconfig -aShow all interfaces including those that are downNo
ifconfig eth0Show one interfaceNo
ifconfig -sShort table with packet counters (Linux only, same as netstat -i)No
ifconfig -lList interface names only (macOS, BSD)No
ifconfig -u / -dOnly interfaces that are up / down (macOS, BSD)No
ifconfig eth0 upBring an interface upYes
ifconfig eth0 downBring an interface downYes
ifconfig eth0 192.168.1.50 netmask 255.255.255.0Set an IPv4 address and mask (Linux; BSD needs inet)Yes
ifconfig eth0 mtu 9000Set the MTUYes
ifconfig eth0 hw ether 00:11:22:33:44:55Change the MAC address (Linux; BSD uses ether, macOS ether)Yes
ifconfig eth0 promiscEnable promiscuous modeYes

Which ifconfig do you have?

There are at least four independent implementations, which explains why syntax that works on one machine fails on another.

SystemImplementationStatusHow to tell
Linuxnet-tools (last release 2.10, 2021)Deprecated; not installed by default on Debian, Ubuntu, Fedora, RHEL 7+, Archifconfig --version prints net-tools 2.10
Linux (embedded, Alpine, routers)BusyBox appletMaintained, minimalifconfig --help mentions BusyBox
macOSApple fork of the FreeBSD ifconfigCurrent, but Apple documents networksetup for configurationNetmask printed as hex, status: active line
FreeBSD, DragonFlyFreeBSD ifconfigCurrent and primary; handles Wi-Fi, VLANs, bridges, lagg, jailsifconfig -v shows driver details
OpenBSD, NetBSDTheir ownCurrent and primaryOpenBSD prints index and priority lines
Solaris, illumosLegacy; replaced by ipadm/dladmStill presentPlumb/unplumb keywords

Reading the output on Linux

net-tools 2.x (Ubuntu 18.04 and later, Debian 10 and later, RHEL 8 and later) prints this layout:

Linux · Terminal
ifconfig eth0
Output
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.42  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe4e:66a1  prefixlen 64  scopeid 0x20<link>
        inet6 2a00:23c4:5f1a:8b00:a00:27ff:fe4e:66a1  prefixlen 64  scopeid 0x0<global>
        ether 08:00:27:4e:66:a1  txqueuelen 1000  (Ethernet)
        RX packets 184213  bytes 231770215 (221.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 97312  bytes 11284570 (10.7 MiB)
        TX errors 0  dropped 0  overruns 0  carrier 0  collisions 0
eth0:
The interface name. Modern systemd distributions use predictable names such as enp3s0, ens192, eno1 or wlp2s0 instead of eth0 and wlan0. How the names are built →
flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
The interface flags as a decimal number and as names. 4163 = 0x1043 = UP (0x1) + BROADCAST (0x2) + RUNNING (0x40) + MULTICAST (0x1000). See the flag table. UP without RUNNING means the interface is enabled but has no link: cable unplugged or Wi-Fi not associated.
mtu 1500
Maximum transmission unit in bytes. 1500 is standard Ethernet; 9000 is jumbo frames; 1280 is the IPv6 minimum; PPPoE links are often 1492 and VPN tunnels 1400 or lower.
inet / netmask / broadcast
IPv4 address, mask and broadcast address. Old net-tools shows only one IPv4 address per interface even if the kernel has several; that is one of the reasons it was replaced.
inet6 … prefixlen 64 scopeid 0x20<link>
IPv6 addresses with their prefix length and scope: <link> for fe80:: link-local, <global> for routable addresses, <host> for ::1, <site> for the deprecated site-local range.
ether 08:00:27:4e:66:a1
The MAC address. 08:00:27 is the VirtualBox prefix, so this is a VM. Followed by the transmit queue length and the link type in brackets.
RX / TX packets, bytes
Counters since boot. errors are frames with checksum or framing problems (bad cable, duplex mismatch); dropped are packets the kernel discarded because a buffer was full; overruns mean the NIC ring buffer filled before the driver could empty it; frame counts misaligned frames; carrier counts link losses during transmit; collisions should be zero on any switched network.

The older Linux layout

net-tools 1.60 (CentOS 6 and 7, Ubuntu 16.04, most tutorials written before 2018) prints the same information in a different shape. If you are following an old tutorial, this is the output it shows:

Output
eth0      Link encap:Ethernet  HWaddr 08:00:27:4e:66:a1
          inet addr:192.168.1.42  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe4e:66a1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:184213 errors:0 dropped:0 overruns:0 frame:0
          TX packets:97312 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:231770215 (221.0 MiB)  TX bytes:11284570 (10.7 MiB)

Short form

Linux · Terminal
ifconfig -s
Output
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0      1500   184213      0      0 0         97312      0      0      0 BMRU
lo       65536     2210      0      0 0          2210      0      0      0 LRU

The Flg column abbreviates the flags: B broadcast, M multicast, R running, U up, L loopback, P point-to-point, O no ARP, A allmulti, D debug, m master, s slave.

Reading the output on macOS

macOS prints one block per interface, and there are many interfaces. On a MacBook you will typically see lo0, gif0, stf0, anpi0, en0 (Wi-Fi), en1 to en5 (Thunderbolt, USB Ethernet, bridges), ap1, awdl0 (AirDrop), llw0, bridge0 and utun0 to utun4 (VPN and iCloud Private Relay tunnels). The one you want is usually en0.

macOS · Terminal
ifconfig en0
Output
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
	ether f0:18:98:3a:2b:1c
	inet6 fe80::1c2b:3d4e:5f60:7a8b%en0 prefixlen 64 secured scopeid 0xc
	inet 192.168.1.23 netmask 0xffffff00 broadcast 192.168.1.255
	inet6 2a00:23c4:5f1a:8b00:8c1:2f3e:4d5a:6b7c prefixlen 64 autoconf secured
	inet6 2a00:23c4:5f1a:8b00:f1e2:d3c4:b5a6:9788 prefixlen 64 autoconf temporary
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
netmask 0xffffff00
BSD prints masks in hexadecimal. 0xffffff00 is 255.255.255.0 (/24); 0xffff0000 is 255.255.0.0 (/16); 0xfffffe00 is 255.255.254.0 (/23). Convert with the mask table.
options=…
Hardware offload capabilities (TCP segmentation offload, checksum offload). Informational.
secured / autoconf / temporary
macOS marks IPv6 addresses by origin: autoconf from SLAAC, secured means a stable privacy address generated per RFC 7217 (not derived from the MAC), temporary is a rotating privacy address, dynamic comes from DHCPv6.
media: autoselect / status: active
Link negotiation and link state. status: inactive means no link. On Wi-Fi you may see media: autoselect (<unknown type>); that is normal.
SIMPLEX, SMART
BSD-specific flags. SIMPLEX means the hardware cannot hear its own transmissions; SMART is an Apple driver flag. Neither needs attention.

Useful macOS-only switches: ifconfig -l lists just the names on one line; ifconfig -u shows only interfaces that are up; ifconfig -v en0 adds link quality and per-interface statistics; ifconfig -L en0 shows IPv6 address lifetimes; ifconfig -m en0 lists the media types the hardware supports.

Reading the output on FreeBSD and OpenBSD

BSD · Terminal
ifconfig em0
Output
em0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
	options=4e524bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,NOMAP,TXTLS4,TXTLS6,VXLAN_HWCSUM,VXLAN_HWTSO,TXTLS_RTLMT>
	ether 00:0c:29:5b:81:f3
	inet 192.168.1.60 netmask 0xffffff00 broadcast 192.168.1.255
	inet6 fe80::20c:29ff:fe5b:81f3%em0 prefixlen 64 scopeid 0x1
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

FreeBSD 14 prints LOWER_UP when the physical link is up, and the media line tells you negotiated speed and duplex, which is what Linux users get from ethtool. OpenBSD adds index, priority, llprio and, for DHCP-managed interfaces, an inet autoconf note. Interface names follow the driver: em0, igb0, re0, vtnet0, ix0, wlan0, bge0.

Interface flags

FlagHexMeaning
UP0x1Administratively enabled. Set by ifconfig X up. Does not imply a working link.
BROADCAST0x2The interface supports broadcast (Ethernet, Wi-Fi). Absent on point-to-point links.
DEBUG0x4Driver debugging on. Rare.
LOOPBACK0x8The loopback interface (lo / lo0).
POINTOPOINT0x10A point-to-point link: PPP, VPN tunnels, WireGuard.
NOTRAILERS0x20Historical; ignored.
RUNNING0x40The driver has resources allocated and, on Linux, the link is operational. UP + RUNNING is what a healthy Ethernet port shows.
NOARP0x80ARP disabled; typical for tunnels and some point-to-point links.
PROMISC0x100Promiscuous mode: receives every frame on the segment, not just those addressed to it. Set by tcpdump and Wireshark.
ALLMULTI0x200Receives all multicast frames. Set by routing daemons and some bridges.
MASTER / SLAVE0x400 / 0x800Linux bonding roles.
MULTICAST0x1000Multicast capable. Expected on Ethernet and Wi-Fi.
PORTSEL, AUTOMEDIA0x2000, 0x4000Media selection; mostly historical.
DYNAMIC0x8000Address is lost when the interface goes down (Linux).
LOWER_UP0x10000Physical link detected (Linux ip, FreeBSD ifconfig).
SIMPLEXBSDCannot hear own transmissions. Normal on BSD/macOS.
SMARTmacOSApple driver flag. Ignore.

Configuring interfaces

All of these need root: prefix with sudo. Note the syntax differences between Linux and BSD/macOS, which are the single most common cause of "ifconfig doesn't work" complaints.

Bring an interface up or down

Any shell
sudo ifconfig eth0 down
sudo ifconfig eth0 up

On macOS use en0; downing Wi-Fi this way disconnects it and it will reconnect when brought back up. On Linux with NetworkManager, downing an interface may trigger NetworkManager to bring it back up seconds later; use nmcli device disconnect eth0 instead.

Set an IPv4 address

Linux · Terminal
sudo ifconfig eth0 192.168.1.50 netmask 255.255.255.0
# broadcast is derived automatically; set it explicitly if needed
sudo ifconfig eth0 192.168.1.50 netmask 255.255.255.0 broadcast 192.168.1.255
# CIDR form (net-tools 2.x only)
sudo ifconfig eth0 192.168.1.50/24

Setting an address this way replaces the primary address. It does not set a default gateway; for that use sudo route add default gw 192.168.1.1 (net-tools) or sudo ip route add default via 192.168.1.1.

Add a second address (alias)

Linux · Terminal
# classic alias interface (shows up as eth0:1)
sudo ifconfig eth0:1 192.168.1.51 netmask 255.255.255.0 up
# remove it
sudo ifconfig eth0:1 down
# net-tools 2.x also has add/del for IPv6 and IPv4
sudo ifconfig eth0 add 2001:db8::50/64
sudo ifconfig eth0 del 2001:db8::50/64

Aliases like eth0:1 are a compatibility fiction; the kernel just has multiple addresses on eth0. ip addr shows them all, plain ifconfig shows only those with a label.

Set the MTU

Any shell
sudo ifconfig eth0 mtu 9000     # Linux
sudo ifconfig en0 mtu 1400      # macOS/BSD, same syntax

Jumbo frames only help if every device on the path supports them. A too-large MTU on a VPN or PPPoE link causes stalled downloads and pages that half-load; try 1400 if that describes your problem.

Change the MAC address

Linux · Terminal
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether 02:11:22:33:44:55
sudo ifconfig eth0 up

Use a locally-administered address (second hex digit 2, 6, A or E) to avoid clashing with a real manufacturer prefix. NetworkManager can randomise or clone MACs persistently; see nmcli.

Promiscuous mode

Any shell
sudo ifconfig eth0 promisc
sudo ifconfig eth0 -promisc

Capture tools set this for you. If you see PROMISC in the flags and are not running a capture, find out why: ip link and the kernel log (dmesg | grep promisc) record who enabled it.

Other keywords (Linux net-tools)

KeywordEffect
arp / -arpEnable or disable ARP on the interface
multicastSet the multicast flag
allmulti / -allmultiReceive all multicast
txqueuelen NTransmit queue length; 1000 is the default for Ethernet
pointopoint ADDRSet the peer address on a point-to-point link
dstaddr ADDROlder spelling of pointopoint
metric NInterface metric (ignored by the Linux kernel)
media TYPESelect media type where the driver supports it; use ethtool instead
irq, io_addr, mem_startISA-era hardware settings; historical
tunnel ADDRCreate a SIT (IPv6-in-IPv4) tunnel; use ip tunnel instead
inet, inet6, ax25, ddp, ipx, netromAddress family selector; the last four are dead protocols

Why ifconfig was deprecated on Linux

ifconfig on Linux talks to the kernel through ioctl calls designed in the 1980s. The Linux networking stack moved on, and the old interface simply cannot express what the kernel can do. Concretely, net-tools ifconfig:

  • Shows only the first IPv4 address on an interface, silently hiding the rest.
  • Cannot manage policy routing, multiple routing tables, or route metrics properly.
  • Knows nothing about network namespaces, VLANs, bridges, bonds, VRFs, VXLAN, MACVLAN, tun/tap, or traffic control.
  • Cannot show or set IPv6 address lifetimes, flags or the neighbour cache.
  • Cannot produce machine-readable output.
  • Prints counters using 32-bit-era formatting that wraps on busy interfaces in some versions.

Alexey Kuznetsov wrote iproute2 in 1999 to expose the new rtnetlink interface. Distributions kept net-tools for years for compatibility, then stopped installing it by default: Arch in 2011, Debian and Ubuntu around 2018, RHEL and CentOS with version 7 (2014), Fedora with 18. Debian's net-tools maintainers wrote in 2009 that the tools "should be considered obsolete". The package still exists and still works for simple tasks; it just is not the tool the kernel developers or the distributions maintain going forward. Full history →

None of this applies to BSD. FreeBSD's ifconfig is actively developed and is the right tool there; it gained JSON-ish output via -f format flags, VLAN, bridge, lagg, Wi-Fi scanning and epair support over the years.

ifconfig to ip translation

Taskifconfig (net-tools)ip (iproute2)
Show all interfacesifconfig -aip addr or ip -br addr
Show one interfaceifconfig eth0ip addr show dev eth0
Interface upifconfig eth0 upip link set eth0 up
Interface downifconfig eth0 downip link set eth0 down
Set addressifconfig eth0 192.168.1.50 netmask 255.255.255.0ip addr add 192.168.1.50/24 dev eth0 (after flushing the old one)
Add second addressifconfig eth0:1 192.168.1.51ip addr add 192.168.1.51/24 dev eth0
Remove addressifconfig eth0:1 downip addr del 192.168.1.51/24 dev eth0
Set MTUifconfig eth0 mtu 9000ip link set eth0 mtu 9000
Set MACifconfig eth0 hw ether …ip link set eth0 address …
Promiscuousifconfig eth0 promiscip link set eth0 promisc on
Countersifconfig eth0 (bottom) or ifconfig -sip -s link show eth0
Routesroute -nip route
Default gatewayroute add default gw 192.168.1.1ip route add default via 192.168.1.1
ARP tablearp -nip neigh

The full ip command reference goes much further.

Common errors

MessageCauseFix
ifconfig: command not found / bash: ifconfig: command not foundnet-tools is not installed, or /sbin is not in a normal user's PATHTry /sbin/ifconfig first. Otherwise install net-tools or use ip. Full fix →
SIOCSIFFLAGS: Operation not permittedChanging interface state without rootPrefix with sudo
SIOCSIFADDR: No such device / eth0: ERROR while getting interface flags: No such deviceThe interface name does not existRun ifconfig -a or ip link to see real names; you probably want enp3s0 or similar
SIOCSIFFLAGS: Cannot assign requested addressUsually a Wi-Fi interface blocked by rfkill or a driver that is not readyCheck rfkill list and dmesg
ifconfig: interface en9 does not exist (macOS/BSD)Typo or the adapter is unpluggedifconfig -l lists what exists
ifconfig: ioctl (SIOCAIFADDR): permission denied (macOS)Missing sudoUse sudo
ifconfig: ioctl (SIOCDIFADDR): Can't assign requested addressTrying to remove an address that is not thereCheck the current address first

Installing ifconfig

Linux · Terminal
sudo apt update && sudo apt install net-tools

openSUSE's package name says it plainly. If you are installing it only out of habit, spend the same five minutes learning ip -br addr, ip route and ip neigh; they cover everything ifconfig, route and arp did.

Related pages

Last reviewed . Command syntax verified against Windows 11, Ubuntu 24.04, macOS 15 and FreeBSD 14 unless noted otherwise.

Spotted a mistake or a switch we have missed? Every page on this site is written to be checked against real output, so please test on your own machine and compare.