Skip to content
Latchkey

ip addr: Usage, Options & Common CI Errors

ip addr lists the IP addresses bound to each network interface.

ip addr is the iproute2 replacement for ifconfig. In containers it is how you discover the pod/container IP and confirm an interface came up before a service binds to it.

What it does

ip addr (ip address) displays and manages the addresses assigned to network interfaces. ip addr show lists them; ip addr add/del attach or remove an address. It is the canonical way to read a container's own IP.

Common usage

Terminal
ip addr show                   # all interfaces and addresses
ip addr show eth0              # one interface
ip -4 addr show eth0           # IPv4 only
ip -o -4 addr show eth0 | awk '{print $4}'   # parse the CIDR
ip addr add 10.0.0.5/24 dev eth0

Options

Subcommand / flagWhat it does
show [dev]List addresses (all or one interface)
add <cidr> dev <if>Assign an address to an interface
del <cidr> dev <if>Remove an address
-4 / -6Restrict to IPv4 / IPv6
-oOne line per record (script-friendly)
-brBrief, columnar output

Common errors in CI

"Cannot find device "eth0"": the interface name differs (containers often use eth0, but some use ens5 or a veth name) - list with ip addr show first, do not hard-code the name. "RTNETLINK answers: Operation not permitted" on add/del means the step lacks NET_ADMIN (add --cap-add=NET_ADMIN or run privileged). "ip: command not found" - install iproute2. In host-network mode a container sees the host's addresses, which surprises scripts expecting an isolated IP.

Related guides

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