Structure of the Internet: TCP IP protocol stack

From Wikibooks, open books for an open world
Jump to navigation Jump to search

UNIT 2 - ⇑ Structure of the Internet ⇑

← Protocols TCP IP protocol stack


MAC Address[edit | edit source]

MAC Address - a unique identifier assigned to network connections, embedded into every Network Interface Card during production

IP addresses change, for example if you connect your laptop to the internet at home you get one IP address. If you were then to take it around a friends and connect there, you would be given another IP address. MAC addresses are unique to the device they are given to and every network interface has a MAC address, including mobile phones, game consoles and wireless cards. This is important when you consider that a computer can have more than one network interface. For example with a laptop you might have a cat-6 network card and a wireless card, one handling BitTorrent and the other web browsing. When you receive a message, which network interface should it be sent to? The MAC address would mean that messages can be directed to a particular network interface, namely the wireless card or the cat-6 card. In a moment you will see how we use MAC addresses with the TCP/IP stack.

Extension: Access your MAC Address
  • In order to view your device's MAC address in a Windows OS, go to Control panel >> Network and Sharing Center >> Click on your connection (This can be LAN or Ethernet etc...)
  • Click on the "Details" button and you will find a label called "Physical Address". This is your MAC Address
Each networkable device has its own unique MAC address

TCP/IP stack[edit | edit source]

The most common protocol on the internet is the Transmission Control Protocol/Internet Protocol (TCP/IP). To send data over a TCP/IP network requires four steps or layers:

Layer Name Description
Application Encodes the data being sent, provides applications with access to the use of network services
Transport Splits the data into manageable chunks, adds port number information
Internet Adds IP addresses stating where the data is from and where it is going
Link Adds MAC address information to specify which hardware device the message came from, and which hardware device the message is going to
Successive encapsulation (wrapping) of application data descending through the protocol stack before transmission on the local network link

To show you how the TCP/IP stack works we going to use the following data as an example:

Matt, Mark, Luke, John

Application[edit | edit source]

The application layer makes sure that the data is sent in a format that will be understandable by the recipient. This will mean formatting data to be sent in a standard way applicable to that application, for example HTTP, FTP etc. In this case we are going to wrap each piece of data in XML tags.

<gospel>Matt</gospel><gospel>Mark</gospel><gospel>Luke</gospel><gospel>John</gospel>

Transport[edit | edit source]

The transport layer looks at the data to be sent and splits it into chunks that can fit into data packets. It then attaches a number to each, specifying that packet's order, this allows the recipient to place the data back together correctly at the other end. To each packet it then attaches a port number dependent on the application being used. For the example we'll send data to port 60:

  • Splits the data into chunks and adds order number
  • Adds port numbers
Transport Header Data
:60 | 1/4 <gospel>Matt</gospel>
:60 | 2/4 <gospel>Mark</gospel>
:60 | 3/4 <gospel>Luke</gospel>
:60 | 4/4 <gospel>John</gospel>

Network/Internet[edit | edit source]

The network layer attaches the IP address of the sender, so that the recipient will know who sent it and who to send a confirmation message to. It must also attach the IP address of the host that it is sending the data to so it doesn't get lost! In this case we are sending to 102.231.4.189 and sending from 98.1.232.99. Combined with the port number this creates a socket that data is being sent from and a socket that data is being sent to, namely 102.231.4.189:60

  • Attaches sender IP address
  • Attaches destination IP address to create a socket
Network Header Transport Header Data
102.231.4.189
98.1.232.99
:60 | 1/4 <gospel>Matt</gospel>
102.231.4.189
98.1.232.99
:60 | 2/4 <gospel>Mark</gospel>
102.231.4.189
98.1.232.99
:60 | 3/4 <gospel>Luke</gospel>
102.231.4.189
98.1.232.99
:60 | 4/4 <gospel>John</gospel>

Link[edit | edit source]

Finally the link layer attaches the MAC address of the sender and the recipient, allowing the packets to be directed to a specific network interface on the IP Address host machine. In this case the sender is using a wireless card with MAC address: 00-17-4F-08-5D-69 and the destination MAC address is: 11-22-33-44-55

  • Attaches sender MAC address
  • Attaches destination MAC address
Link Header Network Header Transport Header Data
11-22-33-44-55
00-17-4F-08-5D-69
102.231.4.189
98.1.232.99
:60 | 1/4 <gospel>Matt</gospel>
11-22-33-44-55
00-17-4F-08-5D-69
102.231.4.189
98.1.232.99
:60 | 2/4 <gospel>Mark</gospel>
11-22-33-44-55
00-17-4F-08-5D-69
102.231.4.189
98.1.232.99
:60 | 3/4 <gospel>Luke</gospel>
11-22-33-44-55
00-17-4F-08-5D-69
102.231.4.189
98.1.232.99
:60 | 4/4 <gospel>John</gospel>

These four packets can then be sent across the internet holding enough information for them to:

  1. reach their destination (socket from the Network and Transport Layers)
  2. find the correct network interface (MAC address from the Link Layer)
  3. find the correct service(Port number from the Transport Layer)
  4. be reassembled in the correct order (Order information from the Transport Layer)
  5. deliver the intended message (data from the Application Layer)
Extension: UDP

TCP/IP does a great job of ensuring that the data you request is sent correctly and the data you send is received. However, as you have seen, sometimes data can get lost on the internet or packets can arrive in an order differing to the one you sent them in. With something like a computer game or telecommunications you can't wait for a slow packet to find its way across the internet. This would result in voice messages slowing down and computer games becoming unresponsive. There is another protocol called UDP that doesn't ask for a confirmation that data packets have been received. This protocol is used heavily in networked computer games and voice over IP, as losing a packet here and there won't impact too badly on the overall game experience or voice conversation. When you play computer games, you might see something that says "lost packets = xyz" or when having a web meeting the quality of voice or video might briefly degrade. This is packet loss in action and a result of using UDP.

Exercise TCP/IP Stack

Name and describe the four levels of the TCP/IP stack:

Answer:

 

Layer Name Description
Application Encodes the data being sent
Transport Splits the data into manageable chunks, adds port number information
Internet Adds IP addresses stating where the data is from and where it is going
Link Adds MAC address information to specify which hardware device the message came from, and which hardware device the message is going to

Combined, the IP address and Port Number make up a what?

Answer:

Socket

What is the MAC Address for in the TCP/IP stack?

Answer:

A MAC address is a unique identifier assigned to a network device. It is used by the Link layer to direct messages to a particular network interface at the designated IP address

Show the steps involved in sending the following data:

  • data = Hello (this will fit in one packet)
  • from IP = 12.32.72.2 | MAC = 43.65.FF.23
  • to IP = 98.125.43.88 | Port = 80 | MAC = A0.3D.EF.00

Answer:

  • Application
  • "Hello"
  • Transport
    • :80
    • 1/1
    • "Hello"
  • Internet
    • To=98.125.43.88
    • From=12.32.72.2
    • :80
    • 1/1
    • "Hello"
  • Link
    • From MAC = 43.65.FF.23
    • To MAC = A0.3D.EF.00
    • To=98.125.43.88
    • From=12.32.72.2
    • :80
    • 1/1
    • "Hello"