IP-ADDRESS(8)
โจ NAME โจ
Heyy bestie, this is the ip-address manual page (section 8, Linux) and it is literally about managing protocol addresses ๐ ๐ธ
ip-address is all about protocol address management. Basically, it's how you add, change, remove and look at the addresses on your network devices ๐ฆ
โจ SYNOPSIS โจ
Okay so here's the whole family of commands. Don't panic, they look scarier than they are ๐ซถ
ip [ OPTIONS ] address { COMMAND | help }
ip address { add | change | replace } IFADDR dev IFNAME [ LIFETIME ] [ CONFFLAG-LIST ]
ip address delete IFADDR dev IFNAME [ mngtmpaddr ]
ip address { save | flush } [ dev IFNAME ] [ scope SCOPE-ID ] [ metric METRIC ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [ { up | down } ]
ip address [ show [ dev IFNAME ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [ master DEVICE ] [ type TYPE ] [ vrf NAME ] [ { up | down } ] [ nomaster ] proto ADDRPROTO ] ]
ip address { showdump | restore }
๐ง The Little Definitions ๐ง
Now the building blocks. These are the pieces you slot into the commands above, so keep them handy ๐
IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ]
[ label LABEL ] [ scope SCOPE-ID ] [ proto ADDRPROTO ]
SCOPE-ID := [ host | link | global | NUMBER ]
ADDRPROTO := [ NAME | NUMBER ]
FLAG-LIST := [ FLAG-LIST ] FLAG
FLAG := [ [-]permanent | [-]dynamic | [-]secondary | [-]primary |
[-]tentative | [-]deprecated | [-]dadfailed | [-]temporary |
CONFFLAG-LIST ]
CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG
CONFFLAG := [ home | mngtmpaddr | nodad | optimistic | noprefixroute |
autojoin ]
LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]
LFT := [ forever | SECONDS ]
TYPE := [ bridge | bridge_slave | bond | bond_slave | can | dummy | hsr
| ifb | ipoib | macvlan | macvtap | vcan | veth | vlan | vxlan |
ip6tnl | ipip | sit | gre | gretap | erspan | ip6gre | ip6gretap
| ip6erspan | vti | vrf | nlmon | ipvlan | lowpan | geneve |
macsec | netkit ]
โจ DESCRIPTION โจ
okay so an address is a protocol address (IPv4 or IPv6) that gets attached to a network device ๐ธ every device needs at least one address before it can use that protocol. and a device can hold several addresses at once ๐ these addresses aren't ranked against each other, so calling them "aliases" isn't really accurate, which is why this page doesn't use that word ๐
The ip address command is your all-in-one spot to show addresses and their properties, add new ones, and delete old ones ๐
๐ ip address add - add new protocol address.
dev IFNAMEโ the name of the device you want to add the address to ๐ฆlocal ADDRESS(default) โ the address of the interface ๐ the format depends on the protocol: a dotted quad for IP, or a bunch of hexadecimal halfwords separated by colons for IPv6. theADDRESScan be followed by a slash and a decimal number, which is the network prefix length โจpeer ADDRESSโ the address of the remote endpoint on pointopoint interfaces ๐ซถ theADDRESScan also get a slash and a decimal prefix length. if you give a peer address, the local address cannot have a prefix length, because the network prefix belongs to the peer, not the local address ๐broadcast ADDRESSโ the broadcast address on the interface ๐ก
you can also use the special symbols + and - instead of a broadcast address. when you do, the broadcast address gets worked out by setting or resetting the host bits of the interface prefix ๐ง
label LABELโ each address can be tagged with a label string ๐ท๏ธ the maximum total length of a label is 15 characters, so keep it short bestie ๐scope SCOPE_VALUEโ the scope of the area where this address is valid ๐ the available scopes are listed in/usr/share/iproute2/rt_scopesor/etc/iproute2/rt_scopes, and the/etcone wins if it exists. the predefined scope values are:globalโ the address is globally valid ๐siteโ (IPv6 only, deprecated) the address is site local, meaning it's valid inside this site ๐linkโ the address is link local, meaning it's only valid on this device ๐hostโ the address is only valid inside this host ๐ป
metric NUMBERโ the priority of the prefix route associated with the address โญvalid_lft LFTโ the valid lifetime of this address, see section 5.5.4 of RFC 4862 โณ once it expires, the kernel removes the address. defaults toforever๐preferred_lft LFTโ the preferred lifetime of this address, see section 5.5.4 of RFC 4862 โ once it expires, the address stops being used for new outgoing connections. defaults toforever๐ซhomeโ (IPv6 only) marks this address as the "home address" from RFC 6275 ๐กmngtmpaddrโ (IPv6 only) tells the kernel to manage temporary addresses made from this one as a template, on behalf of Privacy Extensions (RFC3041) ๐ต๏ธโโ๏ธ for this to kick in, theuse_tempaddrsysctl setting has to be greater than zero, and the address needs a prefix length of64. it lets you use privacy extensions on a manually configured network, just like stateless auto-configuration would ๐nodadโ (IPv6 only) skips Duplicate Address Detection (RFC 4862) when adding this address ๐ โโ๏ธoptimisticโ (IPv6 only) when doing Duplicate Address Detection, uses the RFC 4429 optimistic variant ๐ค๏ธnoprefixrouteโ does not automatically create a route for the network prefix of the added address, and doesn't go looking for one to delete when removing the address ๐ฃ๏ธ changing an address to add this flag removes the automatically added prefix route, and changing it to remove this flag creates the prefix route automatically again ๐autojoinโ okay this one's a whole storyline ๐ฌ joining multicast groups at the Ethernet level withip maddrdoesn't work if you're plugged into an Ethernet switch doing IGMP snooping, because the switch won't copy multicast packets to ports that never sent IGMP reports for those multicast addresses ๐ญ
Linux VXLAN interfaces made with ip link add vxlan have the group option, which lets them do the required join โจ
using the autojoin flag when adding a multicast address gives similar help to Openvswitch VXLAN interfaces, and to other tunneling mechanisms that need to receive multicast traffic ๐ง
proto ADDRPROTOโ the protocol identifier of this route ๐ชADDRPROTOcan be a number, or a string from/usr/share/iproute2/rt_addrprotosor/etc/iproute2/rt_addrprotos(the/etcone wins if it exists). a directory namedrt_addrprotos.dalso gets scanned in either location ๐ if you don't give a protocol ID,ipassumes protocol0๐คทโโ๏ธ a few protocol values have fixed meanings:kernel_loโ the::1address that the kernel installs on a loopback netdevice has this protocol value ๐kernel_raโ IPv6 addresses installed in response to router advertisement messages ๐ปkernel_llโ link-local addresses have this protocol value ๐
everything else is unreserved, so the admin is free to assign protocol tags (or not) ๐จ
๐ ip address delete - delete protocol address
Arguments: coincide with the arguments of ip address add. the same stuff you'd type to add it, you type to delete it ๐ซถ
the device name is a required argument, so don't forget it ๐
๐ ip address show - look at protocol addresses
dev IFNAME(default) โ name of the device ๐scope SCOPE_VALโ only lists addresses with this scope ๐to PREFIXโ only lists addresses matching this prefix ๐ฏlabel PATTERNโ only lists addresses whose labels match thePATTERN. thePATTERNis a usual shell style pattern ๐master DEVICEโ only lists interfaces enslaved to this master device ๐vrf NAMEโ only lists interfaces enslaved to this vrf ๐๏ธtype TYPEโ only lists interfaces of the given type ๐งฉ
heads up, the type name isn't checked against the list of supported types. it's just sent as-is to the kernel, then used to filter the returned interface list by comparing it with the relevant attribute, in case the kernel didn't filter already ๐ so any string is accepted, but you might get empty output ๐ซ
upโ only lists running interfaces ๐ขdownโ only lists not running interfaces ๐ดnomasterโ only lists interfaces with no master ๐ซงdynamic and permanentโ (IPv6 only) only lists addresses installed through stateless address configuration, or only lists permanent (not dynamic) addresses ๐ these two flags are inverses of each other, so-dynamicis equal topermanent, and-permanentis equal todynamic๐tentativeโ (IPv6 only) only lists addresses that haven't yet passed duplicate address detection ๐ฅ-tentativeโ (IPv6 only) only lists addresses that aren't currently in the middle of duplicate address detection ๐ฃdeprecatedโ (IPv6 only) only lists deprecated addresses ๐ชฆ-deprecatedโ (IPv6 only) only lists addresses that aren't deprecated ๐dadfailedโ (IPv6 only) only lists addresses that failed duplicate address detection ๐ฅ-dadfailedโ (IPv6 only) only lists addresses that didn't fail duplicate address detection ๐temporary or secondaryโ lists temporary IPv6 or secondary IPv4 addresses only ๐ the Linux kernel shares a single bit for those, so they're actually aliases of each other, even though the meaning changes depending on the address family ๐คฏ-temporary or -secondaryโ these flags are aliases forprimary๐primaryโ lists only primary addresses, and for IPv6 it leaves out temporary ones ๐ this flag is the inverse oftemporaryandsecondary๐-primaryโ this is an alias fortemporary or secondary๐proto ADDRPROTOโ only shows addresses with a given protocol, or addresses where the kernel response didn't include a protocol ๐งพ check theproto ADDRPROTOentry underip address addfor the details on address protocols ๐
๐งน ip address flush - flush protocol addresses
This command flushes the protocol addresses picked out by some criteria ๐ฟ
This command takes the same arguments as show, except the type and master selectors aren't supported ๐
โโ๏ธ another difference is that it doesn't run when you give it no arguments ๐
Warning: this command and the other flush commands are unforgiving. they will cruelly purge all the addresses. ๐ please don't flush blindly bestie ๐ญ
With the -statistics option, the command gets verbose ๐ข it prints out the number of deleted addresses and the number of rounds it took to flush the address list. if you give this option twice, ip address flush also dumps all the deleted addresses, in the format described in the previous subsection ๐งพ
๐ธ EXAMPLES ๐ธ
Here's the fun stuff, let's go ๐
ip address show
Shows IPv4 and IPv6 addresses assigned to all network interfaces. the show subcommand can be left out ๐ซถ
ip address show up
Same as above, except only addresses on active network interfaces get shown ๐ข
ip address show dev eth0
Shows IPv4 and IPv6 addresses assigned to the network interface eth0 ๐
ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
Adds an IPv6 address to the network interface eth1 โจ
ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
Deletes the IPv6 address we added above ๐
ip address flush dev eth4 scope global
Removes all global IPv4 and IPv6 addresses from the device eth4 ๐งน without scope global, it would remove all addresses, including the IPv6 link-local ones ๐ฑ
๐ฆ SEE ALSO ๐ฆ
ip(8) ๐
๐ AUTHOR ๐
Original Manpage by Michail Litvak <mci@owl.openwall.com> ๐ซถ
Thanks for sticking with me through this one bestie ๐ this was the iproute2 manual page, and the date and page name are sitting right at the bottom if you want them ๐ slay and happy addressing โจ๐
๐ฆ where this page comes from
- alpine 3.22: iproute2-doc 6.15.0-r0 ยท GPL-2.0-or-later
- alpine 3.23: iproute2-doc 6.17.0-r0 ยท GPL-2.0-or-later
- alpine 3.24: iproute2-doc 7.0.0-r0 ยท GPL-2.0-or-later
- arch rolling: iproute2 7.2.0-1
- arch rolling: iproute2 7.3.0-1 ยท GPL-2.0-or-later
- centos-stream 10: iproute 7.0.0-2.el10 ยท GPL-2.0-or-later AND NIST-PD
- centos-stream 9: iproute 6.17.0-3.el9 ยท GPL-2.0-or-later AND NIST-PD
- debian trixie: iproute2 6.15.0-1 ยท GPL-2.0-only
- fedora 43: iproute 6.14.0-2.fc43 ยท GPL-2.0-or-later AND NIST-PD
- fedora 44: iproute 6.17.0-2.fc44 ยท GPL-2.0-or-later AND NIST-PD
- ubuntu questing: iproute2 6.16.0-1ubuntu2
- ubuntu questing: iproute2 6.16.0-1ubuntu2.1 ยท GPL-2.0-only
- ubuntu questing: iproute2 6.16.0-1ubuntu2.2
- ubuntu resolute: iproute2 6.19.0-1ubuntu1 ยท GPL-2.0-only
- ubuntu resolute: iproute2 6.19.0-1ubuntu1.1 ยท GPL-2.0-only
- ubuntu stonking: iproute2 7.2.0-1ubuntu1 ยท GPL-2.0-only
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms