Walk me through the output of ip addr show. What do UP, LOWER_UP and state mean?
Show the answer
Say this first
The flags in angle brackets are what the interface is configured and able to do: UP means
administratively up, LOWER_UP means the driver sees carrier (layer 1 is up). state is the operational
state the kernel computed: UP, DOWN, or UNKNOWN for things like loopback that do not report carrier.
Then come the MTU, the queueing discipline, the MAC, and each address with its prefix, scope and lifetime.
Go deeper
A real example
$ ip addr show dev ens192
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:a1:2b:3c brd ff:ff:ff:ff:ff:ff
inet 10.0.10.21/24 brd 10.0.10.255 scope global dynamic ens192
valid_lft 85912sec preferred_lft 85912sec
inet6 fe80::250:56ff:fea1:2b3c/64 scope link
valid_lft forever preferred_lft forever2:is the interface index. Other commands refer to it (for exampleveth0@if7).UPadmin up,LOWER_UPcarrier present. A cable pull showsNO-CARRIERandstate DOWNwhileUPstays, because the admin state did not change.mtu 1500,qdisc mq(multiqueue NIC),qlen 1000is the transmit queue length.inet 10.0.10.21/24 brd 10.0.10.255 scope global dynamic: address with prefix, broadcast, scopeglobal(routable), anddynamicmeans it came from DHCP;valid_lftcounts down the lease.inet6 fe80::.../64 scope linkis the IPv6 link-local address, built here from the MAC with EUI-64.
Scopes
global is usable anywhere, link only on this link (fe80::, 169.254/16), host only inside this
machine (127.0.0.1 on lo).
The short form
$ ip -br addr
lo UNKNOWN 127.0.0.1/8 ::1/128
ens192 UP 10.0.10.21/24 fe80::250:56ff:fea1:2b3c/64They will ask next
The interface shows UP in the flags but state DOWN. What is wrong?
It is admin up but has no carrier. Check the cable, the switch port (shut, err-disabled, wrong speed), the SFP, or the VM's virtual NIC connection.
ethtool ens192showsLink detected: no.Why does lo show state UNKNOWN?
Loopback has no carrier concept, so the kernel cannot compute an operational state and reports UNKNOWN. That is normal, as it is for some tun and dummy devices.
How do you add a second address, and how does it show up?
ip addr add 10.0.10.22/24 dev ens192. Because it is in the same subnet as the first one, it is listed withscope global secondary. If the primary is deleted, secondaries in that subnet are deleted too unlessnet.ipv4.conf.all.promote_secondaries=1is set.
Traps
- Reading LOWER_UP as "the interface is enabled". It only means carrier is present.
- Ignoring
dynamicandvalid_lft. A DHCP address with a short lifetime left can explain intermittent loss.