Layer 2 Protocols: Fundamentals and Functions

Middle Layer Access Protocols

Mid-layer protocols occupy a key position in networking technologies, enabling communication and interaction between network devices and applications. They act as an intermediary between the low-level physical and data link layer protocols responsible for data transmission and the high-level application protocols that provide specific services to users. The middle layer protocols such as ARP, PPP, IP, DHCP, STP, ICMP and UDP provide functions such as addressing, routing, connection establishment and error control, enabling the efficient operation of modern networks.

ARP (Address Resolution Protocol)

The ARP protocol for IPv4 networks is one of the fundamental protocols of the Internet and local area networks. This protocol also works in conjunction with the IP protocol to map IP addresses to hardware addresses used in the data communication protocol. These hardware addresses are called MAC addresses. These addresses serve as an identification code for each of the devices' network interfaces. ARP operates midway between the network layer and the medium access layer (if we consider the TCP/IP model). This protocol is used when using IP over Ethernet.

This protocol is needed when:

  • Two computers are on the same subnet and want to exchange traffic;
  • Two computers are on different subnets and they need to find a router that will give them access to the other network using routing;
  • It is also absolutely necessary when a router needs to send a packet to another router to exchange traffic or routes, and even when a router needs to send a packet to a computer on the same subnet.

 In addition to the ARP protocol, there is also the Reverse ARP (RARP) and Inverse ARP (InARP) protocols. Both protocols are variations of the ARP protocol and are used to obtain an IP based on a MAC address in certain circumstances.

PPP

The PPP protocol is a fundamental building block in communications, especially at the medium access layer. Designed to establish connections, PPP is very commonly used in network configurations. The main benefit of PPP lies in its ability to provide efficient and secure communication between two devices. This protocol is used in dial-up connections where one device establishes a direct connection to another over a telephone line. PPP ensures reliable and stable data transmission through aspects such as authentication, data compression and error handling. In addition to its use in dial-up connections, PPP is also used in serial links, making it a very interesting option for larger and more complex networks. In these cases, PPP provides data transmission over point-to-point connections, guaranteeing the integrity and reliability of the communication. On the other hand, an important feature of this protocol is its ability to support multiple network protocols, making it very flexible. It can encapsulate a variety of network protocols including TCP/IP, IPv6 and IPX.

Internet Protocol

Internet Protocol (IP)

Internet Protocols are a set of rules that define how to transmit data over a network. The IP protocol is a standard that contains specifications for how connected devices should operate on the Internet. For several reasons: Addressing and routing. Addressing is the guarantee that any device connected to a given network has a unique IP address. This identifies the source and destination of the data being transmitted. Routing, on the other hand, determines the path that traffic should take based on the IP address. The routing task is performed by routers, not only the ones we have at home, but also the routers of telecom operators. In turn, several protocols interact with IP to provide communication in any network. Within this protocol we can find two versions. The first one is IPv4. This is the de facto first official version of the protocol.

But now we have a new protocol called IPv6. In it, we can now count on an address space of 128 bits. That can be translated into 340 sextillion addresses. One of the problems that arises between these two versions is that they are incompatible with each other. While IPv4 addresses consist of four groups with a maximum value of 255 in each block, the IPv6 version consists of eight groups of four hexadecimal digits. IPv4 is more common at this time, as only a few government agencies have fully implemented IPv6.

Dynamic Host Configuration Protocol (DHCP)

This protocol works on IP networks, its main function is to assign IP addresses to devices and different hosts connected on the same network, allowing communication between them more efficiently. Apart from this, DHCP protocol is also responsible for assigning subnet mask, default gateway IP address, DNS server address and some other parameters related to their configuration. For example, a client machine sends messages or discovery packets over the network to its DHCP server, and the DHCP server sends a response request, acknowledging the client's request and assigning the necessary parameters.

Spanning Tree Protocol (STP)

This is a very interesting protocol because its main function is to avoid loops in LANs. It eliminates redundant links and handles network changes and failures. It should be noted how harmful such loops are to the network, as they can cause infinite propagation of data packets, which leads to congestion and decreases the overall performance of the network. This is why this protocol plays a key role. The STP protocol monitors all the links in the network to find any problems that may have occurred or any redundant links that may exist. It does this by applying the STA algorithm, which creates a topology based on the current network and eliminates redundant links.

This protocol uses configuration messages such as protocol frames, this is because typically devices in the network accept or allow STP messages and thus create a spanning tree that has no redundant links. The process of this protocol consists of four steps. The first step is to select the root bridge and then select the port. Once this step is completed, the next step is to select the assigned port and finally to block other ports, that is, those ports that are not root or not assigned. On the other hand, it should be noted that there are many variants of this protocol, such as Rapid Spanning Tree Protocol (RSTP).

Internet Control Message Protocol (ICMP)

This protocol supports the error control process. This is because the default IP protocol has no error handling mechanism in general. ICMP is used for error messages and control requests. It is a protocol used by devices such as routers to send error messages and information related to operations. For example, it can report that a requested service is unavailable or that a host or router could not be contacted/found. This protocol sits just above the IP protocol at the TCP/IP protocol layer. The ICMPv6 protocol for IPv6 networks also exists and has many more features than the ICMP protocol for IPv4 networks.

User Datagram Protocol (UDP)

Unlike TCP, UDP is not as reliable. It does not have the ability to check for errors or corrections during data transmission. However, there are certain applications where it is more appropriate to use UDP instead of TCP. An example is an online gaming session, where UDP allows data packets to be discarded without the ability to retry. The disadvantage is that this protocol is not recommended for data transmission. Because if multiple packets are lost during data transmission, the file becomes corrupted and the upper layers (application layer) must make a request to resend the datagram. A corrupted file cannot be used for the purpose for which it was sent. Similarly, for an online gaming scenario or video streaming sessions, the UDP protocol is recommended because it is faster as it does not need to perform the typical handshake.

Additionally, it is important to note that this protocol is mainly used in real-time streaming applications. For example, video calls, online gaming, or VoIP use UDP because of its ability to deliver data packets at higher speeds. In these applications, speed is critical and a small loss of data is less important than delayed or slow transmission.

Review

leave feedback