LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ip-address

manages IP addresses on network interfaces

TLDR

List all addresses
$ ip address show
copy
Show only active interfaces
$ ip address show up
copy
Show addresses for a specific interface
$ ip address show dev [eth0]
copy
Show only IPv4 addresses
$ ip -4 address show
copy
Add an IP address to an interface
$ sudo ip address add [192.168.1.100/24] dev [eth0]
copy
Delete an IP address from an interface
$ sudo ip address delete [192.168.1.100/24] dev [eth0]
copy
Flush all addresses on an interface
$ sudo ip address flush dev [eth0]
copy

SYNOPSIS

ip [OPTIONS] address {command|help}

DESCRIPTION

ip address manages IP addresses on network interfaces. It can display, add, delete, and flush addresses for both IPv4 and IPv6 protocols.

PARAMETERS

show [dev device]

Display IP addresses (default action).
add address/prefix dev device
Add an IP address to an interface.
change address/prefix dev device
Change properties of an existing address.
replace address/prefix dev device
Add or update an address on an interface.
delete address/prefix dev device
Remove an IP address from an interface.
flush [dev device]
Remove all addresses matching criteria.
save
Save address configuration to stdout.
restore
Restore address configuration from stdin.
dev device
Interface name to operate on.
scope global|link|host
Filter or set address scope.
label label
Set address label (must start with device name).
broadcast address
Set broadcast address.
metric number
Set priority of the prefix route for the address.
valid_lft lft
Valid lifetime of the address (default: forever).
preferred_lft lft
Preferred lifetime of the address (default: forever).
up
Filter to show only active (UP) interfaces.
permanent
Filter to show only permanent (static) addresses.
dynamic
Filter to show only dynamically assigned addresses.
to prefix
Filter addresses matching a prefix.

CAVEATS

Addresses added are not persistent across reboots. Use network configuration files or NetworkManager for persistence. An interface can have multiple IP addresses.

HISTORY

ip address is part of iproute2, replacing the deprecated ifconfig command.

SEE ALSO

ip(8), ip-link(8), ip-route(8), ip-neighbour(8)

Copied to clipboard
Kai