大网数据广告活动
服务器运维问答

ifconfig shows UP while ip link shows DOWN

· 52CE 我爱测

I am looking at the state of an interface on a Linux system. When I use the ifconfig command it shows that the link is UP. master $ ifconfig docker0 docker0 Link encap:Ethernet HWaddr 02:42:b9:25:be:2d inet addr:172.18.0.1 Bcast:…

问题原文

原帖链接 · automationcoach · CC BY-SA 4.0

I am looking at the state of an interface on a Linux system. When I use the ifconfig command it shows that the link is UP.

master $ ifconfig docker0
docker0   Link encap:Ethernet  HWaddr 02:42:b9:25:be:2d
          inet addr:172.18.0.1  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

However, when I run the ip link command , it is down.

master $ ip link show docker0
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
    link/ether 02:42:b9:25:be:2d brd ff:ff:ff:ff:ff:ff

Can someone please explain?

社区高分解答

原帖链接 · Anton Danilov · CC BY-SA 4.0

In the ifconfig UP flag means the administrative status, not link status. If you have 'link up', then RUNNING flag is present in the ifconfig output. Anyway, ifconfig is deprecated, use the ip tool.

In the ip tool link status is shown by flags LOWER_UP and NO-CARRIER.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-05-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。