Local Area Network design/Ethernet
Ethernet is nowadays the most used technology in wired LANs with shared bus architecture, because it is a simple and little expensive solution with respect to other LAN technologies such as token ring and token bus.
Ethernet frame formatEdit
Two versions of Ethernet exist, with different frame formats:
- DIX Ethernet II (1982): version developed by DEC, Intel and Xerox (after this the 'DIX' acronym);
- IEEE 802.3 standard (1983): version standardized by the IEEE 802 working group.
Since there are two versions of Ethernet, a considerable inhomogeneity in upper-layer protocol envelopments exists:
- older protocols (e.g. IP) and protocols farther from IEEE use the DIX Ethernet II enveloping;
- protocols standardized since the beginning by IEEE (e.g. STP) use the IEEE 802.3 enveloping.
DIX Ethernet IIEdit
The DIX Ethernet II packet has the following format:
|7 bytes||1 bytes||6 bytes||6 bytes||2 bytes||46 to 1500 bytes||4 bytes||12 bytes|
|preamble||SFD||destination MAC address||source MAC address||EtherType||payload||FCS||IFG|
|DIX Ethernet II frame (64 to 1518 bytes)|
where the most significant fields are:
- preamble (7 bytes): bit sequence to recover synchronization between the transmitter clock and the receiver clock.
- Preamble can be shortened whenever the packet crosses a hub → it is not possible to connect more than 4 hubs in a cascade: Local Area Network design/Repeaters and bridges#Interconnection at the physical layer;
- Start of Frame Delimiter (SFD) field (1 byte): bit sequence identifying the beginning of the frame;
- EtherType field (2 bytes): it identifies the upper-layer protocol used in the payload (it is a number greater or equal to 1500);
- Inter-Frame Gap (IFG) field (12 bytes): pause, that is no signal, identifying the end of the frame.
The IEEE 802.3 packet can have one of the two following formats:
|7 bytes||1 byte||14 bytes||3 bytes||0 to 1497 bytes||0 to 43 bytes||4 bytes||12 bytes|
|preamble||SFD||MAC header||LLC header||payload||padding||FCS||IFG|
|IEEE 802.3 frame (64 to 1518 bytes)|
|7 bytes||1 byte||14 bytes||8 bytes||0 to 1492 bytes||0 to 38 bytes||4 bytes||12 bytes|
|preamble||SFD||MAC header||LLC SNAP header||payload||padding||FCS||IFG|
|IEEE 802.3 frame (64 to 1518 bytes)|
- the DIX Ethernet II and IEEE 802.3 frames have the same minimum and maximum lengths, because IEEE had to specify a frame format compatible with the old version of Ethernet;
- a DIX Ethernet II frame and an IEEE 802.3 frame can be distinguished by looking at the value in the field following the source MAC address:
- if it is lower or equal to 1500 ('Length' field), the frame is IEEE 802.3;
- if it is greater or equal to 1536 ('EtherType' field), the frame is DIX Ethernet II;
- in the IEEE 802.3 frame the 'Length' field would make superfluous the 'Inter-Frame Gap' (IFG) field, but it is present to keep compatibility with the DIX Ethernet II frame;
- in the DIX Ethernet II frame the upper layer has to transmit at least 46 bytes, while in the IEEE 802.3 frame the frame can be stretched to the minimum size with some padding as needed;
- the LLC and LLC SNAP headers in the IEEE 802.3 frame waste a lot more bytes with respect to the 'EtherType' field in the DIX Ethernet II frame although they are aimed to the same functionality of specifying the upper-layer protocol, and this is why the IEEE 802.3 standard has not been widely adopted to the benefit of DIX Ethernet II.
10-Mbps Ethernet can work over the following transmission physical media:
- coaxial cable:
- 10Base5: thick cable (max 500 m);
- 10Base2: thin cable (max 185 m);
- twisted copper pair:
- 10BaseT: cable with 4 twisted pairs of which just 2 used (max 100 m):
- Unshielded (UTP): unshielded;
- Shielded (STP): shielded with single global shield;
- Foiled (FTP): shielded with single global shield + a shield per pair;
- 10BaseT: cable with 4 twisted pairs of which just 2 used (max 100 m):
- optical fiber (max 1-2 km)
At the beginning shared bus was physically made by a coaxial cable:
- vampire taps: every network card is connected to a thick coaxial cable through a vampire clamp, which allowed electrical propagation via physical contact (galvanic continuity) → uncomfortable connection;
- T-connectors: every network card is connected to a thin coaxial cable through a T-connector → connecting and disconnecting a host requires to unplug the whole network.
Twisted copper pairEdit
With the introduction of the twisted copper pair, cabling (that is cable laying in buildings) acquired a greater flexibility: every host can be connected to a RJ45 wall socket through the specific RJ45 connector, and all sockets are in turn connected to a cabinet.
In addition, the RJ11 connector used by telephony can be connected to the RJ45 wall socket, too → in cabling RJ45 sockets can be placed in the whole building and then one can decide whenever whether an Ethernet card or a telephone should be connected, by switching between the data connection and the telephone connection in the cabinet.
- no sensitivity to electromagnetic interferences
- larger distances
- higher costs
- lower flexibility
A collision occurs when two or more nodes within the same collision domain transmit at the same time and their signals overlap. The Carrier Sense Multiple Access with Collision Detection (CSMA/CD) protocol specify how to recognize a collision (CD) and how to recover a collision (retransmission).
CSMA/CD is a simple and distributed random-access (that is non-deterministic) protocol: it does not contemplates intermediate devices or particular synchronization mechanisms, unlike token ring where the synchronization mechanism is the token itself → the CSMA/CD protocol is efficient in terms of throughput because there is no overhead for synchronization, in terms of delays and channel occupancy.
In full-duplex mode the CSMA/CD protocol does no longer need to be enabled.
Instead of transmitting the whole frame and just at the end checking for a collision, the node can use Collision Detection (CD): during the transmission sometimes it tries to understand whether a collision occurred ('listen while talking'), and if so it immediately stops the transmission, avoiding to waste the channel for a useless transmission.
In the real world, collision detection is performed in two different ways depending on the type of transmission medium:
- coaxial cable: there is a single channel for both transmission and reception → measuring the average DC on link is enough;
- twisted copper pair, optical fiber: there are two channels, one for transmission and another for reception:
- transmitting stations: they can realize that a collision occurred by detecting activity on the receiving channel during the transmission;
- non-transmitting stations: they can realize that a collision occurred only by detecting a wrong CRC code on the received frame.
- The jamming sequence is a powerful signal which is sent by who has noticed a collision to guarantee that the CRC code is invalid and to maximize probability that all the other nodes understand that a collision occurred.
Reducing the number of collisionsEdit
Carrier Sense (CS) allows to reduce the number of collisions: the node which wants to transmit listens to the channel before transmitting:
- if it senses the channel is free: the node transmits the frame;
- if it senses the channel is busy:
- 1-persistent CSMA: the node keeps checking whether the channel is free and transmit as soon as it becomes free;
- 0-persistent CSMA: the node tries again after a random time;
- -persistent CSMA: the node with probability waits a random time (0-persistent), with probability immediately checks again (1-persistent).
In a LAN in the worst case the channel occupancy is equal to 30-40% the available bandwidth → Ethernet implements 1-persistent CSMA/CD because it is aimed for averagely unloaded networks with low probability of collisions.
- CSMA limitations
However, with twisted copper pair or optical fiber CSMA is not able to avoid collisions altogether (otherwise CD would not be useful): if propagation times are considered, a far node can sense the channel as free, even if actually it is busy but transmission has not reached the far node yet:
The vulnerability interval is defined as the time interval where starting a transmission by the far node would create a collision (it is equal to the propagation delay on the channel), and this interval is as larger as distance increases → this protocol works well on small networks.
After a collision occurred, the frame has to be transmitted again. If the stations involved in the collision transmitted again immediately, another collision would occur → back-off algorithm inserts into the wait a randomness element exponential in retransmissions:
- 1st retransmission: the node waits a time chosen randomly between 0 and 1 slot times;
- 2nd retransmission: the node waits a time chosen randomly from 0 to 3 slot times;
- 3rd retransmission: the node waits a time chosen randomly from 0 to 7 slot times;
and so on, according to formula:
- is the number of collisions occurred on the current frame;
- is the slot time, that is the time required to send an Ethernet frame of minimum size (64 bytes), equivalent to 51.2 µs.
At the end of every wait, the node listens again to the channel by CS.
Constraint between frame size and collision diameterEdit
Since the channel access is contended, when one manages to get the network access it is better to transmit large packets. A minimum size for frames needs to be established: if the frame is too small and the collided transmission lasts too little time, it may happen that no stations notice the collision:
A constraint between the frame size and the collision diameter exists so that all collisions are recognized: collision detection works only if the round trip time , that is the outward and return time, is lower than the transmission time :
where is the transmission speed and is the propagation speed.
Increasing the transmission speed means increasing the frame minimum size, or for the same minimum size it means decreasing the maximum distance among nodes, but too large frames would increase the transmission error probability and would clog the network.
In Ethernet DIX the theoretical collision diameter can not exceed 5750 meters:
Without hubs the maximum network size is quite limited by maximum distances supported by transmission media (e.g. due to signal attenuation). Thanks to hubs the network size can be extended (although at most to 3 km due to non-idealities in devices): the hub, typically placed as the star center in a star topology, re-generates the signal (repeater) and internally simulates the shared bus allowing to connect multiple stations together through the twisted copper pair: Local Area Network design/Repeaters and bridges#Interconnection at the physical layer.