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
| Command | What it does | Root? |
|---|---|---|
ifconfig | Show all interfaces that are up (Linux, macOS, BSD show all by default on some versions; see notes) | No |
ifconfig -a | Show all interfaces including those that are down | No |
ifconfig eth0 | Show one interface | No |
ifconfig -s | Short table with packet counters (Linux only, same as netstat -i) | No |
ifconfig -l | List interface names only (macOS, BSD) | No |
ifconfig -u / -d | Only interfaces that are up / down (macOS, BSD) | No |
ifconfig eth0 up | Bring an interface up | Yes |
ifconfig eth0 down | Bring an interface down | Yes |
ifconfig eth0 192.168.1.50 netmask 255.255.255.0 | Set an IPv4 address and mask (Linux; BSD needs inet) | Yes |
ifconfig eth0 mtu 9000 | Set the MTU | Yes |
ifconfig eth0 hw ether 00:11:22:33:44:55 | Change the MAC address (Linux; BSD uses ether, macOS ether) | Yes |
ifconfig eth0 promisc | Enable promiscuous mode | Yes |
Which ifconfig do you have?
There are at least four independent implementations, which explains why syntax that works on one machine fails on another.
| System | Implementation | Status | How to tell |
|---|---|---|---|
| Linux | net-tools (last release 2.10, 2021) | Deprecated; not installed by default on Debian, Ubuntu, Fedora, RHEL 7+, Arch | ifconfig --version prints net-tools 2.10 |
| Linux (embedded, Alpine, routers) | BusyBox applet | Maintained, minimal | ifconfig --help mentions BusyBox |
| macOS | Apple fork of the FreeBSD ifconfig | Current, but Apple documents networksetup for configuration | Netmask printed as hex, status: active line |
| FreeBSD, DragonFly | FreeBSD ifconfig | Current and primary; handles Wi-Fi, VLANs, bridges, lagg, jails | ifconfig -v shows driver details |
| OpenBSD, NetBSD | Their own | Current and primary | OpenBSD prints index and priority lines |
| Solaris, illumos | Legacy; replaced by ipadm/dladm | Still present | Plumb/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:
ifconfig eth0eth0: 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,eno1orwlp2s0instead ofeth0andwlan0. 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:27is 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:
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
ifconfig -sIface 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 LRUThe 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.
ifconfig en0en0: 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.
0xffffff00is 255.255.255.0 (/24);0xffff0000is 255.255.0.0 (/16);0xfffffe00is 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: inactivemeans no link. On Wi-Fi you may seemedia: 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
ifconfig em0em0: 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
| Flag | Hex | Meaning |
|---|---|---|
| UP | 0x1 | Administratively enabled. Set by ifconfig X up. Does not imply a working link. |
| BROADCAST | 0x2 | The interface supports broadcast (Ethernet, Wi-Fi). Absent on point-to-point links. |
| DEBUG | 0x4 | Driver debugging on. Rare. |
| LOOPBACK | 0x8 | The loopback interface (lo / lo0). |
| POINTOPOINT | 0x10 | A point-to-point link: PPP, VPN tunnels, WireGuard. |
| NOTRAILERS | 0x20 | Historical; ignored. |
| RUNNING | 0x40 | The driver has resources allocated and, on Linux, the link is operational. UP + RUNNING is what a healthy Ethernet port shows. |
| NOARP | 0x80 | ARP disabled; typical for tunnels and some point-to-point links. |
| PROMISC | 0x100 | Promiscuous mode: receives every frame on the segment, not just those addressed to it. Set by tcpdump and Wireshark. |
| ALLMULTI | 0x200 | Receives all multicast frames. Set by routing daemons and some bridges. |
| MASTER / SLAVE | 0x400 / 0x800 | Linux bonding roles. |
| MULTICAST | 0x1000 | Multicast capable. Expected on Ethernet and Wi-Fi. |
| PORTSEL, AUTOMEDIA | 0x2000, 0x4000 | Media selection; mostly historical. |
| DYNAMIC | 0x8000 | Address is lost when the interface goes down (Linux). |
| LOWER_UP | 0x10000 | Physical link detected (Linux ip, FreeBSD ifconfig). |
| SIMPLEX | BSD | Cannot hear own transmissions. Normal on BSD/macOS. |
| SMART | macOS | Apple 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
sudo ifconfig eth0 down
sudo ifconfig eth0 upOn 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
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/24Setting 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.
sudo ifconfig en0 inet 192.168.1.50 netmask 255.255.255.0
# the "inet" keyword is required on BSD-derived systemsThis is overridden the next time the DHCP client runs, which on macOS is almost immediately. To set a lasting static address use networksetup -setmanual. See the macOS page →
sudo ifconfig em0 inet 192.168.1.50/24
sudo ifconfig em0 inet 192.168.1.50 netmask 255.255.255.0Persist it in /etc/rc.conf: ifconfig_em0="inet 192.168.1.50/24" and defaultrouter="192.168.1.1", then service netif restart && service routing restart.
Add a second address (alias)
# 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/64Aliases 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.
sudo ifconfig en0 alias 192.168.1.51 netmask 255.255.255.255
sudo ifconfig en0 -alias 192.168.1.51
# IPv6
sudo ifconfig en0 inet6 2001:db8::50 prefixlen 64 alias
sudo ifconfig en0 inet6 2001:db8::50 -aliasAn alias on the same subnet as the primary address should use a /32 mask (255.255.255.255) on FreeBSD to avoid duplicate route warnings.
Set the MTU
sudo ifconfig eth0 mtu 9000 # Linux
sudo ifconfig en0 mtu 1400 # macOS/BSD, same syntaxJumbo 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
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether 02:11:22:33:44:55
sudo ifconfig eth0 upUse 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.
sudo ifconfig en0 ether 02:11:22:33:44:55For Wi-Fi you must first disassociate: sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z on older versions; on macOS 14 and later the airport tool is gone, so turn Wi-Fi off and on in the menu bar, then set the MAC before it reassociates. macOS 15 and later also offer per-network private (randomised) Wi-Fi addresses in System Settings, which is usually what people want.
sudo ifconfig em0 ether 02:11:22:33:44:55Also accepts lladdr as a synonym.
Promiscuous mode
sudo ifconfig eth0 promisc
sudo ifconfig eth0 -promiscCapture 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)
| Keyword | Effect |
|---|---|
arp / -arp | Enable or disable ARP on the interface |
multicast | Set the multicast flag |
allmulti / -allmulti | Receive all multicast |
txqueuelen N | Transmit queue length; 1000 is the default for Ethernet |
pointopoint ADDR | Set the peer address on a point-to-point link |
dstaddr ADDR | Older spelling of pointopoint |
metric N | Interface metric (ignored by the Linux kernel) |
media TYPE | Select media type where the driver supports it; use ethtool instead |
irq, io_addr, mem_start | ISA-era hardware settings; historical |
tunnel ADDR | Create a SIT (IPv6-in-IPv4) tunnel; use ip tunnel instead |
inet, inet6, ax25, ddp, ipx, netrom | Address 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
| Task | ifconfig (net-tools) | ip (iproute2) |
|---|---|---|
| Show all interfaces | ifconfig -a | ip addr or ip -br addr |
| Show one interface | ifconfig eth0 | ip addr show dev eth0 |
| Interface up | ifconfig eth0 up | ip link set eth0 up |
| Interface down | ifconfig eth0 down | ip link set eth0 down |
| Set address | ifconfig eth0 192.168.1.50 netmask 255.255.255.0 | ip addr add 192.168.1.50/24 dev eth0 (after flushing the old one) |
| Add second address | ifconfig eth0:1 192.168.1.51 | ip addr add 192.168.1.51/24 dev eth0 |
| Remove address | ifconfig eth0:1 down | ip addr del 192.168.1.51/24 dev eth0 |
| Set MTU | ifconfig eth0 mtu 9000 | ip link set eth0 mtu 9000 |
| Set MAC | ifconfig eth0 hw ether … | ip link set eth0 address … |
| Promiscuous | ifconfig eth0 promisc | ip link set eth0 promisc on |
| Counters | ifconfig eth0 (bottom) or ifconfig -s | ip -s link show eth0 |
| Routes | route -n | ip route |
| Default gateway | route add default gw 192.168.1.1 | ip route add default via 192.168.1.1 |
| ARP table | arp -n | ip neigh |
The full ip command reference goes much further.
Common errors
| Message | Cause | Fix |
|---|---|---|
| ifconfig: command not found / bash: ifconfig: command not found | net-tools is not installed, or /sbin is not in a normal user's PATH | Try /sbin/ifconfig first. Otherwise install net-tools or use ip. Full fix → |
| SIOCSIFFLAGS: Operation not permitted | Changing interface state without root | Prefix with sudo |
| SIOCSIFADDR: No such device / eth0: ERROR while getting interface flags: No such device | The interface name does not exist | Run ifconfig -a or ip link to see real names; you probably want enp3s0 or similar |
| SIOCSIFFLAGS: Cannot assign requested address | Usually a Wi-Fi interface blocked by rfkill or a driver that is not ready | Check rfkill list and dmesg |
| ifconfig: interface en9 does not exist (macOS/BSD) | Typo or the adapter is unplugged | ifconfig -l lists what exists |
| ifconfig: ioctl (SIOCAIFADDR): permission denied (macOS) | Missing sudo | Use sudo |
| ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address | Trying to remove an address that is not there | Check the current address first |
Installing ifconfig
sudo apt update && sudo apt install net-toolssudo dnf install net-toolssudo pacman -S net-tools# BusyBox already provides a minimal ifconfig; for the full version:
sudo apk add net-toolssudo zypper install net-tools-deprecatedopenSUSE'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.