Monday, October 3, 2011

Layers of the Internet - Part 3

Before I start I would like to make a minor classification.
The "Layers" to which I am referring are the Internet Protocol layers, as specified in RFC 1122. I feel this model is more appropriate to the topics that I cover in this blog.


For those of you that wish to delve further into Networking as a subject, please refer to the Open Systems Interconnection (OSI) model. This model is the one that you would study in a networking degree, however it is slightly too specific for the purposes of this blog.




Layer 3 - The Transport Layer
In the previous two parts of this section of the blog, we looked at Layer 1 - The Link Layer and Layer 2 - The Internet Layer. In those layers, we say that each device was physically connected to all others, but with a bit of technology, we could divide up that huge network into smaller little sections.

I'll admit, it's difficult to visualise the Transport Layer. Here's some model trains.


As we have now connected on Layers 1 and 2, we can assume that our two devices are talking to each other. At this point it doesn't matter how that happens, or how many switches the packets have gone through in order to get from A to B. The tunnel through the Internet has been made, and for all intents and purposes, it isn't broken until the connection is shut off.

Layer 3 tells us two things; how a packet will move through a network, and where it will go when it gets there. In order to understand this we will examine two of the main Layer 3 Protocols, Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). And yes, if you noticed that the "TCP" looks very similar to the "TCP" in "TCP/IP", you'd be correct. Since TDP is the most common Layer 3 Protocol, and IP is the most common Layer 2 protocol, people refer to this model as the TCP/IP suite of protocols. However, due to the complexity of the protocol, I will start off with the UDP.

User Datagram Protocol
Take a moment to think about how many different network-enabled programs you are running now. On my machine I have two browsers with a few tabs in each, Skype, two email clients, a couple of automatic software updaters.... the list goes on. Now think about a lonely packet headed my way. It has the MAC address (from Layer 1) so it knows where my computer is. It has my IP address (from Layer 2) so it knows how to find me on the network. But once that packet finds its way into my wireless adaptor, where does it go? Is it a part of a webpage, or a message from a friend via Skype, or an email?

Both the UDP and TCP use a number, called a "Port," to direct a packet to the program that it needs to arrive at. Your network adaptor reads the Port number and forwards the data to the appropriate program for processing.

A UDP packet contains a bit of information that identifies it as a UDP packet and a Port number. That's about it. The advantage of this is that you have a smaller packet, which means faster transmission times. We'll look into this a bit later.

Transmission Control Protocol
Whilst a UDP packet basically only has the Port number, a TCP packet contains a lot of additional information. TCP packets can contain information relating to tracking and delivery protocols. For example, a TDP packet could identify that it was the 15th packet in a sequence, and that the receiving device should send notification of receipt.

This information can be used to make sure that packets that have been lost due to network errors can be re-requested and re-transmitted. Packets that take too long can killed off. Devices can send packets to each other to check the speed and path of the transmission.

All of this extra information makes the packets bigger, and hence slightly slower. However, in any non-real-time application this extra transmission time doesn't make much difference. Since very few transmissions actually require real-time transmission, the more Robust TCP is more common than UDP.

The main place we see UDP packets in the Arts industry is in audio/video transmissions, like Dante or AVB.  UDP also requires less programming, and thus it is more common in smaller applications, so you may come across UDP systems in some control software.

"Layer 3 Switches"
Normally a switch will read the Layer 2 information (the IP Address) in order to find out where to send the packet. As we saw in the Layer 2 article, this is used to prevent every device receiving every packet on the network. If a switch only does this, then it is known as a Layer 2 switch.

However, some switches can be programmed to read the Layer 3 information. Switches can read the TCP information to adjust flow control (e.g. if the switch is over capacity, it can request the sending device to slow down the transmission rates). This can also allow for the ability for a switch to send more important packets before standard packets (e.g. Telephone or real-time audio is transmitted before a webpage).


No comments:

Post a Comment