The OSI layer 2 or Data Link Layer provides a host of services to both the Network Layer and Layer 1. Error detection, Flow control, data organization into frame structures, synchronization, and reliability are the complex features of Layer 2. We will look at ethernet, DSL, PPP, DOCSIS 3, SONET, and more. Transfers data between adjacent network nodes! The principal service is transferring data from the network layer of the source to the network layer of the destination node. The importance of flags in the frame. We will explore frame check sequence (FCS) and Forward Error Correction (FEC). Automatic repeat Request or (ARQ) and its role in the standard ITU G.hm standard.
This lecture and presentation is about OSI Layer 2.
It's really about taking Layer 3 and preparing it to communicate on our media at Layer 1.
That's the job of Layer 2.
We will cover on this video the fundamentals of Layer 2,
how the source at Layer 2 communicates to the destination at Layer 2.
We'll look at all of that technology,
Data Link Layer is about a framing system,
wrapping what comes down from Layer 3 into a framing system.
We're going to look at this in detail.
We're also going to look at one of the most popular wide area network Layer 2 technologies,
SONNET, Synchronous Optical Networking.
We're going to look at some cool things like OC192
to directly connect to a WAN with almost no equipment between it.
We will look at the DOCSIS 3.1 Data over Cable Service Interface Specifications.
These are specifications developed by Cable Labs.
That's the industry organization.
They lay a standard for how to deliver internet over hybrid fiber coax networks.
We're going to look at this primarily at Layer 2.
We're also going to look at DSL, Digital Subscriber Line.
We're going to look at GFast DSL.
It goes up to 2 gigabits per second.
We're going to again focus primarily at Layer 2.
Point-to-Point Protocol is one of the most popular Layer 2 WAN technologies in the networking world.
It began as early in the internet as dial-up modems that connected.
I used to use a dial-up modem using Point-to-Point Protocol to connect to an ISP.
We're going to look at its frames and this flexibility of this protocol.
What we'll not cover in this video are there are a lot of protocols at Layer 2.
I'm listing some on this slide.
If they're obsolete or limited use, I probably won't touch on them.
Another thing that I will not cover in this video is the Ethernet
MAC destination and MAC source address.
This topic is beat to death on every video and every presentation of A-Plus and Network-Plus.
Because it's so heavily covered,
I'm going to focus on items that are not covered very often in the Ethernet frame.
Again, we'll not cover the source MAC address, but on both slides,
I've put a lot of great information.
So, you can always download the slides from the video description
and you can take a look at this slide deck.
The Data Link Layer works very closely, hand-in-hand,
and it interfaces with the Layer above, in this case, the Network Layer.
It also interfaces and communicates to the Physical Layer.
So, all layers in the OSI have to work with those above and below,
except the two top and bottom ones, Application and Physical.
So, Data Link Layer is going to work very closely with the Network Layer
and very closely with the Physical Layer.
The Data Link Layer is very different than its cousin, the Network Layer,
which can communicate to a host across a very complex internetworking,
as we're going to look in our next video.
The Data Link Layer cannot do that.
It is bound to transfer data in, say, a WAN to adjacent network node.
In other words, point-to-point on a WAN.
In a LAN, it has to communicate to another device in the same local area network.
So, Data Link Layer is very limited in its communication.
As we dig into Layer 2, you're going to hear the word Principal Service,
as we look at the various layers and what they're responsible for.
You're going to see me use the word Principal Service.
At Layer 2, the Principal Service is to transfer data from the Network Layer of the source
to the Network Layer of the destination.
That's the Principal Service of Layer 2.
Let's take a look at this slide.
I've got a laptop on the left, and you can see it.
I've got a network stack below it.
And then I've got a wireless router that's going to act as my intermediate device.
And then I've got a server on the right-hand side.
And they're the laptop and the server on different subnets.
And so the router takes care of transferring data from one subnet to the other.
But remember, Data Link Layer can't do that.
It has to go from one node to another, and then from one node to another.
It doesn't have the ability to do what Layer 3 can do.
If you look at the data coming down from the laptop, you'll see arrows going from 4,
layers going from 3 to 2, 2 to 1.
And that's the actual flow of the data.
As it moves over to the intermediate device, you see it go from 1, 2 to 3, 3, 2 to 1.
And most of you see that data go back to the server.
And that makes sense.
That's how actual data flows as it goes from, say, a laptop to a server.
People also talk about, or they lecture, and they talk about the communication between the layers.
So if you look at the laptop, Layer 2, and the intermediate device,
you'll see this communication going across from Layer 2 to Layer 2.
But they never explain what that is.
How do they communicate?
Well, we're going to dive into that.
And see exactly how engineers design Layer 2.
So there is crystal clear communication from the source of Layer 2 to the destination of Layer 2,
from your laptop to Microsoft.com, if that's where you're going.
Before we get too involved in the communication between Layer 2 on one device and Layer 2 on the
other, let's zoom back out and take a look at Layer 2 from 1,000 feet.
And let's look at some of the big picture items that Layer 2 brings to the table.
Layer 2 brings a number of important features and services.
One, organization of the data into frames.
We're going to look at it does frame synchronization and why that's so critical.
Many data link services provide detection and recovery of transfer errors.
We'll also look at flow control.
Many protocols at Layer 2 provide avoidance of overloading the receiver.
We're also going to look at buffer management and media control.
Now listen carefully.
All protocols at Layer 2 do not always provide all of these services.
Some provide all of them.
Some of them provide some of them.
But Ethernet, point-to-point protocol, and many of the ones I'm going to be talking about
do provide most of these services.
Frame design is key to providing all those services that we talked about.
Here I've got an Ethernet frame.
This is probably one of the simplest frames to look at and understand.
It doesn't provide all those services we mentioned, just some of them.
Whereas we talk about 802.11's frame structure and design,
it is complex and provides almost all of those services we just mentioned.
So frame design by each protocol, Layer 2,
either includes some of those or all of those services.
Logical communication between Layer 2 in the source and Layer 2 in the destination
begins with the source host.
It sets data in fields and flags so that it can accurately communicate
with that destination Layer 2.
Down at the bottom I've got an 802.3 Ethernet frame.
Everybody's seen it.
Most people are comfortable with it.
Interesting, the network layer provides,
if you'll see the red arrow that points down to the data link layer,
it provides a lot of information in Layer 2.
For example, let's say Layer 3 does an ARP.
It's going to put ARP packet into the data field.
It's also going to tell Layer 2 that the Ether type field
must have a binary number that indicates this is an ARP packet.
It can also set flags in the source MAC and source destination
to indicate is it a broadcast MAC address, it's a multicast MAC address.
All of that is being brought or pushed down by Layer 3.
Now Layer 2 still has control of some of this information in the frame,
such as the preamble and the start of frame.
That's all used for frame synchronization.
That's done predominantly by Layer 2.
And then the CRC value, which does the air detection and air correction
is at the end of the frame.
Then that's sent down and transmitted across,
transmitted to Layer 1 and then sent across the media.
Now the destination host reads what it received from the source
and it begins by looking at those fields and flags.
It looks at the Ether type.
Well, actually, it starts with a preamble and start a frame.
It says, OK, I'm synchronized.
I can now read those flags in the source MAC,
the flags in the destination MAC,
and I can understand what kind of MAC address I have in there.
Then it reads the Ether type field and says, oh, this is an ARP.
And then it can read the data, pass it up to Layer 3.
And if you'll notice the green arrow going from data link layer
to network layer, it communicates critical information
to Layer 2 on the destination host.
Once it reads all that information,
accurate information is communicated with Layer 3 on the destination.
We are looking at an 802.3 Ethernet frame.
Let's just take a look at one field and see the variety of information
that can be stored as they design these fields in the Ethernet frame.
We're looking at the Ether type field.
It's two octets or two bytes.
Remember, that's the same thing, octets or bytes.
It represents 16 bits.
If the value in the Ether type field is less than decimal 1536
or hexadecimal 0600, it indicates that the length of that data field.
If the value in the Ether type field is greater than 1536,
then it represents a protocol in the data field.
This is a spreadsheet used by programmers
to know exactly what to put into an Ether type field.
So if a programmer wants to put in the data length,
he's going to know that he has to put in a value that's below 1536.
But if he wants to put a specific protocol,
like for example, he wants to indicate IP version 4,
he's going to put this binary number into that Ether type field.
If it's going to be an ART packet,
the programmer needs to know that it's going to be this binary data
that's going to be put in that Ether type field.
So depending on the protocol that the programmer is going to be using,
he needs to know exactly what goes into that Ether type field.
If there's VLAN tagging, he's going to put in the value hexadecimal 8100.
Or if we're using IP version 6, he's going to put in hexadecimal 86DD.
By putting accurate information into these fields at the source,
when it's received by the destination in red,
it knows exactly what was sent to it.
You've heard me use the word fields and flags.
Fields are usually a series of bits like the Ether type field
that indicates specific information.
Flags are very useful because they're usually a one bit portion of the frame.
That if they're a one, it means one condition.
If it's a zero, it means another condition.
We typically use the word flag when we're talking about those.
We have already looked at a field, the Ether type field.
It's a two byte field that gives us very specific information
to help us understand what's in the data field.
Flags are like fields in that they convey important information at the data link layer.
They're usually one bit.
So look at the very top and you'll see the destination address.
It's six octets.
As you come down, you'll notice I have an IG bit
and a UL bit in the destination MAC address.
That's reserved.
That's a flag.
It's a one bit condition.
If the IG is a zero, it means that the destination address is an individual address.
If the IG flag is a one, it means it's a group address, maybe a broadcast or a multicast.
Over in the source, you see I have the same two very important flags,
an IG flag and a UL flag.
Those are two very important bits of information that are considered flags, not fields.
Frame synchronization is another important service of layer two.
On my slide, the source, let's say it's a PC and the destination is a server
and they're connected by a one gigabit ethernet connection.
But the source PC is running on a certain clock signal
and the server is running on a different clock.
They have to somehow, the destination has to read that frame
and sync up in time with the way it was transmitted.
That is called frame synchronization.
This magic is done by seven octets of what's known as a field called preamble.
And it's a series of one zeros, one zeros, one zeros, seven bytes long.
That gives the destination host a chance to synchronize in time with the transmitted frame.
The start frame delimiter ends in one one.
You'll see it right there.
It's an eight bit field and it ends in one one.
When the destination host reads that one one,
it knows the next bit of information will be the destination MAC address
and it can start reading the frame.
Frame synchronization is different depending on the protocol.
802.11b has a preamble of 16 bytes and two bytes for the SFD.
And the total time that it gives it to sync is 192 microseconds.
This gets really tricky as we transmit faster wireless frames.
For example, 802.11ac has a preamble and it forces the frame synchronization
to happen 40 microseconds.
This is an actual photo of a spectrum analyzer as it looks at an 802.11n preamble.
You can see the synchronization pulses one zero, one zero, one zero
as it transmits at an RF frequency.
Let's continue looking at layer two services.
Remember, every protocol in layer two does not have all of these services.
Another layer two service is detection and recovery of transfer errors.
We also have the ability to do flow control
and that's avoiding the overloading of the destination host.
Then we have buffer management.
Whenever software programmers talk about buffers, think of memory.
And then the last is media control.
Carrier sense media access detection, collision detection.
That's in TAN100 Ethernet, which I hope you don't have.
Or carrier sense media access collision avoidance, which is used in 802.11 standards.
There are three variants to layer two error detection.
Number one, send parity so the frame is self-healing.
Two, send a checksum so if it's bad, it can be detected,
but no help is given on fixing the problem.
Three, send a checksum and if bad, request a retransmission.
Forward error correction or FEC is when the source of digital data
adds extra information known as parity to the data stream.
When the receiver detects, it can correct the error in real time as the data is being received.
FEC reduces the number of transmission errors.
You may not be aware of it, but CDs, DVDs, and Blu-ray discs,
including flash memory, all use FEC.
There are a couple techniques that are embedded into forward error correction FEC.
One is the technique that we've already mentioned, parity.
You can also use ECC, which most of us have seen that in our memory for servers.
Double parity is also used.
Hamming codes.
Reed-Solomon is another algorithm.
And then low density parity check.
That's used by 10 gig when it's transmitted over twisted pair.
Optical fiber transmission often uses FEC,
where you can see that the transmitter adds parity to the transmitted data.
Then the receiver can fix the error if there is on the fly.
At layer two, sometimes we can detect the error,
but we can offer no help on fixing the problem.
This brings us to frame check sequence.
This is a field that's added to the end of the frame.
There's a checksum value, usually a polynomial that's added,
and it allows you to determine whether the frame has been corrupted or not.
It's not perfect.
It's used by Ethernet, point-to-point protocol, frame relay, X.25, and HDLC.
Frame check sequence depends on higher layers,
like layer four, PCP, to fix the problem.
The adapter calculates the incoming frame checksum,
compares it with the value in the frame check sequence.
If they don't match, the frame is simply discarded.
Layer two is done.
It's not going to fix the problem.
Some layer two techniques in error detection not only detect an error,
but they request a retransmission.
Homeplug is a popular way of transmitting network over power lines,
and it uses a protocol that uses this technique.
Automatic repeat request, ARQ.
Look at the figure on the right.
You'll see host A, host B.
ARQ, when we send data from host A to B, you see that in the red line,
you'll notice that B will send an acknowledgement to A,
letting it know it received the frame OK.
Then when B sends data to A, A will then send an acknowledgement to B.
This is known as ARQ.
The ITUG.HN standard, networking over power lines, phone lines,
and coax cable, can send data up to two gigabits per second,
but it uses this technology.
Now, if either host A or B received a corrupted frame,
they would not send an ACK.
They would send a negative acknowledgement or a NACK.
Once that was received, a retransmission would occur.
Flow control at Layer 2 is another important service
that is used by some protocols at Layer 2,
and this is to prevent the destination from being overwhelmed with data.
In some protocols, a fast source and a slow destination can swamp a destination.
So there's a couple approaches to give flow control at Layer 2.
One method is feedback-based flow control,
where the receiver sends information back to the sender,
giving it permission to send more data.
This is used in 802.11, LTE cellular, DOCSIS, and 5G.
One of the solutions, elegant solutions, for solving this flow control problem,
especially on links that tend to be more noisy
or have greater interference, like wireless,
is put a sequence number into each frame.
The destination host will always know the sequence number that is next.
This protects against frame loss and protection against an acknowledgement loss.
Sending network across a satellite transmission
requires a different type of flow control called sliding windows.
When you have a long round-trip time,
typical satellite can have up to 500 millisecond round-trip propagation time.
So we want to send a lot of data and then an acknowledgement.
There are three popular sliding window technologies,
Go Back N, Selective Repeat, and Selective Reject.
And what it allows the satellite transmission to do is send lots of data
and occasionally send an acknowledgement.
Rate-based flow control is the most popular Layer 2 type of control,
where the protocol limits the rate of data a sender may transmit
without any feedback from the receiver.
So for example, let's say my laptop network card is a gig,
and I'm plugging it into a 10 gig port on a switch.
We know there'll be auto-negotiation pulses, as you see in the graphic,
and they will negotiate a speed that is agreeable to both the network card
and the switch port, which will be at one gig.
The rate of data is set so no one can be overwhelmed.
Inside many data link layer frames are critical fields that provide buffer management.
And remember, whenever we use the word buffer, think of memory management.
And this is very critical for more complex hosts like PCs, servers, Chromebooks, iPads,
Android, where you have multiple protocol stacks.
Let's take a look.
This is the architecture of Windows, and you can see I've got my hardware drivers here.
I've got my kernel. I've got my services.
This line right here would be kernel mode.
Everything above it would be user mode, and you see my apps up here.
Typically, a TCP IP stack would be probably somewhere in the kernel.
Let's say right here is my TCP IP stack.
Your data link layer is going to be straddling somewhere in the kernel
and somewhere in hardware drivers.
So let's say this is layer two, and I'm not the greatest artist,
but you can see this is kind of where it would be in a typical more complex operating system.
So I've got my layer two drawn in my kernel area between hardware drivers and kernel,
because that's about where layer two is.
So let's say I have a software module here written by Microsoft, and it handles ARP.
So this software is designed to handle all ARP packets that come in.
And then I have a chunk of software, and it's responsible for IP version four.
And then I have another set of module software, and I'm going to handle IP version six.
Layer two has to know what pointer, what area of memory to send the payload,
which could be IP four or an ARP packet or IP version six.
It has to know where to send that payload of data in the frame to the right portion of memory,
because each of these are going to have different memory areas.
That's what buffer management is about.
We've looked at the field called EtherType.
It's a two byte field, and we've looked at it, but we really haven't looked at what it does.
We know that if the value in the EtherType field is below 1536,
it describes the length of the payload.
If the value is 1536 and above, it indicates a type of protocol.
Well, that is a memory pointer.
That will allow layer two to communicate to layer three and say,
look, we've got an ARP packet in here.
It needs to go to this location in memory.
That will allow layer three to put that module in the right memory location.
This is called buffer management.
So whether layer two is handling an ARP packet or an IP version six
or a audio video transport protocol, it's got to know where in memory this needs to go.
There's software to execute it, and there's a rewrite space that it can put it in.
That's what the EtherType field is for.
It's a buffer management or a memory pointer.
Here is my PC's Ethernet network card.
And you can see that I've got a number of protocols loaded.
This is a multi-protocol stack.
I've got Internet Protocol Version 4.
I've got the Microsoft Network Adapter Multiplexer protocol.
I've got the Microsoft LLDP protocol driver.
When that layer two brings that data to the network layer,
it's got to point to memory so that it goes to the right software.
It goes to the right rewrite area in memory.
Media control is another important service of layer two.
Media control layer two is important.
We see at CSMA forward slash CD or carry a sense multiple access with collision detection.
That's the old Ethernet 10 100.
Hopefully you don't have that.
Notice we don't use that at all once we get into gigabit and above.
Then we have carrier sense multiple access carrier collision avoidance,
which is used in wireless, ZigBee, and for some of you, the old AppleTalk protocol.
Then with the HomePlug, we have the CSMA CARP or what they call collision avoidance
and resolution using priorities.
That is used with the HomePlug technology, network over power.
And then we have LTE and 5G also use media access control.
So this is important at layer two.
Some of our layer two protocols require reliability.
Reliability is where the destination notifies the source
whether or not the delivery of data was successful.
802.11, the wireless protocol, is a reliable layer two protocol.
It does that.
The MilSpec Standard 1553B is a well-known example of reliable protocols
used in the avionics data buses.
ATM, satellite transmission, and ZigBee all use reliability at layer two.
Reliability always costs bandwidth.
If you look at the frame below, this is a wireless frame,
and you'll see the data, the green data slot.
And then at the very end on the right hand side, you'll see orange overhead marker.
And that shows you where the acknowledgement packet
has to be sent back to the wireless transmitter receiver.
This costs you bandwidth.
But in the case of many of these protocols, they need that reliability.
You cannot study layer two without being introduced
to the concept of sub layers in a protocol.
Basically, this is all about helping programmers.
We've all seen the diagrams of layer two divided in half into these sub layers.
The upper layer, which is 802.2, is a logical link control.
It has detection, recovery of transfer errors, those services we've talked about,
flow control, and buffer management.
And then at the lower level, the MAC, where we have frame synchronization,
addressing, and then media control.
This was done primarily to help programmers who write the software at this level
to abstract one layer from the other.
It was just an aid to help them do their job.
If you study this diagram, you'll see that it focuses primarily at the data link layer.
You can see the complexity there.
This is a 10 gig connection that supports a variety of different types of media.
And you could see the problem that a programmer would have
if he didn't have some kind of abstraction from one layer to the other.
The data link layer is complex.
Three sub layers?
Come on, Mr. V, isn't two enough?
Actually, no.
As you get into things like LTE, cellular,
you'll see that we have actually three layers at layer two protocol.
So we've got packet discovery convergence protocol,
the radio link control, and the media access control.
You can just look at this diagram and see the complexity facing LTE engineers.
Here's a quick look at the architecture of Windows.
And you can see about where the data link layer is.
You can see 802.3, WAN 1394, which is FireWire, which is a network protocol.
Loopback, IP tunnels, and you can see about where it's at.
How do we understand layer two with a PC?
Generally, the network card, the physical network card, is considered layer one.
The network card driver is considered layer two.
Now, that's not a hard, fast rule.
Most people consider that a good dividing line.
I wonder, Mr. Vanderpool, can you impact layer two on your PC?
Can you actually do anything in there?
Well, of course you can.
You go to your network card driver and go to advanced.
You'll see this list of things.
Many of those items are actually layer two functionality that you can tweak,
turn on, turn off.
So yes, you can.
Now, this slide shows you 802.3 wired.
And you can see, again, I'm going to my network card adapter,
looking at the software properties.
And again, you can see under the advanced tab,
a variety of things that you can do at layer two.
If we're talking about IoT, you can see this diagram showing layer two
going into ZigBee, Bluetooth 4.0, NFC, Wi-Fi, and then, of course, wire cellular.