Network Protocols

Him Her

VIP Member
VIP Member
Joined
Dec 23, 2011
Messages
8,145
Reaction score
6,435
Location
North Yorkshire
Introduction

Without some form of protocol network traffic is restricted to the Local Area Network (LAN) but talk of protocols usually makes people's eyes glaze over! However, they are not so hard to understand if you just think in terms of the postal system. If you want to deliver a letter to someone nearby you can write it and deliver by hand – this is a bit like the LAN. If you want to deliver it to someone further away then you need to pass it to a delivery agent and provide them with the delivery address.

So, you insert the letter into an envelope (packet), add the delivery address and post it. The route it takes is down to the delivery agent but ultimately it arrives at a location local to the recipient and it is delivered by hand for the final part of its journey. In essence, that's how a network protocol works.

Over the decades many network protocols have come and gone, some remain in isolation but IP has become accepted as the protocol of choice and, for most people, it's all they will ever meet.

Internet Protocol (IP)

In effect, IP is a suite of protocols as well as the packet definition so, even though many talk about TCP/IP, TCP is actually part of the IP protocol suite. It's probably expressed this way because IP and TCP were the first elements defined. IP owes much of its existence to DARPA (Defense Advanced Research Projects Agency) in the US in the early 1970s and it's as well to remember this although there has been much development since. Some elements of IP exist relatively unchanged and are apparent anomalies unless we remember that hardware in the 1970s was much simpler.

The basic premise of IP is that the packet would have the same format irrespective of its function and that packet would be inserted into the payload of a lower level frame (in this case Ethernet). This process is known as encapsulation.

So, the IP packet is encapsulated in the Ethernet frame and, in turn, the IP packet encapsulates the higher-level protocols such as TCP. On arrival at its destination the packet is extracted from the Ethernet frame and passed to the next layer in the protocol stack (think OSI 7-layer model), very similar to opening the envelope of a letter.

The basic Ethernet frame looks as below:

Ethernet-Frame.jpg

Note that I've omitted some elements for clarity. The area marked 'Data' (also known as the 'payload') is where the IP packet would be placed thus encapsulating it within the Ethernet frame. The reason this is done is so that lower level processes do not need to know what is being transmitted so need no design changes.

The basic IP packet looks as below:

Ethernet-Frame-IP.jpg

The bottom section is the IP packet and the diagram shows encapsulation within the Ethernet frame. This encapsulation occurs with each successive layer i.e. as a higher level of the 7-layer model comes into play its information is encapsulated in the data section of the packet immediately below it.

The TCP packet is encapsulated within IP which is encapsulated within the Ethernet frame as below:

Ethernet-Frame-IP-TCP.jpg

The encapsulation process is a bit like putting letters in envelopes, the TCP packet is your letter, the IP packet is the envelope and the Ethernet frame is the postman's sack! So, as we move down the 7-layer model we add envelopes, when the packet arrives at the destination we open the envelopes at each successive layer ultimately getting back to the original data.

Reliable vs Unreliable

Some protocols are described as 'reliable', all this means is that delivery is checked (a bit like 'signed for' at the Post Office) while some are 'unreliable' i.e. no checking is done. IP is unreliable while TCP (Transmission Control Protocol) is reliable hence it is used for more critical applications such as web-browsers and e-mail. TCP guarantees delivery and data integrity.

UDP (User Datagram Protocol) is unreliable and used for less critical applications such as DHCP (Dynamic Host Configuration Protocol) and NTP (Network Time Protocol). UDP guarantees data integrity but not delivery. Note that protocols such as DHCP and FTP are not part of the IP suite but are application protocols that operate above the IP suite which is largely confined to Layer III of the OSI 7-layer model.

ICMP (Internet Control Message Protocol) is different as it is not typically used to send data between systems but for testing and diagnostic purposes. For example, the 'ping' utility uses ICMP.

IP layers vs OSI 7-layer model

The IP suite was designed before the OSI 7-layer model came into existence and only makes reference to four layers but the whole stack corresponds to the OSI 7-layer model as below:

osi-vs-ip.jpeg

Getting off the LAN

One of the key things provided by the IP suite is the ability to route to other networks. Without this capability the Internet would be a very boring place as much of the technology we have come to expect would simply not work.

The key to understanding this is in understanding IP addressing.

IP Addressing

Early addressing schemes presumed that the world would have a small number of very large organisations, a greater number of medium-sized organisations and many small organisations and IP addresses reflect that even today. Many people still discuss 'classes' of IP addresses even though they have been largely redundant for decades. The basic IP address consists of 4 octets (bytes) separated by dots such as 192.168.0.1 with each octet having a value between 0 and 255. This allows for a maximum number of IP addresses of 255*255*255*255 (around 4.2 billion).

The IP address works in conjunction with the subnet mask which shows which part of the IP address is for the network and which part is for the device on that network.

All this really means is that for a device to be on the same network as its neighbours it must have the same network address but a DIFFERENT device (or host) address.

As an example:

When you get a router from your ISP it will usually be pre-configured and its assigned IP address will be something like 192.168.0.1 with a subnet mask of 255.255.255.0 which means that the network part is 192.168.0 (the first 3 octets) while the last octet is used for the host number. Think of it like this:

192.168.000.001
255.255.255.000

Although you wouldn't actually put the extra zeroes in either the IP address or the subnet mask it makes it easier to see which part of the subnet mask relates to which part of the IP address. A 255 in the subnet mask means the equivalent octet in the IP address relates to the network whereas a 0 relates to the host.

In this example, hosts can be given addresses between 192.168.0.1 to 192.168.0.254 as the first and last address have special meaning. 192.168.0.0 is the cable address while 192.168.0.255 is the broadcast address (used to send packets to ALL devices rather than just one). Neither 192.168.0.0 or 192.168.0l.255 should be assigned to a device.

With most devices this is all done for you by DHCP which hands out IP addresses on the network but should you need to manually assign an address for, say, a media server you only need to follow these rules. DHCP is usually configured such that there are some free addresses available for use in this way – the router configuration will show this.

Getting off the network

The final part of the picture is the method used to get off the network and onto another such as the Internet. This is done by assigning a default router address to each of the devices – in our example above this would be 192.168.0.1 but how does the system know to send it there?

Again, the subnet mask comes into play as we can use it to compare two network addresses. So, if we have our own network device:

192.168.000.002
255.255.255.000

And we want to send to a device with IP address 192.168.1.2 then the subnet mask tells us to ignore the last octet as its a zero. We're only interested in the first three octets for the network number. Comparing 192.168.0 and 192.168.1 shows they are clearly two different networks and the device now knows to send the packet to the default router instead of trying to find it on the local network.

The diagram below shows two networks connected by a router. Notice that the router has two IP addresses, one on your network and one on the destination network because, in effect, there are two routes one from your network to the destination and one back to you.

Routing-Example.resized.jpg

In essence, this is the foundation of the Internet, a series of networks all connected together by routers.
 
Last edited:
Back
Top