The characteristics of Layer 2 are:
- The Data link layer receives data from the network layer.
- It adds the header and trailer to the data and passes data to the physical layer.
- An information bundle comprises checksum, source and destination location, and also other information. The biggest bundle that can be sent through an information connection layer is called the Maximum Transmission Unit (MTU).
- Each data unit is considered as a frame.
- A link-layer protocol is used to move datagram frames over an individual link.
Let us study this example of MAC address flow in a datalink layer.
A host interface having a unique , 48-bit address is called the Ethernet address or Media Access Control (MAC)address.
Hosts with multiple network interfaces should use the same MAC address on each interface. The data link layer’s protocol-specific header denotes the MAC address of the packet’s source and destination. When a packet is sent to all hosts (broadcast),a special MAC address (ff:ff:ff:ff:ff:ff) is used. Switches work at the data link layer.
MAC addresses are usually represented as six colon-separated pairs of hex digits, For Ex: 8:0:20:11:ac: 85. This number is unique and is associated with a particular Ethernet device i.e. Network Interface Card (NIC).
The following image describes the OSI Model data encapsulation:
The Data Link layer has two sub-layers:
MAC Sublayer: This layer deals with the broadcast network and protocols. When many users require transmitting data over the media at the same time, MAC sub-layer helps to determine multi-access based on protocol (for Ex: CSMA/CD). MAC addressing and logical topologies are also defined.
Logical Link Control (LLC)is one of the sublayers in the data link layer which provides:
- Flow control
- Error notification
Network devices like Bridges and Switches operate at the Data link layer.
- Bridges: Bridges are devices that are used to connect two LAN segments that use the same protocol.
- Switches: Switches are intelligent devices with multiple ports and connect to multiple LAN segments.
Bridges and Switches both have address learning mechanisms. Unlike hubs, these learn MAC Addresses by broadcasting to all the connected ports except the source and generates a MAC table.
The MAC Table is a list of learned addresses. Whenever a host transmits data, the switch verifies with its MAC table. If the address is found, it will perform a unicast (one-to-one direct transfer). If the address not available it does a broadcast until locating the address learning.
Bridges and Switches
Tip: Bridges use software for address learning while Switches use a hardware chip for address learning.