Understanding Network Interface State Discrepancy: ifconfig Shows UP vs ip link Shows DOWN


2 views

In Linux network administration, we often encounter puzzling situations where different tools report conflicting information about the same network interface. A classic example is when ifconfig shows an interface as UP while ip link reports it as DOWN.

$ 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)

$ ip link show docker0
3: docker0:  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

The discrepancy stems from how these tools interpret and display interface states:

  • ifconfig: Shows the administrative state (whether the interface has been activated)
  • ip link: Shows both administrative and operational states (whether the interface is actually functioning)

In the ip link output, we see several important flags:


Here's what they mean:

  • UP: Administrative state is up (interface is enabled)
  • NO-CARRIER: No physical/link layer connection detected
  • BROADCAST: Supports broadcast
  • MULTICAST: Supports multicast

This situation commonly occurs with:

  • Docker bridge interfaces when no containers are running
  • Virtual interfaces without physical connections
  • Wireless interfaces not associated with any network

To get the most accurate picture of your interface state, consider using:

$ cat /sys/class/net/docker0/operstate
down
$ cat /sys/class/net/docker0/carrier
0

To properly bring up an interface that shows this behavior:

# First bring it down administratively
$ sudo ip link set docker0 down

# Then bring it back up
$ sudo ip link set docker0 up

# Check for carrier detection
$ sudo ethtool docker0

Remember that for bridge interfaces like docker0, the operational state depends on having active members in the bridge.

While ifconfig is still widely used, the ip command from iproute2 provides more detailed and accurate information. For scripting and automation, it's recommended to use:

$ ip -o link show docker0 | awk '{print $3,$9}'
 DOWN

When working with Linux network interfaces, you might encounter this puzzling scenario where ifconfig reports an interface as UP while ip link shows it as DOWN. Let's examine the docker0 interface from your example:

$ ifconfig docker0
docker0: flags=4163<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.255.0  broadcast 0.0.0.0
        ether 02:42:b9:25:be:2d  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        TX packets 0  bytes 0 (0.0 B)

$ ip -d 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 promiscuity 0 
    bridge forward_delay 1500 hello_time 200 max_age 2000 ageing_time 30000 stp_state 0 priority 32768

The discrepancy stems from what each command considers "UP":

  • ifconfig reports the administrative state (whether the interface has been activated)
  • ip link shows the operational state (whether the interface has an active physical/link layer connection)

Network interfaces in Linux have two fundamental states:

1. Administrative State (controlled by ifconfig/ip link set):
   - UP: Interface is enabled
   - DOWN: Interface is disabled

2. Operational State (shown by ip link):
   - UNKNOWN: Initial state
   - DOWN: No physical layer connection
   - NO-CARRIER: No carrier detected (like disconnected cable)
   - UP: Fully operational

This is particularly common with virtual interfaces (bridge, docker, etc.) where:

# You can manually set these states:
sudo ip link set docker0 up  # Administrative UP
sudo ip link set docker0 down # Administrative DOWN

# Check detailed state information:
ip -d link show docker0
ethtool docker0

Consider these troubleshooting scenarios:

  1. A bridge interface shows UP in ifconfig but DOWN in ip link - it might need physical interfaces added
  2. A VPN tunnel interface appears UP but has no carrier - check underlying network connectivity

For completeness, here's how to check all interface states consistently:

# Modern alternative combining both views
ip -br -c link show
ip -br -c addr show

# Legacy format showing both states
ifconfig -a

The Linux networking stack maintains these separate states because:

  • Administrative UP means "ready to process packets"
  • Operational UP means "actually able to transmit/receive"
  • This separation allows for proper interface management during:
    • Hot-plug events
    • Driver initialization
    • Interface configuration