In this Cisco CCNA tutorial, you’ll learn about Layer 2 of the OSI reference model, which is the data link layer. Scroll down for the video and also text tutorial.
Cisco Local Area Network Layer 2 – Ethernet Video Tutorial
Layer 2 – The Data Link Layer
Layer 2 frames are encoded and decoded into bits ready to put on to the physical layer, the physical wire. Error detection and correction for a physical layer can be provided here, depending on the protocol that we're using.
Ethernet is the Layer 2 medium that is used on local area networks. Ethernet is pretty much ubiquitous on the LAN, and that's the layer 2 media that we're going to focus on.
Let's have a look at some of the different layer 2 protocols. I've got a link going to a page on Wikipedia where there's a list of network protocols above. Open that up and at the top it lists, there are some of the common layer 1 protocols, like ISDN, DSL. There's a lot of legacy protocols that are still listed here as well like ISDN isn't used so much these days.
Then, you can see the list of Layer 2 protocols as well. Ethernet is in here, most commonly used on the LAN. There's a legacy WAN protocol in here, a frame relay. Other kinds of protocols we've got in here are FDDI and the point-to-point protocol.
OSI Reference Model - Encapsulation
The next thing I wanted to do was just clear up any misunderstanding you may have about the terminology. When a packet is composed, obviously it's composed by the sender, and it's going to put it on the wire and send it to the receiver.
As we go down through the OSI model, the sender will start at the top layer, the Application Layer, and it will compose that part of the PDU. Then, Layer 7 will get encapsulated in the Layer 6 header. At that point, is called the data.
We then encapsulate it in the Layer 5 header and then in the Layer 4 header. We put the Layer 4 header on there, and at that point, it's called a segment.
Then the layer 3 header goes on. At that point, it's called a packet.
Finally, Layer 2, the Data Link Layer, will go on. At that point, it's called a frame.
However, when the sender is sending traffic to the receiver, it's not like it sends segments, packets, and frames separately. They're all part of the same PDU. It's just terminology that we're talking about here.
We send that one PDU and when we're looking at it from the point of view of layer 4, we call it the segment. From the point of view of layer 3, it's a packet, and from my point of view of layer 2, it's a frame.
The Ethernet Header
Moving on, and let's look at the Layer 2 ethernet header. If it is ethernet that we're using as our layer 2 protocol, at the start of the header, we've got the preamble. That's used to help the sender and receiver to synchronize.
We then have the Layer 2 destination and source address, that's the MAC address when we're using ethernet. We then have the ether type, which is used to specify what is encapsulated inside the ethernet header. That will typically be IPv4.
We then have the data and the FCS. The FCS is the frame check sequence. That's a cyclical redundancy check, which is used to check for the integrity of the frame to check that it has not been corrupted during transit.
The Media Access Control (MAC) Address
Now, let's look at the Layer 2 Ethernet address, which is the MAC address. MAC stands for Media Access Control. The MAC address is a 48-bit hexadecimal address. If we look back at the ethernet header, we have six bytes, each byte is eight bits. So, six times eight, that's where we get the 48 bits from.
The MAC address is split into two different halves that make up the MAC address. The first half, the first 24 bits, is the OUI. Which stands for Organizationally Unique Identifier. The identifier is the manufacturer of the ethernet port.
So, if you've got a Cisco router or switch and it's got an ethernet port on there, it will have a MAC address and the first half of the MAC address is Cisco's identifier. If you had a network card, and that network card came from IBM, for example, the first half of the MAC address is going to be IBM's identifier.
The second half of the address, the last 24 bits, is assigned by the manufacturer. The burned-in MAC address on every NIC port in the world is globally unique. The actual number of potential addresses is 2 to the power of 48. This is absolutely a big number. There's a lot of possible MAC address, so that makes it possible for every ethernet port in the world to have a unique MAC address.
An important point that I want to make here is that there is no logical addressing with your MAC addresses. It's just one big flat address space. We could have a PC with a network card from IBM, so it's going to have an IBM MAC address on there. That could be in New York. We could have another one also from IBM in Beijing, and another PC from IBM in London. They're not grouped together. There's no kind of a logical order with your MAC addresses, just one big flat address space.
With IP addresses, there is a logical order there. That's how we, as administrators, are going to control our networking.
I also want you to know how to get information about the MAC address. To get the MAC address on a Windows machine, open up a command prompt, and then enter the command:
In Linux, the command will be:
Finally, let's have a look at a Cisco router or switch. I'm going to open up a Putty session, and I'm going to ssh onto my router. I need to enter enable to get to the enable prompt, and then the command is:
This is going to give me a heap of output about all my different interfaces. I could also have just entered one interface if I wanted to there to more target the output. I can see on fast ethernet 0/0 the address is 0018.7374.8d56.
In brackets here, it tells me the BIA. That's the burned-in address, and it's exactly the same value here. The reason there's a difference, it is possible in software to change the MAC address on an interface, but normally we won't do that. Normally, we'll just leave it at the burned-in address from the manufacturer.
Introduction to the OSI Model: https://networklessons.com/cisco/ccna-routing-switching-icnd1-100-105/introduction-to-the-osi-model
Cisco Networking: OSI Model Layer 2 – Data Link: https://www.dummies.com/programming/networking/cisco/cisco-networking-osi-model-layer-2-data-link/
Text by Libby Teofilo, Technical Writer at www.flackbox.com
With a mission to spread network awareness through writing, Libby consistently immerses herself into the unrelenting process of knowledge acquisition and dissemination. If not engrossed in technology, you might see her with a book in one hand and a coffee in the other.