Ethernet – How does Ethernet driver know if the cable is plugged in

10gbaseethernetlinux

How does the /sys/class/net/ethx/carrier field get set?

I am trying to understand this field as it determines if a network cable is plugged in, but I am curious how it knows. This is specifically in regards to 10Gbase-KR and 1Gbase-KX.

I have a little knowledge in regards to CMSA/CD, but that is only for half duplex and NPL – pulses are for auto negotiation.

Is something going across the medium when no traffic is being sent?

I believe it may have to do with IDLE symbols, but I do not fully understand them.

Best Answer

Link detection is specific to the physical layer.

  • The original coax Ethernet did not really have link state detection (some PHYs had a mechanism for detecting termination during transmission but it only worked when the device was actually trying to transmit something)
  • 10BASE-T uses "link state pulses" which are sent when the line is idle to monitor link status.
  • Twisted pair auto-negotiation uses "Fast link pulse bursts" to both determine the state of the link and to exchange auto-negotiation information. Once a link type has been negotiated link type specific mechanisms are used to monitor link status.
  • Faster Ethernet standards generally transmit idle codes continuously.

If you want the full details of what a particular physical layer sends best to check the actual 802.3 standard.