s5cs52 the tcpip protocol stack
This page is mainly about s5cs52 the tcpip protocol stack

With so many computers accessing the Internet, there have to be rules for communication. The TCP/IP protocol stack is, well, a stack of such protocols which all networked computers must understand and comply with, or else.
We are learning ...
About the roles of the 4 layers of the TCP/IP Stack
So that we can ...
Describe the role of the 4 layers in the TCP/IP stack
- Application
- Transport
- Network
- Link
Application Layer protocols
- File Transfer Protocol (FTP)
- Hypertext Transfer Protocol (HTTP)
- Post Office Protocol (POP3)
- Internet Mail Access Protocol (IMAP)
- Simple Mail Transfer Protocol (SMTP)
- Secure Shell (SSH)
Transport Layer Protocol
- The role of sockets (well known server ports, role of client ports, NAT and port forwarding)
- TCP
- DHCP
- UDP
Network Layer Protocols
- Standards (IPv4 and IPv6)
- Use of subnet masks
- Routable and non-routable IP addresses
Link Layer Protocols
- The role of MAC addresses


Activity 1
The stack, the whole stack and nothing but the stack
The TCP/IP stack defines standard communication protocols. A protocol, in this instance, is a set of rules governing data communication. A protocol defines ...
What should be communicated ... SYNTAX
How it is communicated ... SEMANTICS
When it is communicated ... TIMING
Ready?
Ready for the most complicated diagram (I've) ever drawn? I'd suggest you print off a big copy of this (unless your teacher is kind enough to do it for you!)

Click to enlarge (and print a BIG copy!)
The TCP/IP stack is a collection of software which encapsulate data ready for transmission and de-encapsulate data ready for consumption by application software. Your teacher will talk you through the structure of the stack and how it is used in practice to familiarise you with it's holistic operation.

You'll notice that apart from the TCP/IP stack, I've also included it's big brother, the OSI model, or, to give it it's full name the International Standardisation Organisation Open System Interconnectivity model.

True story!
Briefly, the function of the different layers in the OSI model are ...
Application Layer
Deals with the type of communication, i.e. email, web, file transfer. The protocols are those used by the application, e.g. HTTP, FTP, SMTP. Allows application access to network resources. Application gateways work in this layer.
Presentation Layer
Controls encryption / decryption, compression, data conversion and formatting. Converts raw data into suitable form for application to use. A 'presentation header' added to the packet.
Session Layer
Controls the start and stop of sessions and maintains order of packets. Disassembles and reassembles message in a suitable form for the next layer. A 'session header' is added to the packet.
Transport Layer
Ensures delivery of entire file or message. Governs how the data is delivered and splits data into packets. Error recovery is also performed here. A 'transport header' is added to the packet. Transport gateways work in this layer.
Network Layer / Internet Layer
Routes data to different networks based on network address. Provides IP routing information and sequencing control. A 'network header' is added. Routers work in this layer. Note that this layer should be called the Internet or IP layer - I got it wrong :(
Data Link Layer / Link Layer
Transmits packets from node to node based on station (MAC) address. Provides suitable error recovery and flow control. Maps MAC to IP addresses. A 'link header and trailer' is added to the packet. Switches and bridges work in this layer.
Physical Layer
Controls physical electrical signals and cabling. Decides how to send the bits along the channel / medium, how many volts to use, how many nanoseconds between each pulse etc. Repeaters and hubs work in this layer.
The functions of the Application, Presentation and Session layer are subsumed into the TCP/IP Application layer as all functions provided are not necessarily required. Nobody differentiates the Application, Presentation and Session layers any more.


Task 1.1 Summary
In your notebooks / folders : Make sure you have summarised the functions of the different layers of the TCP/IP stack in your notebooks / folders. Remember you don't need to know about the ISO OSI model but you should use the descriptors of the functions of the Application, Presentation and Session layers to help you describe what the TCP/IP Application layer does. Also, make a massive note of the different networking hardware devices that work in each layer. Can you think why they do?
OUTCOME : Summary of the functions of the 5 layers of the TCP/IP Stack


Ask your teacher if you can play!

Activity 2
The Application layer
The application layer allows an application process running on one end-host to communicate directly with an application process running on another, end-to-end fashion.
In the application layer, the chunks of data are called messages.

Task 2.1 Common application layer protocols
Consider the following protocols. I bet that you've heard of most of them since they are intrinsically tied up with end user application operation.
File Transfer Protocol (FTP)
Hypertext Transfer Protocol (HTTP)
Post Office Protocol (POP3)
Internet Mail Access Protocol (IMAP)
Simple Mail Transfer Protocol (SMTP)
Secure Shell (SSH)
Dynamic Host Configuration Protocol (DHCP)
Your challenge (should you choose to accept it) is to find out some information about each protocol. In it's simplest form ...
What is it used for
The type of application that uses it
How it actually operates
OUTCOME : Descriptions of application layer protocols.


Activity 3
The Transport layer
The transport layer on each end-host is responsible for establishment of a reliable (connection-oriented) 'byte stream channel' or 'pipe' between the end-hosts. The transport layer is also responsible for breaking up the messages into segments and reassembling them at the other end.
At the sending host, the application layer pushes the message through special doors (hence the doors in 'the diagram') called sockets into the transport layer. At the receiving host, the segments are pushed through different sockets into the application layer. A socket is a combination of an IP address and a Port number.
Socket = IP Address : Port Number
The port number is a 16 bit integer (0 - 65535) which refers to the virtual 'door' behind which the application is listening for traffic. The following diagram shows three typical server port numbers ...

The concept of ports, this is a typical portion of the server side port number range
As part of the initial connection establishment routine, suitable client and server ports / sockets are chosen (called binding). The ports on the client will likely vary each time a socket is connected. The client ports are sometimes termed ephemeral ports (see Wikipedia) because they only exist for a short time. For instance ...

Here the client socket is
192.168.1.100:52010
and the server socket is 212.57.242.117:80
. Commonly, client / ephemeral port numbers should be in the range 49152 to 65535. According to IANA ...System ports use the range 0 - 1023
User ports / registered ports use the range 1024 - 49151
Dynamic / private / ephemeral ports use the range 49152 - 65535


Task 3.1 Common transport layer protocols
STAGE ONE : TCP vs UDP
The two most common transport layer protocols are the connection-oriented Transmission Control Protocol (TCP) and the connectionless User Datagram Protocol (UDP). Download TCP and UDP from the lesson resources and summarise it using a mind map or equivalent presentation.
STAGE TWO : Common Port Numbers
Either use this list of common port numbers (use the search facility) or just plain old Wikipedia to search for the common server port numbers for the following applications. Remember that the client ports will be different every time (and in the range 49152 to 65535).
Hypertext Transfer Protocol (HTTP) traffic
Hypertext Transfer Protocol Secure (HTTPS) traffic
Post Office Protocol V3 (POP3) email traffic
Internet Message Access Protocol (IMAP) email traffic
Simple Mail Transfer Protocol (SMTP) email traffic
File Transfer Protocol (FTP) traffic
Secure Shell (SSH) traffic
Domain Name System (DNS) queries
Voice Over Internet Protocol (VOIP) traffic
Trivial File Transfer Protocol (TFTP)
Dynamic Host Configuration Protocol (DHCP)
OUTCOME : Comparison of TCP and UDP and a list of common port numbers


Activity 4
The Network layer / Internet Layer
The network layer provides the 'delivery vehicle' for the segments generated by the transport layer. The so called datagrams are addressed with the source and destination Internet Protocol (IP) addresses before they are sent on their way across the Internet. Bye!
The network layer provides no guarantee of delivery, leaving that job up to the transport layer.

Task 4.1 IP Addresses
If you think I'm going to ask you to do any more about IP addresses, you're sadly mistaken. Take a look back at the previous topic, 'The Grid', if you want to know more.
OUTCOME : Nowt, 'cause you already know everything!


Activity 5
The Link layer
The link layer provides an interface with the physical hardware protocols being used to actually transmit the bitstreams across the network. The link layer uses Media Access Control (MAC) hardware addresses to 'hop' packets from one networking device to another, from source IP to destination IP.

MAC addresses are issued to manufacturers by the IEEE Standards Association and, as the lady says, they are unique. The 22 bit OUI provides (2 bits reserved) provides potentially 4194304 manufacture codes and the 24 bits for the manufacture specific code provides 16777216 devices per manufacturer code. That should be enough...

Simply run getmac from the Windows command line

Task 5.1 Look it up!
If you can't find your own MAC addresses using the getmac command, look up mine at the fantastic MAC Vendor Lookup website. You'll notice that the lookup happens when you have typed in the first three octets (6 hex digits).
In your notebooks / folders : Take a screenshot of the manufacturer codes and record them alongside the MAC.
OUTCOME: MAC Addresses and vendors

So, before we lose sight of the reason we are here, let's finally look at how MAC addresses are used during transmission of our data packets across the Internet. Remember the structure of the Ethernet frame we met in the last topic? The only headers we are interested in are the network (Internet) layer header which contains the source and destination IP addresses and the link layer header which contains the MAC addresses of the current networking device and the next one.
Task 5.2 Hoppity Hop
Look carefully at the following diagram which shows a stylised portion of a network. An IP datagram is to be sent from Host A to Host B through two intermediate networking devices.

The source and destination IP addresses are given at the network edges and the hardware / MAC addresses are given for all four devices. An IP datagram will perform three 'hops' on it's journey from A to B. Your job is to work out the how the contents of the network layer header and the link layer header change in our packet during each hop.
In your notebooks / folders : Using this example explain how the contents of the packet change during its journey.
OUTCOME : Hoppity Hop!

Extension Activities
How about these?List of commonly accepted port numbers from IANA
Internet Engineering Task Force RFC2131 defining the operation of DHCP.
We haven't discussed the physical layer at all in this section, mainly because it's more relevant to electrical engineering than to computer science. One of the most common protocols in this layer is Ethernet. We learnt about Ethernet in another unit, It's a connected world, in the section before Task 2.8 - have a look over it if you want. No pressure.
What's next?
Before you hand your book in for checking, make sure you have completed all the work required and that your book is tidy and organised. Your book will be checked to make sure it is complete and you will be given a spicy grade for effort.
Before you hand your book in for checking, make sure you have completed all the work required and that your book is tidy and organised. Your book will be checked to make sure it is complete and you will be given a spicy grade for effort.
END OF TOPIC ASSESSMENT
Last modified: February 14th, 2024