Linux

ip link 和 ip addr 輸出含義

  • January 14, 2020

我正在尋找解釋命令的輸出ip linkip addr在 linux 機器上的含義。

# ip link
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:a1:ba:51:4c:11 brd ff:ff:ff:ff:ff:ff
4: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether 00:a1:ba:51:4c:12 brd ff:ff:ff:ff:ff:ff

LOWER_UPNO-CARRIER其他標誌到底是什麼?我在http://download.vikis.lt/doc/iproute-doc-2.6.32/ip-cref.ps找到了參考,但它不包含完整的資訊,並且手冊頁不夠詳細。

這些是介面的標誌。它們記錄在netdevice(7)手冊頁中。以下是相關部分(按字母順序重新排序):

IFF_ALLMULTI      Receive all multicast packets.
IFF_AUTOMEDIA     Auto media selection active.
IFF_BROADCAST     Valid broadcast address set.
IFF_DEBUG         Internal debugging flag.
IFF_DORMANT       Driver signals dormant (since Linux 2.6.17)
IFF_DYNAMIC       The addresses are lost when the interface goes down.
IFF_ECHO          Echo sent packets (since Linux 2.6.25)
IFF_LOOPBACK      Interface is a loopback interface.
IFF_LOWER_UP      Driver signals L1 up (since Linux 2.6.17)
IFF_MASTER        Master of a load balancing bundle.
IFF_MULTICAST     Supports multicast
IFF_NOARP         No arp protocol, L2 destination address not set.
IFF_NOTRAILERS    Avoid use of trailers.
IFF_POINTOPOINT   Interface is a point-to-point link.
IFF_PORTSEL       Is able to select media type via ifmap.
IFF_PROMISC       Interface is in promiscuous mode. 
IFF_RUNNING       Resources allocated.
IFF_SLAVE         Slave of a load balancing bundle.
IFF_UP            Interface is running.

因此,LOWER_UP意味著在物理級別存在信號(即,網路介面中插入了一些活動的東西)。NO-CARRIER, 正好相反:在物理層面沒有檢測到信號。

引用自:https://unix.stackexchange.com/questions/335077