The Data Link Layer

 The first thing I want to talk about is ethernet and MAC addresses. Wireless and cellular internet are quickly becoming one of the most common ways to connect computers to networks, and it's probably how you're connected right now, and it's why traditional cable networks are the most common way to connect right now. The protocol most widely used to send data across individual links is called ethernet. Ethernet and the data link layer provide links for software and higher levels of the stack to send data. This abstract away software from caring about the physical layer and what hardware is in use. Now the internet, transport, and application layer would be the same no matter how the device you're running on is connected. We just need the underlying layers to send and receive data from it. We will describe components that make up an ethernet frame, differentiating between unicast, multicast, and broadcast addresses. Finally, we explain how cyclical redundancy checks help ensure the integrity of data sent through ethernet. 

Ethernet is fairly old technology. The ethernet in use today is comparable to the standard used years ago. Frequently, many or all devices on a hub shared a single frequent collision domain. It first came into being in 1980 and saw its first fully published version in 1983. You might remember that a collision domain is a network segment where only one device can speak at a time. This is because all data in a collision domain is sent to all the nodes connected to it, and if 2 computers going at the same time, there will be a collision, leaving the end result unintelligible. Ethernet uses carrier sends multiple access with collision detection. We abbreviate this to CSMA/CD, which is to determine when a communication's channels are clear and when a device is free to transmit data. The way it works is simple. If there's no data in a network, a node will be currently free to send data. If 2 or more computers send data at the same time, the computers detect this collision and stop sending data. Each device waits a random interval of time before trying to send data again, preventing all computers involved in the collision from colliding again. When a network segment is a collision domain, it means that all devices on that segment receive all communications across the entire segment. 

We need a way to identify which node the transmission was actually meant for. This is where a Media Access Control Address (MAC Address) comes into play. A mac address is a globally unique identifier attached to an individual network interface, which is a 48-bit number represented by 6 groupings of 2 hexadecimal numbers. Hexadecimal is a way to represent numbers using 16 digits. They employ the letters A, B, C, D, E, and F to represent the numbers 10, 11, 12, 13, 14, 15. Another way to reference each group of numbers in a reference is an octet. This is any number that can be represented by 8 bits. 2 hexadecimal can represent the same numbers that 8 bits can. The short answer is, a 48-bit number is much larger than you expect. The total number of MAC addresses is 2^48 or 200 trillion or so. The first 3 octets of a MAC address are Organizationally Unique Identifier (OUI) assigned to individual identifiers by IEEE.



Ethernet uses MAC addresses to ensure that the data it sends has both an address for the machine that sent the transmission, as well as one the transmission was intended for. In this way, even on a network segment, each node on that network knows what that traffic is intended for. 

Unicast is when one device transmits data to another device or having one receiving address. If the least significant bit in the first octet of a destination address is set to zero, it means that the ethernet frame is intended for only the destination address. If the least significant bit in the first octet of a destination address is set to zero, it means that the ethernet frame is intended for the destination address, which means the last bit or bit 0 of an octet. If the least significant bit in the first octet of a destination is set to one, it means that you're dealing with a multicast frame. Network interfaces can accept lists of configured communications as these transmissions. The third type of network interface is called a broadcast. This is when a message is sent to every single device on a Local Area Network. This is accomplished by using a special destination called a broadcast address, and broadcasts are used so the devices are able to communicate with each other better. Let's move on to dissecting the ethernet frame now. 

We'll round out the understanding by dissecting an ethernet frame. A data packet is an all-encompassing term that represents any single set of binary data being sent across a network link. A data packet is one set of data being sent from point A to point B. Data packets at the ethernet level are known as ethernet frames, a highly structured collection of information presented in a specific order. Network interfaces at a physical layer can convert a string of bits into meaningful data.


The first part of an ethernet frame is the preamble, which is 8 bytes or 64 bits long and can itself be split into 2 sections, which has 7 bytes as a series of 1's and 0's like a buffer between frames and used by network interfaces. The last byte is the SFD or Start Frame Delimiter signaling the preamble is over and the actual frame contents will follow. The destination address is then followed by the source MAC address, or where the frame originated from. Each mac address is 48 bits. Then there is an ether-type field, which is 16 bits long and used to describe the protocol of the contents of the frame.  You can also find a VLAN header that indicates that the frame itself is a VLAN frame, and if a VLAN frame is present, the Ether Type field follows it. VLAN is a technique that lets you have multiple logical  LANs operating on the same physical equipment. Any frame will only be delivered configured to relay that specific tag. This way, we can have a single physical layer to operate at multiple LANs. After this, there is a data payload, which is the data being transported, which is everything that isn't a header and can be anywhere from 46 to 1,500 bytes long. Then there is a frame check sequence, which is a 4-byte number that represents a checksum for an entire frame. This value performs a cyclical redundancy check against the frame, which is an important concept in data integrity. 

A CRC uses polynomial division that creates a number to represent a larger set of data. You should end up with the same checksum number.  We need to know if a receiving network interface to confirm if it received uncorrupted data. The device collects all the information, and performs a CRC, and attaches the resulting checksum number, or the frame check sequence, at the end of the frame. This data is sent across a link and received at the other end. If the checksum computed by the receiving end doesn't match the checksum sent, data is thrown out since the data will be corrupted then. It is then up to a protocol to decide if that data should be retransmitted. Ethernet doesn't perform data recovery, not data integrity. 

Comments

Popular Posts