Wednesday, February 19, 2014

What is Ethernet? How Ethernet Works? CSMA/CD? / IEEE802.3 & Ethernet II



What is Ethernet?
           
            Ethernet is a LAN technology that defines the standards for the Layer2 PDU’s (Protocol Data Units) & Layer1 media type, length, connectors, and data transfer speed etc., which the network devices follow to exchange information.
            The layer2 PDU of Ethernet is called as a ‘Frame’.
            It was first developed by a group called DIX (formed by the first letter in the name of the organizations: Digital Equipment Corporation, Intel, and Xerox) in 1973. After that DIX invented the Ethernet II (DIX v2.0) in 1982. Later on it was promoted as a standard by IEEE as IEEE802.3 in 1983 and later on sub-standards.

            At first Ethernet supported 10Mbit/second data transfer using the coaxial cables. Since the devices were interconnected using the coaxial cabling, Ethernet used the CSMA/CD mechanism to avoid collisions.
            Ethernet Evolved and the coaxial cables were replaced with twisted pair & fiber optic. Data transfer rates were also periodically increased from the original 10Mbit/second (Ethernet) to 100 Mbit/Second (Fast Ethernet), 1000Mbit/sec (Gigabit Ethernet) and now 10Gigbit/sec. And even the duplexing support has been extended from only half-duplex to full-duplex.
            Ethernet uses the 48 bit MAC addresses of the devices to transfer data between the devices.

How Ethernet works?

            The operation of Ethernet is solely based on CSMA/CD. Ethernet was initially developed with an idea that all the devices will be connected to a single physical coaxial cable.
            So in the shared medium only one device can send data at any given time. To ensure that only device is sending the data Ethernet takes the help of CSMA/CD.

How CSMA/CD works?

CSMA= Carrier Sense Multiple Access

            Whenever an NIC puts a frame on the wire, it should first sense the wire to see if there is already a frame being travelling on the wire. Since the Ethernet supports multiple accesses, other device/NIC might already have transmitted its data, so an NIC must go through this sensing process.
            If the cable is copper, the NIC can detect the frame by examining the voltage levels on the wire.
            If the cable is fiber, the NIC can detect the frame by examining the light frequencies on the wire.

            If the NIC doesn’t see/sense a frame already on the wire, then it can transmit its own data. If there is already a frame on the wire, then the NIC will wait for the completion of the transmission of that frame & then transmits its data.

CD= Collision Detection
           
            If two or more devices sensed the wire at the same time and see no frame on the wire, then both the devices will transmit their own data at the same time. In this scenario, the voltages levels on the copper wire or the light frequencies on the fiber get mixed up or collide, then a collision will happen.
            The NIC’s will come to know about this collision with the help of the mechanism called Collision Detection.
            If the NIC’s see a collision for their transmitted frames, then each of the both NIC’s will send a special signal called “Jam” signal on the wire. Then the NIC’s wait for a small random period of time and then senses the wire again and then retransmits the frame. The time period that NIC wait can be measured in microseconds.
            So if the number of devices on the wire is more eventually the number of collisions will also be more.

Ethernet evolved:
           
            The need for higher bandwidth and collision free networks rose. The coaxial cables (10Base5, 10Base2) were slowly replaced with 10BaseT physical media. And the physical & logical bus topology by shared co-axial medium has been migrated to a logical star topology with a Hub connecting all the devices but remained physical bus topology.
            Then slowly bridges came and they divided the collisions to port basis and then the switches came they started supporting full-duplex operations and multiple VLANs/Broadcast domain and STP instances.
            And the physical media data transfer speed had increased from 10Mbit/second to 100 Mbit/second and then 1000 Mbit/second and now 10Gigabit/second.
           

Frame types:

            The most commonly used is Ethernet-II, however will take a look at both Ethernet II and IEEE802.3 frame format.

Let’s take a look at Ethernet II frame:

Preamble
Destination MAC Address
Source MAC Address
Ether Type
Layer3 encapsulated packet
FCS
8Bytes
6Bytes
6Bytes
2 Bytes
Varies
4 Bytes

Preamble: This field includes alternating 1’s and 0’s and ends with two 1’s. When the destination device receives this pattern, it understands that anything that is followed by this pattern is the actual frame.
            The capture of an Ethernet II frame from packet tracer is shown below:
 Destination & Source MAC: You can clearly understand that this field includes the MAC address of the devices accordingly.

Type or Ether type: It is a 16 bit (2 Byte) value to indicate which upper layer protocol should process the frame.

Data: It is the actual packet/information that needs to be sent to destination device.

FCS: Frame Check Sequence, is used by the receiving device to know whether the frame is corrupted or not. Actually the sender device runs an algorithm using all the fields (Preamble, Destination & Source MAC, length and data), and that algorithm will generate a 4byte value, which will be included in this field.
            At the receiving end, that device will perform the same algorithm calculation and if the value matches to the value in this FCS field of the received frame, then the receiving device confirms that the frame is not corrupted, if the value doesn’t match then the receiving device assumes that frame had corrupt.

Now let’s take a look at IEEE 802.3 frame:

            The IEEE version of Ethernet is standardized with 802.2 and 802.3 standards. It split the data link layer into two sub-layers.
  1. MAC layer (802.3)
  2. LLC (Logical Link Control) layer (802.2)
  3.  
The MAC layer defines the format of framing, MAC address and the Ethernet operation using CSM/CD.
The LLC works with SAP (Service Access Point) identifiers. The network layer protocol is encapsulated in the 802.2 frame. The number of the network layer protocol is kept in the SAP field. When the destination device receives this frame, it examines the SAP field to determine which layer3 protocol should process the frame.

IEEE 802.3 frame:

Preamble
Destination MAC Address
Source MAC Address
Length
IEEE 802.2 header and the data
FCS
8Bytes
6Bytes
6Bytes
2 Bytes
Varies
4 Bytes

The frame format of the Ethernet II and IEEE is same most of the part. Here we need to discuss mainly about the fields: length & 802.2 header field

Length: The NIC’s can differentiate the Ethernet II frame and IEEE Ethernet frame by seeing the value in this field. If the value is more than 1500, then it is an Ethernet II frame, if the value is less than 1500, then it is an IEEE Ethernet frame.

LLC or 802.2 frame:

            The 802.2 frames are encapsulated inside an 802.3 frame i.e. the 802.2 frames are transmitted by the 802.3 frames. There are two types of 802.2 frames:
  1. SAP frame (Service Access Point)
  2. SNAP frame (Sub-network Access Point)

802.2 SAP frame:

Destination SAP number
Source SAP number
Control
Encapsulated upper layer data/ Layer3 packet
1 Byte
1 Byte
1 -2 Byte
Varies

Destination SAP: This field tells the destination device about the layer3 protocol that should process this frame.

Source SAP: The source device puts the number of the layer3 protocol that originated the frame.

Control: Defines the packet format and flow control

Data: This field contains the actual data encapsulated in the layer3 packet.

802.2 SNAP frame:

The SNAP frame has two additional fields: OUI ID & Type

Destination SAP number
Source SAP number
Control
OUI ID
Type
Encapsulated upper layer data/ Layer3 packet
1 Byte
1 Byte
1 -2 Byte
3 Bytes
2 Bytes
Varies

OUI ID (Organizational Unit Identifier): It is used to differentiate between the vendors.

Type: It is a 16 bit (2 Byte) value to indicate which upper layer protocol should process/originated the frame.

Difference between SAP and SNAP frame:
           
            The issue with the 802.2 SAP frame was, though the SAP field is 8 bits, only 6bits was used to identify the upper layer protocol, which allows only 64 protocols. Since the number of protocols is increased, to support the increased protocols SNAP frame is found.

To indicate an SNAP frame all the SAP fields are set to hexadecimal 0XAA and the control field is set to 0X03.

However the most commonly used frame type is Ethernet II. The difference between Ethernet II and IEEE Ethernet 802.3 can be found here: http://www.banalyzer.de/ban/HTML/P_LAYER2/Eng/P_lay208.html



Few important points:


On fiber, there is no CSMA/CD since there was never such a thing as a fiber Ethernet hub
Fiber is always full duplex and CSMA/CD does not exist in a full duplex environment.
 
In the next post we will discuss about cable type “Unshielded Twisted Pair” and cabling methods (Straight through and Crossover) to interconnect different type of devices.

No comments:

Post a Comment