- [Craig] In this video, we explore the concept of layers in networking.
(uplifting piano jingle)
Networking is a very complex operation.
There's lots of different things to consider.
For example, the different applications and tasks that we might perform.
For example, web pages, emails and file transfer.
We have to think about encryption and security of data
and authenticating user access to the data over a wide or local area network.
We have to connect to those remote servers and maintain those open connections whilst those servers are load-balancing.
We have peer-to-peer and client-server methods.
We can split data into smaller packets and frames.
We can sequence those packets.
We have to send the packets between routers on a wide area network and send frames between devices on a local area network.
We have to error-check the packets and frames on arrival and request the data be resent if necessary.
We might be using different types of cable like fibre, twisted pair and coaxial.
And we might be using wireless with frequency and channels,
and we might be transmitting data in one direction or both directions one at a time
or both directions simultaneously, which is known as duplex.
The point I'm trying to make here is that transferring data between two points on a wide area network,
or indeed on a local area network, is a very complex operation
and we need a way of simplifying it.
The concept of layers is about taking a very difficult problem and dividing it down into smaller sub-problems.
In the case of networking, this reduces the complexity of the problem into manageable sub-problems.
It means that devices can be manufactured to operate at a particular layer
and products from different vendors will simply work together quite happily.
Here, we have a simple abstracted example of
how we might send a web page over the internet to a client device once it's been requested.
There's a number of tasks which need to be performed to successfully get the web page transferred
such as sending the web page itself using HTTPS,
using TCP to handle errors at each stage,
using IP to correctly route the traffic from one node to another,
constructing the appropriate MAC frames and sending those out correctly over,
say, fibre optic connections as pulses of light.
All of these tasks need to work for our web page to arrive correctly.
Software can be written to handle each task specifically
without knowing about other software in the layers higher or lower.
For example, layer two doesn't care or even need to know about what's going on in the above two layers.
As long as it receives the data in the correct format,
all it has to worry about is dealing with routing the traffic using IP.
Once it's done this, it can pass the data down to layer one, which will handle the next stage.
Now, the rest of this video is beyond the GCSE specification, so you don't need to take notes.
However, it will really tie a lot of the concepts together that we've been covering in the last few videos
and provide an extra level of extra depth and detail, which leads nicely into A Level.
Arguably, one of the most important protocols in use today is the TCP-IP protocol stack.
Now technically, these are two protocols,
but they're so commonly put together that we just refer to them as TCP-IP,
and that's the transmission control protocol and the internet protocol.
As already mentioned, this is one of the most important protocol stacks in use today.
Any device that runs the TCP-IP protocol stack can communication and transfer data
across a network and out across the internet.
It's a set of networking protocols consisting of four distinct layers that all work together.
All incoming and outgoing data packets pass up and down through the various layers when you communicate on the network.
And so, we're going to go through these layers in a bit more detail,
but very abstractly first of all,
here, you can see we have a source computer that needs to communicate with a destination computer.
On the way out, it travels down through the TCP-IP stack with the various rules at each layer being applied one at a time.
It reaches the link layer, or layer one, and it gets sent on to the first router
where it moves up to the network layer and down again onto any other routers that are required on the way.
When it finally reaches the destination computer, it travels back up the protocol stack.
So, we're going to take a detailed look now at the TCP-IP stack and the four layers it uses.
We're going to pass the following message shown on the screen down through the layers of the TCP-IP stack
to see what happens to it at each stage before it gets sent out onto the network.
So, imagine this message was being sent out onto the network.
It first has to travel down the TCP-IP stack.
The first layer it has to go through is the application layer.
As the name suggests, this layer uses an appropriate protocol relating to whichever application is being used to transmit the data.
So, for our example, we're going to assume this is a web browser, so the protocol could be HTTP or HTTPS.
You can see, there's our message plus a header which, in real terms, will be additional 1s and 0s added to the packet of data
so we know what application is needed to process the data once it reaches the other end.
We then pass this down to the transport layer.
Now, the transport layer is the layer which is using the TCP part.
It's responsible for establishing an end-to-end connection.
Once the connection is made, it splits the data to be transmitted into packets.
Now, this message is too short, so it probably wouldn't really be split into packets
but we're going to do it anyway for this example,
but typically, a data transmission would be much larger and, therefore, it would be split into a number of packets.
We now need to add to each packet the number of the packet, e.g., packet one,
and also the total number of packets, e.g., packet one of three, and also a port number to the packet.
We can see these have all been split up now and this additional data is kind of wrapped around the original data.
Think of it like a parcel.
This extra information has been wrapped around the information which was already wrapped around the data from the application layer.
So, why do we need to number the packets?
Well, this comes to down to how data packets travel across the internet.
There's a good chance that these packets may arrive at the destination computer out of order,
and the sequencing numbers added by the transport layer allows the receiving computer to reassemble the packets in the correct sequence.
Now we're done, we get passed down to the network layer.
The network layer, sometimes referred to as the internet layer, uses the IP part of the TCP-IP protocol.
It adds to each packet a source IP address and a destination IP address,
and we can see here that our data we got from the transport layer has been wrapped up again with this additional information.
Now, all routers operate on this layer.
The destination IP address gets added to a port and together, they create a socket.
Together, they let us know what device the packet is going to, IP, and what application on that device needs the packet, port.
Finally, we pass down to the link layer, sometimes called the physical layer.
It's the lowest layer of the model and this represents the actual physical connection between the various nodes.
This is responsible for adding the MAC address and again, it adds a source MAC address and a destination MAC address,
and again, it will wrap this information around everything else.
These packets can now disappear off.
So, we've reached the bottom of this link layer and this packet would then disappear off and would head towards the first router.
The router will strip off the outer layer of the packet and pass it up to the network layer.
The destination IP is still set to the location of the final computer,
but this current router at this point will need to decide where this packet needs to go.
Well, it needs to go to this router, so it adds its own MAC address and destination address, wraps it back up and passes it on.
When it eventually arrives at the destination computer, this packet moves up through the destination computer's TCP-IP stack
and each layer is removed one at a time as it gets passed through until eventually, the destination computer sees the original message.
(uplifting piano jingle)