ip a命令显示的UP与LOWER_UP的区别

Posted 王万林 Ben

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ip a命令显示的UP与LOWER_UP的区别相关的知识,希望对你有一定的参考价值。

ip a命令显示的UP与LOWER_UP

$ ip a
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 52:54:00:b3:94:c4 brd ff:ff:ff:ff:ff:ff
    altname enp0s5
    altname ens5
    inet 10.0.20.5/22 metric 100 brd 10.0.23.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feb3:94c4/64 scope link 
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:ab:e7:a1:bd brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

从netdevice手册查看UP与LOWER_UP的区别:

$ man 7 netdevice
       SIOCGIFFLAGS, SIOCSIFFLAGS
              Get or set the active flag word of the device.   ifr_flags  contains  a  bit
              mask of the following values:

                                      Device flags
              IFF_UP            Interface is running.
              IFF_BROADCAST     Valid broadcast address set.
              IFF_DEBUG         Internal debugging flag.
              IFF_LOOPBACK      Interface is a loopback interface.
              IFF_POINTOPOINT   Interface is a point-to-point link.
              IFF_RUNNING       Resources allocated.

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

UP表示接口在running状态,LOWER_UP表示驱动显示L1是up状态。

那这两个跟我们有什么关系?

笔者在机房调试服务器时,遇到网卡配置了IP,启动了网络服务(network或NetworkManager)都无法无网关通信。

使用ethtool查看网卡信息,提示Link detected: no; 使用ip a显示网卡只是UP状态,没有LOWER_UP状态。找现场网络同事,反馈是直接接上就能使用。后来找交换机负责同事定位后是上联网口未开通,开通后,网卡有了LOWER_UP状态。

结论:ip link 显示UP表示接口是running状态,但没有LOWER_UP,意思是物理线缆没有正确插好吧。

以上是关于ip a命令显示的UP与LOWER_UP的区别的主要内容,如果未能解决你的问题,请参考以下文章

Linux命令—ip

Linux云主机获取本机公网IP地址

Traffic Ccontrol(流量控制)

centos 查看IP

linux ip命令 ip a(ip命令与ifconfig命令区别)

linux ip命令 ip a(ip命令与ifconfig命令区别)