Skip to content
Latchkey

ifconfig: Usage, Options & Common CI Errors

ifconfig displays and configures network interfaces (the legacy tool).

ifconfig is the historic interface tool, replaced by ip addr / ip link. It is missing from most modern images, so scripts that read a container IP via ifconfig break - knowing the ip equivalent is essential.

What it does

ifconfig displays the configuration of network interfaces (addresses, MAC, MTU, flags) and can bring them up or down or assign addresses. It belongs to the deprecated net-tools package; iproute2's ip addr and ip link are the modern replacements.

Common usage

Terminal
ifconfig                       # all active interfaces
ifconfig eth0                  # one interface
ifconfig -a                    # include down interfaces
ifconfig eth0 up               # bring an interface up
# Modern equivalent:
ip addr show eth0

Options

UsageWhat it does
(none)Show active interfaces
-aShow all interfaces including down
<if> up|downBring an interface up or down
<if> <addr>Assign an address
<if> mtu <N>Set the MTU

Common errors in CI

"ifconfig: command not found" - net-tools is not installed on Alpine/distroless/most slim images; use ip addr show (read) and ip link set (config) instead. Parsing ifconfig output for an IP is fragile across versions; prefer ip -o -4 addr show <if> | awk '{print $4}'. Config changes need NET_ADMIN. ifconfig also truncates or omits secondary addresses that ip addr shows in full, so a container with multiple IPs can look single-homed under ifconfig - another reason to standardize on ip.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →