2

I’m curious to know how a PC knows a device was connected to its Ethernet port.

When I plug my router or any other device to my Ethernet port, Wireshark shows traffic on that interface. My assumption is that the PC, when the Ethernet cable is unplugged, is either sending some type of requests such as DHCP request all the time until something is connected. Or does it somehow detect the connection and starts using it then?

Any insights much appreciated.

5
  • 1
    The network port will continuously send out a hello packet, so the moment you plug in a cable on both ends, both ends will send a hello packet and later receive one. Then both ports know there is a connection. Then they start to properly communicate and establish the connection and then the connection is ready for anything else. (that is the simplified version.) Here's the complicated one: ibm.com/support/pages/…
    – LPChip
    Commented Nov 1, 2022 at 17:58
  • 1
    Detection of port "live" state or activity happens well below any protocols that run on the Ethernet interface. At the Ethernet physical layer an electrical device can detect whether a connection is made long before any data packets are sent. It can then notify the OS of cable connection and the OS can then start sending packets. It doesn't need to be constantly polling the interface with packets to check if something is connected.
    – Mokubai
    Commented Nov 1, 2022 at 18:49
  • Thanks LPChip and Mokubai. Just to be clear Mokubai, what you said is that there's no "continuous probing with hello packets" like LPChip said, but the connection is detected by something else (a change in impedance or some other electric change I can imagine). Please confirm. Commented Nov 1, 2022 at 19:13
  • 2
    Your question is unclear. For the PC to know something is plugges in on the other end - its a physical process with voltage on some pins and a negotiation process. This happens even if there is no IP protocol traffic and has nothing to do with DHCP.
    – davidgo
    Commented Nov 1, 2022 at 19:14
  • 1
    The change in state is due to voltage being applied on one pin. As davidgo indicated, you can have the NIC connected with no IP information configured and wireshark will still show incoming traffic on the card. No outbound traffic will be generated. The hello packets @LPChip discussed are not from the PC but are used by routers to find other routers.
    – doneal24
    Commented Nov 1, 2022 at 19:42

1 Answer 1

4

Detection of port "live" state or activity happens well below any protocols that run on the Ethernet interface. At the Ethernet physical layer an electrical device can detect whether a connection is made long before any data packets are sent. It can then notify the OS of cable connection and the OS can then start sending packets.

At the electronic medium level the Ethernet PHY is regularly attempting to send a series of pulses over the wires. This process is known as Autonegotiation.

These link integrity test (LIT) pulses are sent by Ethernet devices when they are not sending or receiving any frames. They are unipolar positive-only electrical pulses of a nominal duration of 100 ns, with a maximum pulse width of 200 ns,[13] generated at a 16 ms time interval with a timing variation tolerance of 8 ms. A device detects the failure of a link if neither a frame nor two of the LIT pulses is received for 50-150 ms. For this scheme to work, devices must send LIT pulses regardless of receiving any. In the autonegotiation specification these pulses are called normal link pulses (NLP).

Normal Link Pulses

So on a regular basis both sides of an Ethernet connection, regardless of whether the cable is connected, is sending a pulse out. If one side or the other receives a pulse then it becomes aware of a "good" connection and then proceeds to negotiate link speed, duplex and other physical link characteristics with the other side via another series of electrical pulses.

Once both sides have negotiated a valid physical connection then the Ethernet chip will be able to signal to it's drivers within the operating system that a connection has been established.

After the connection is up and known good then the operating system can start transmitting Ethernet packets, doing DHCP, ARP and establishing connections to other computers and devices.

1
  • Unimprovable answer. Super Thank you. Commented Nov 1, 2022 at 21:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .