The clock on ethernet is often misunderstood, but its importance cannot be overstated. The arrival of data packets on the wire are not necessarily in any particular order, and without some way to tell which packet arrived first it would be impossible to send anything meaningful across the network. Ethernets use a technique called “time stamping” to make sure that all nodes agree about what happened when. This post will discuss how time stamps work, where they come from, and why they are essential for reliable networking.
Ethernet
Before delving into the specifics of time stamping, it’s helpful to understand a bit about how ethernet works. Ethernet is a packet-based networking protocol, which means that data is sent in discrete chunks called packets. These packets are transmitted one at a time, and each packet contains information about the sender, the recipient, and the data itself. When two nodes want to communicate with each other, they send packets back and forth until the conversation is finished.
Ability to Transmit
One of the most important features of ethernet is its ability to transmit data reliably. This means that if a packet is lost or damaged along the way, it can be retransmitted without causing any noticeable interruption in service. To make sure that all packets arrive safely, ethernet uses a technique called “carrier sense multiple access with collision detection” (CSMA/CD). This means that all nodes on the network listen before they talk. If two nodes begin transmitting at the same time, then one or both packets will be damaged in a collision and must be resent later.
The data link layer, which is the protocol in charge of moving data across a local area network, deals exclusively with this type of packet-based communication. One occasionally hears about “physical layer problems” when dealing with ethernet – these usually mean that there is some kind of problem with the physical wiring itself – but the vast majority of issues occur in the data link layer. When you have trouble with your wireless connection, you are actually having a data link layer issue. In ethernet, the data link layer is equivalent to the LLC sublayer of the OSI Reference Model – this is important for understanding time stamping later on.
Different nodes have different ways of deciding when it is ok to talk. For example, in early versions of ethernet all nodes listened for traffic before speaking. This “listen-before-talk” approach was a bad idea for several reasons:
The solution to these problems came from an unlikely source: carrier pigeons! Instead of listening continuously and trying to speak as soon as possible, new versions of ethernet would listen in short bursts called interpackets interframes . When a node detected traffic on the wire, it would wait until the interpacket interframe was over and then transmit its own packet. This approach solved the problems of listening continuously and speaking too soon, and it also allowed nodes to reserve bandwidth for future use.
How could nodes know when the interpacket interframe had ended?
the American Telephone and Telegraph Company (AT&T). In order to make sure that long conversations between two people didn’t tie up the phone line, AT&T developed a technique called “time stamping”. This technique stamps each packet with a timestamp as it is sent, allowing the receiving node to determine when the conversation is over.Ethernet took this idea, plugged it into CSMA/CD, and developed a system for sending nodes on and off the wire at regular intervals using something called a token bus . The first node to pick up the token is allowed to transmit its packet, but all other nodes must remain silent until they are given time by another node holding onto the token. If you’ve ever used an old ethernet hub, then you may have noticed that it takes forever to download anything – this is because hubs do not use time stamping!
Using some simple math based on information contained in each packet, each ethernet node can find out exactly when its packets should go out. Every node on the network knows when the first packet in a conversation should arrive, and if it doesn’t show up on time then the receiving node can assume that there was a collision and will retransmit the packet.
Clock Synchronization
Clock synchronization is important for ensuring that all nodes on an ethernet network are transmitting and receiving data packets at the same time. Without proper clock synchronization, packets could be arriving out of order or be duplicated, causing all sorts of havoc on the network. Ethernet networks use a variety of techniques to keep their clocks in check, but the most common approach is to use a Network Time Protocol (NTP) server. NTP servers are computers on the internet that have very accurate, and they can be used to set the system clock on any computer.