ifconfig, mii-tool
ifconfig (interface configuration) shows an interface's IP, MAC, MTU, flags and counters, and lets root change them live. It is legacy net-tools on Linux (replaced by ip) but still the standard tool on macOS/BSD; mii-tool (and today ethtool) reports the physical cable link.
16.1 Where it runs
| OS | ifconfig | Alternative |
|---|---|---|
| Linux | net-tools package (legacy, deprecated) | ip (iproute2) |
| macOS | Built-in /sbin/ifconfig, standard | - |
| Windows | Not available | ipconfig, Get-NetAdapter |
16.2 How it works
- ifconfig reads (and sets) interface state in the kernel: flags, IP, MTU, counters.
- Lab: Docker LAN, pc1 = 192.168.36.10, pc2 = 192.168.36.20 on bridge n016-lan.
- Changes affect only the running kernel state; they are gone after a reboot.
- Step 1
1.ifconfig on pc1 reads eth0 from the kernel: UP RUNNING, mtu 1500
- Step 2
2.pc2 (192.168.36.20) sends a ping
- Step 3
3.Packet crosses the Docker bridge n016-lan
- Step 4
4.Arrives at pc1 eth0: RX packets +1
- Step 5
5.After ifconfig eth0 down: same ping dropped at pc1, 100% loss
16.3 Linux ifconfig: display options
- ifconfig eth0: one interface; inet = IPv4 + netmask, ether = MAC; RX/TX = counters (errors/dropped above 0 = link problem).
- Plain ifconfig shows only UP interfaces; -a also shows down ones (gre0, sit0 without UP).
- -s: compact table, one line per interface; Flg BMRU = Broadcast, Multicast, Running, Up.
Terminal
ifconfig eth0ifconfig -aifconfig -sOutput
$ ifconfig eth0eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.36.10 netmask 255.255.255.0 ether 6e:e8:18:13:f9:5e txqueuelen 0 RX packets 4854 bytes 6837850 (6.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2489 bytes 168767 (164.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0$ ifconfig -aerspan0: flags=4098<BROADCAST,MULTICAST> mtu 1450eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500gre0: flags=128<NOARP> mtu 1476gretap0: flags=4098<BROADCAST,MULTICAST> mtu 1462ip6gre0: flags=128<NOARP> mtu 1448ip6tnl0: flags=128<NOARP> mtu 1452lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536sit0: flags=128<NOARP> mtu 1480tunl0: flags=128<NOARP> mtu 1480$ ifconfig -sIface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flgeth0 1500 4854 0 0 0 2489 0 0 0 BMRUlo 65536 8 0 0 0 8 0 0 0 LRU| Flag | Meaning |
|---|---|
| UP | Interface is administratively on (ifconfig up) |
| RUNNING | Physical link is ready |
| BROADCAST / MULTICAST | Supports broadcast / multicast |
| PROMISC | NIC receives all packets (tcpdump) |
| NOARP | ARP disabled (-arp); tunnels like gre0 show it |
| LOOPBACK | The lo interface |
- -v makes errors verbose; after the interface name comes the address family: inet (default IPv4), inet6, and old ones (ax25, netrom, ddp, ipx).
Output
-v eth0 mtu 9000 verbose errorseth0 inet ADDR IPv4 (default)eth0 inet6 ... IPv6ax0 ax25 AX.25 packet radionr0 netrom NET/ROM packet radioeth0 ddp AppleTalk (display only)eth0 ipx Novell IPX (display only)16.4 Linux ifconfig: addresses
- Second IP on one interface = alias eth0:1; no netmask given, still /24 because 192.168.x is class C.
- pc2 pings the new IP successfully; IPv6 uses inet6 add / inet6 del.
Terminal
ifconfig eth0:1 192.168.36.50ping -c 2 192.168.36.50 # from pc2ifconfig eth0 inet6 add 2001:db8:36::10/64ifconfig eth0 | grep inet6ifconfig eth0 inet6 del 2001:db8:36::10/64Output
$ ifconfig eth0:1eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.36.50 netmask 255.255.255.0pc2$ ping -c 2 192.168.36.5064 bytes from 192.168.36.50: icmp_seq=1 ttl=6464 bytes from 192.168.36.50: icmp_seq=2 ttl=642 packets transmitted, 2 received, 0% packet loss$ ifconfig eth0 | grep inet6 inet6 2001:db8:36::10 prefixlen 64 scopeid 0x0<global> inet6 fe80::6ce8:18ff:fe13:f95e prefixlen 6416.5 Linux ifconfig: state and flags
- down removes UP and RUNNING, so pc2's ping shows 100% loss; up restores it.
- promisc = receive all packets (capture tools depend on it); -promisc turns it off.
- -arp disables ARP, so NOARP appears in the flags; arp turns it back on.
Terminal
ifconfig eth0 downping -c 2 -W 1 192.168.36.10 # from pc2ifconfig eth0 upifconfig eth0 promiscifconfig eth0 -promisc -arpifconfig eth0 arpOutput
$ ifconfig eth0 down$ ifconfig eth0 | head -1eth0: flags=4098<BROADCAST,MULTICAST> mtu 1500pc2$ ping -c 2 -W 1 192.168.36.102 packets transmitted, 0 received, 100% packet loss$ ifconfig eth0 upeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500$ ifconfig eth0 promisceth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500$ ifconfig eth0 -promisc -arpeth0: flags=4291<UP,BROADCAST,RUNNING,NOARP,MULTICAST> mtu 1500Output
allmulti, -allmulti all multicastmulticast multicast flag setbroadcast, -broadcast BROADCAST flagpointopoint, -pointopoint P2P link flagbroadcast 192.168.1.255 broadcast addrppp0 ... pointopoint 10.0.0.2 remote enddstaddr 10.0.0.2 same (obsolete)eth0:0- 192.168.1.20 alias, without upeth0:0 down alias deleteeth0:0 0.0.0.0 alias deletesit0 tunnel ::203.0.113.5 IPv6-in-IPv416.6 Linux ifconfig: link and hardware parameters
- mtu = max size of one packet; txqueuelen = transmit queue length; hw ether = change the MAC.
Terminal
ifconfig eth0 mtu 1400ifconfig eth0 txqueuelen 500ifconfig eth0 hw ether 02:11:22:33:44:55ifconfig eth0 | head -4Output
$ ifconfig eth0 | head -4eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1400 inet 192.168.36.10 netmask 255.255.255.0 ether 02:11:22:33:44:55 txqueuelen 500- Remaining options are mostly for old hardware: radio hw addresses, irq/io_addr/mem_start for ISA cards, name to rename, media to pick the port type.
Output
hw ax25 N0CALL AX.25 hardware addrhw ARCnet 01 ARCnet hardware addrhw netrom N0CALL NET/ROM hardware addrname lan0 rename (down first)irq 11 interrupt lineio_addr 0x300 I/O start addressmem_start 0xd0000 shared memory startmedia 10baseT twisted pair, 10 Mbpsmedia 10base2 thin coax Ethernetmedia AUI external transceivermedia auto driver auto-sense16.7 macOS ifconfig
- Syntax from Apple's docs (no Mac in the lab).
- -l lists names only, -u/-d filter up/down, -m shows supported media; -f only changes display format (macOS shows the netmask in hex by default, inet:cidr gives /24).
- Addresses: alias / -alias (delete), lladdr changes the MAC; metric, tbr (egress limit), create/destroy for virtual interfaces.
- Offload options (rxcsum, txcsum, tso, lro) move checksum/segmentation to the NIC: if Wireshark shows 'checksum incorrect', check offload first.
- IPv6 ND options with inet6: ifdisabled turns IPv6 off, dad = duplicate address detection.
Output
ifconfig all (like -a)ifconfig en0 only en0ifconfig en0 inet6 one family only-a, -a -u, -a -d all, up, down-l, -l -u, -l -d names only-v en0 verbose status-m en0 capabilities + media-L en0 IPv6 lifetimes-r en0 route ref counts-C interface cloners-X '^en[0-9]' regex name match-b bond0 bond LACP state-f inet:cidr 192.168.1.10/24-f inet:hex 0xffffff00 (default)-f ether:dash 02-11-22-..-f addr:fqdn full DNS nameOutput
en0 inet 192.168.1.10 netmask 255.255.255.0en0 inet 192.168.1.10/24 CIDR formen0 inet 192.168.1.20 netmask 0xffffffff aliasen0 inet 192.168.1.45 -alias remove IPen0 inet6 2001:db8::10 prefixlen 64 aliasen0 inet6 2001:db8::10/64 deleteen0 lladdr 02:11:22:33:44:55 MAC seten0 up, en0 down on, offen0 mtu 1400 MTU seten0 metric 5 routing metricen0 tbr 50Mbps egress limitvlan0 create / destroy pseudo-deviceen1 media 100baseTX mediaopt full-duplexrxcsum, txcsum, tso, lro offload on/offen0 inet6 ifdisabled IPv6 offen0 inet6 dad, -dad duplicate detect- Virtual interfaces: VLAN (tag 10, parent en0), bond (LACP across two ports), gif IP tunnel, and bridge (software switch with addm, learned MACs, STP).
- Networking-stack test commands (linkcongested, disableinput, ...) are only for testing Apple's stack.
Output
# VLAN interfacesvlan0 createvlan0 vlan 10 vlandev en0 tag 10, parentvlan0 -vlandev parent detach# link aggregation (bond) interfacesbond0 createbond0 bonddev en1 member addbond0 bondmode lacp LACP (default)bond0 bondmode static LACP off# IP tunnel (gif) interfacesgif1 tunnel 198.51.100.1 203.0.113.5gif1 -tunnel, deletetunnel remove tunnel# bridgeaddm en1, deletem en1 member add, deladdr learned MACsstp en1, -stp en1 Spanning Treepriority 32768 bridge priority16.8 mii-tool: cable link, speed and duplex
- ifconfig = IP-layer status; mii-tool reads speed and duplex from the NIC's PHY chip.
- Healthy cable: link ok; cable pulled: no link.
- In a container eth0 is a virtual veth with no MII chip, so mii-tool says Not supported; modern Linux uses ethtool (10000Mb/s, Full, Link detected: yes).
- -w watches plug/unplug live, -r restarts autonegotiation, -F forces speed/duplex, -A advertises only chosen modes.
Terminal
mii-tool -Vmii-tool eth0mii-tool -v eth0ethtool eth0 | grep -E 'Speed|Duplex|Link'Output
$ mii-tool -Vnet-tools 2.10$ mii-tool eth0SIOCGMIIPHY on 'eth0' failed: Not supported$ mii-tool -v eth0SIOCGMIIPHY on 'eth0' failed: Not supported$ ethtool eth0 | grep -E 'Speed|Duplex|Link' Speed: 10000Mb/s Duplex: Full Link detected: yesOutput
-v, -vv, -vvv detail, raw registers-V version-R MII reset (default)-r autoneg restart-w link changes watch-w -l changes to syslog-F 100baseTx-FD 100 Mbps full force-F 10baseT-FD 10 Mbps full force-A 100baseTx-FD,100baseTx-HD advertise-p 1 PHY address override $ sudo mii-tool eth0 # docs example, real NICeth0: negotiated 100baseTx-FD flow-control, link ok16.9 Comparison: ifconfig vs ip vs mii-tool/ethtool
| Tool | Layer | Strength | Status |
|---|---|---|---|
| ifconfig | IP + interface | Quick view of IP, MAC, flags, counters | Deprecated on Linux, standard on macOS/BSD |
| ip (iproute2) | IP, routes, neighbours | Addresses, routes, namespaces, VLAN, tunnels | Modern Linux standard |
| mii-tool | Physical (PHY) | Cable link, speed, duplex on MII NICs | Old; fails on virtual NICs |
| ethtool | Physical + driver | Speed, duplex, link, offload | Modern replacement for mii-tool |
16.10 Common mistakes
- UP but not RUNNING: interface is on but the physical link is not ready; check cable/switch port, confirm with ethtool.
- Thinking ifconfig changes are permanent: write them in Netplan, NetworkManager or /etc/network/interfaces.
- Using mii-tool on a veth/virtual NIC and trusting 'Not supported' as a cable fault.
- Leaving promisc or -arp on after debugging.
16.11 Interview tips
- ifconfig = net-tools, deprecated on Linux; ip = iproute2, also manages routes, neighbours, namespaces.
- On macOS/BSD ifconfig is still the standard tool (it even builds VLANs, bonds and bridges).
- UP = administratively on, RUNNING = link ready; errors/dropped counters above 0 point to a link problem.
- Cable/duplex questions: mii-tool on old NICs, ethtool today.