$linuxjunkies
>

ip-addr(8)

Show and manipulate IP addresses on network interfaces.

UbuntuDebianFedoraArch

Synopsis

ip addr [ add | del | flush | replace | show ] ADDRESS dev IFNAME

Description

The ip addr command is part of the iproute2 suite and manages IPv4 and IPv6 addresses on network interfaces. It displays current address configuration and allows adding, removing, or modifying addresses without restarting networking services.

Address changes made with ip addr are temporary and will be lost on reboot unless made permanent through network configuration files (e.g., /etc/network/interfaces or NetworkManager).

Common options

FlagWhat it does
addAdd a new address to an interface
delRemove an address from an interface
showDisplay all addresses (default action if no command given)
flushRemove all addresses from an interface or matching criteria
-4Show only IPv4 addresses
-6Show only IPv6 addresses
dev IFNAMESpecify network interface to operate on
broadcastSet broadcast address when adding an address
label LABELSet interface alias when adding an address
scopeSet scope (global, link, host) for the address

Examples

Display all IP addresses on all interfaces with detailed information

ip addr show

Show only addresses configured on the eth0 interface

ip addr show dev eth0

Add the IP address 192.168.1.100 with netmask /24 to eth0

ip addr add 192.168.1.100/24 dev eth0

Add a secondary address to eth0 with interface alias eth0:1

ip addr add 192.168.1.101/24 dev eth0 label eth0:1

Remove the IP address 192.168.1.100 from eth0

ip addr del 192.168.1.100/24 dev eth0

Display only IPv4 addresses across all interfaces

ip -4 addr show

Remove all addresses from the eth0 interface

ip addr flush dev eth0

Show only globally-scoped addresses on all interfaces

ip addr show scope global

Related commands