Output Format
ip address
outputs addresses associated with each network interface. For each interface, ip address
shows the interface’s link-layer information, which can also be obtained through ip link
, followed by the associated IP addresses. For ease of reference, I’m going to name each part like so:
$ ip addr
NUM: IF-NAME: <FLAGS,...> IF-CONFIG...
PROTOCOL ADDRESS [brd BRD_ADDR] OPTIONS...
...
...
Here is a sample output of ip address
on WSL:
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:6a:8c:f0 brd ff:ff:ff:ff:ff:ff
inet 172.29.177.182/20 brd 172.29.191.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe6a:8cf0/64 scope link
valid_lft forever preferred_lft forever
NUM
NUM is a numeric index of the interface. Not sure if this is actually used elsewhere.
IF-NAME
IF-NAME is the name of the interface. There are conventions for how interfaces are named, e.g., lo
for loopback, ethX
for the X-th ethernet connection, wlanX
for the X-th WiFi connection, tunX
for the X-th tunnel interface, etc. There may be other conventions such as enpXsY
and wlpXsY
(see here), but that’s not what I’m interested in.
FLAGS
FLAGS are the flags on this device/interface. You can find a list of them at netdevice(7). Here is the list for your convenience:
IF-CONFIG
IF-CONFIG holds any options & state of the interface.
mtu MTU
: This specifies the MTU of the interface. Usually it’s set to 1500, except for the loopback interface (which uses 65536).qdisc QDISC
: This is the qdisc (queue discipline) configured for this interface. Some examples include:noqueue
: no queueing discipline (try to send packet immediately, or drop if fails)fq_codel
: a classless qdisc that stands for Fair Queueing Controlled Delay; it is the default qdisc (which I think replacespfifo_fast
)mq
: a classful multiqueue (the default qdisc for NICs with multiple hardware queues)
state [ UP | DOWN | RUNNING | UNKNOWN ]
: The current state of the interfacegroup default
: The group value label of the interface. The default group value is 0, which corresponds to the labeldefault
(see here). You can add more group value labels here/etc/iproute2/group
.qlen QLEN
: How large the packet queue is. If there are too many packets being added to the queue (causing the queue to have a size greater thanQLEN
), these overflowing packets will be dropped.
Interface Addresses
- Each interface can have a list of addresses (
ADDRESS
) associated with it. - Each address works under a specific network/link layer protocol (
PROTOCOL
, e.g.,inet
for IPv4,inet6
for IPv6,link/ether
for Ethernet). - Some protocols like
inet
andlink/ether
supports broadcasting, and there may be a broadcasting address specified throughbrd BRD_ADDR
.
I might look into the other options when I have time.