LinuxCommandLibrary

ip-address

Show or manipulate network interfaces and addresses

TLDR

List network interfaces and their associated IP addresses

$ ip [[a|address]]
copy

Filter to show only active network interfaces
$ ip [[a|address]] [[s|show]] up
copy

Display information about a specific network interface
$ ip [[a|address]] [[s|show]] [ethX]
copy

Add an IP address to a network interface
$ sudo ip [[a|address]] [[a|add]] [ip_address] dev [ethX]
copy

Remove an IP address from a network interface
$ sudo ip [[a|address]] [[d|delete]] [ip_address] dev [ethX]
copy

Delete all IP addresses in a given scope from a network interface
$ sudo ip [[a|address]] [[f|flush]] [ethX] scope [global|host|link]
copy

SYNOPSIS

ip [GLOBAL-OPTIONS] address|addr { add | change | replace | delete|del | show|list|flush | save } [OPTIONS]

PARAMETERS

add
    Add new protocol address

change
    Change protocol address

replace
    Replace protocol address (add or update)

delete|del
    Delete protocol address

show|list|lst
    Show protocol addresses

flush
    Flush protocol addresses

save
    Save addresses to file (RT format)

dev NAME
    Interface name

label NAME
    Label for interface alias

scope SCOPE
    Address scope (global|site|link|host)

to PREFIX
    Address prefix

metric NUMBER
    Routing metric

mtu NUMBER
    Interface MTU

broadcast ADDR
    Broadcast address

type TYPE
    Address type (local|broadcast|anycast|unicast|peer|proxy)

valid_lft LIFETIME
    Valid lifetime (forever|seconds)

preferred_lft LIFETIME
    Preferred lifetime

DESCRIPTION

ip address (or ip addr), part of the iproute2 suite, displays and manipulates protocol addresses (IPv4/IPv6) on Linux network interfaces. It replaces the legacy ifconfig from net-tools, offering richer features like detailed stats, multiple address support per interface, and scripting-friendly output. Use show or list to view addresses, including flags (UP, LOWER_UP), MTU, MAC, RX/TX stats, and inet6 entries. Subcommands enable adding addresses with prefixes, scopes, labels for persistence, metrics for routing, and temporary flags. Common tasks: assign static IPs, manage VLANs/bridges, troubleshoot connectivity. Supports selectors like dev for specific interfaces, type for address types (local, broadcast), and JSON output (-J) in recent versions. Essential for sysadmins, with granular control over peer addresses, proxies, and anycast.

CAVEATS

Requires root for add/del/change. Deprecated peer option in some versions; use type peer. Output parsing brittle without -J. Not for wireless config (use wpa_supplicant).

EXAMPLES

ip addr show or ip a
List all addresses.
ip addr add 192.168.1.10/24 dev eth0 label eth0:home
Add IPv4 address.
ip addr del 192.168.1.10/24 dev eth0
Delete address.
ip -6 addr show dev eth0
Show IPv6 only.

OUTPUT FIELDS

Key fields: inet (v4), inet6 (v6), brd (broadcast), scope (link/global), valid_lft/preferred_lft (timers), metric.

HISTORY

Developed by Alexey Kuznetsov in late 1990s as part of iproute2 for Linux 2.2+ advanced routing. Replaced net-tools in major distros (RHEL 5+, Ubuntu 8+). Maintained by NetworkManager team; JSON support added ~2015.

SEE ALSO

ip(8), ifconfig(8), ss(8), ip-link(8), ip-route(8)

Copied to clipboard