Internet Protocols

Aryan DhirhiAryan Dhirhi
19 min read

Protocols explain, Need of protocols in computer, computer network, OSI, explain all layers of OSI, Detail explaination of Network layer.

Introduction

If I have an idea about a software or a website and I build it and after building that website I saw the website is really amazing and now I want to show my work to other peoples such that other peoples can use my website then what will I do to make my website publicaly accessable. Here the concept of computer network comes with the concept of connecting many computers togather by guided medium (wires) or through unguided medium (wirelessly). Hi I’m Aryan and I’m going to explain all about the computer network and the life cycle of a data packet, in this article I’m going to cover all about the protocols, Need of protocols for data transfer in internet, I will discuss about the OSI model for the clear understanding of computer network and then we will deep dive into Network layer of OSI Model where we will understand all about the Internet Protocols. In this articles After reading this article you will have no any doubt about how the data packets travel accross the internet, and you will be able to understand the basic core foundation of internet.

What is Protocols

Some set of rules are known as protocol, let try to understand the meaning of protocol via some real world examples, let suppose you have to solve any mathematical problem then there are many rules in maths which helps us to solve any kind of problem then I would like so say “There are many protocols in maths which helps me to solve problem“, Lets take another example of traffic rules, while driving we have to follow some rules also known as traffic rules like which side of road we have to drive, where we have to slow down the vehicals, we have to stop the vehicals in red light and when the green light appears then only we can move ahead this rules ar the protocols which are created for the safety in road when everyone follows the traffic rules there will be very very very less chance of acciddents so by this example we understand that the protocols are made for the safety and for the smooth flow of work.

Need of Protocols

In computer there is a protocol for every task, computer follows a protocol to perform any task like if I have to sent mail ther is Simple mail transfer protocol (SMPT), if i have to send hyper links then have Hyper text transer protocol (HTTP), if I have to send files then i have File transfer Protocol (FTP), If I have to send a message to any computer via internet the ther is Internet Protocal also known as IP address, we have TCP and UPD protocols, Protocols are made to do any task in a correct manner and to complete the work very smoothly, Don’t worry, Don’t be confused, In this section I have given a basic overview of Protocols, further we will understand everything about each protocols in datail specialy Internet Protocol.

Computer Network

If I want to send some data from my computer machine to another computer machine i have to connect both the computer via some guided or unguided medium, Connection of two or more then two computers are know as computer network where every device connected with other devides and creates a network. computers are connected and uses any kind of protocol for the proper communication between them.

There are two types of computer network architecture, Peer-to-Peer architecture and Client-server architecture I have discused about the architecture in another article you can read it.

In this article we are going to discuss that how computer are interconnected with each other, when we see a computer network, some rules should be there or we can say some protocols shoud be there between connection which ensure that the connection is proper and ready for the data transfer. So for the proper connection between devices, we follow some well defined steps which is known as OSI Model, In OSI model there is seven layers and in every layer different different protocols works and this OSI model helps us to connect the computers and devices for the proper communication.

OSI (Open System Interconnect) Model

OSI Model is a theoritical model which helps us to understand the concept of networking. The practical computer networking is totally based on this OSI model. In OSI model we can understand the purpose of every protocol. As I have told previously that OSI model have seven layers and so many protocols works in every layers.

So now in this section we are going to understand the every layer of OSI model for the clear understanding of the computer network

OSI seven layers

  • Application Layer

  • Presentation Layer

  • Session Layer

  • Transport Layer

  • Network Layer

  • Data Link layer

  • Physical Layer

Application layer

This is the 7th layer of the OSI model which have the Protoles like HTTP, HTTPS, SMTP, FTM, SSH. this application layer is not the appplication like chrome or whatsapp but the application layer is the layer who helps my application to connect with network

ConceptWhat It IsExample
Application (Software)The actual program you useChrome, WhatsApp, Outlook
Application Layer (Network Layer 7)The networking logic and protocols your app uses to communicateHTTP, HTTPS, SMTP, DNS, etc.

Application layer have so many Protocols, I have mentioned some protocols under the application layer but don’t worry you have no need to understand about all the ports i am giving for the refrence, jkust read it once.

ProtocolDescriptionDefault Port
HTTPWeb browsing (unsecured)80
HTTPSSecure web browsing443
FTPFile Transfer Protocol (control connection)21
FTPSSecure FTP over SSL/TLS990
SFTPFTP over SSH (not the same as FTPS)22
SMTPSending email25
SMTPSSecure SMTP465
IMAPReading email (server-side)143
IMAPSSecure IMAP993
POP3Downloading email (client-side)110
POP3SSecure POP3995
DNSDomain Name System (resolves domain names)53
DHCP (server to client)Dynamic IP address assignment67
DHCP (client to server)Requesting IP config68
TelnetRemote command-line access (insecure)23
SSHSecure remote login / command-line22
SNMPNetwork management and monitoring161
LDAPDirectory access protocol389
NTPNetwork time synchronization123
RDPRemote Desktop Protocol (Windows)3389
SIPVoIP call signaling5060 (UDP/TCP)
TFTPTrivial File Transfer Protocol69

Presentation Layer

The Presentation Layer is responsible for translating, formatting, encrypting, decrypting, compressing, and decompressing the data so that it can be properly interpreted by the application layer on the receiving end.

FunctionDescriptionExample
1. Data TranslationConverts data between different encoding schemesEBCDIC ↔ ASCII, or character sets ↔ binary
2. Data FormattingFormats data in a readable or structured wayJSON, XML, HTML
3. Encryption/DecryptionSecures data before transmission and decrypts upon receiptHTTPS (SSL/TLS encryption), VPN traffic
4. Compression/DecompressionReduces the size of data to improve speed and efficiencyZIP, JPEG, MP3, video codecs

let’s say you’re visiting a secure website using HTTPS:

  1. Application Layer (Layer 7):

    • Sends a request to load a webpage.
  2. Presentation Layer (Layer 6):

    • Encrypts the request using TLS (Transport Layer Security).

    • Converts characters into a transmittable format.

  3. Transport & Lower Layers:

    • Handle delivery to the destination.
TechnologyFunction
TLS/SSLEncryption/Decryption (used in HTTPS, FTPS, SMTPS)
JPEG, PNG, MP4, MP3Data compression (image/audio/video formats)
ASCII, Unicode, EBCDICCharacter encoding/translation
JSON, XML, YAMLData formatting and structure

Session Layer

This is the 5th layer of the OSI model. The Session Layer is responsible for establishing, managing, and terminating sessions between two communicating devices.

FunctionDescriptionExample
1. Session EstablishmentStarts the communication session between two systemsLogging into a remote server
2. Session Maintenance (Synchronization)Keeps the session alive, monitors activity, and can sync during long transfersCheckpoints during a file transfer
3. Session TerminationGracefully ends the session when communication is completeLogging out of an app or server
4. Dialog ControlControls which side can send/receive data — supports full-duplex or half-duplex communicationVoice/video calls (two-way), walkie-talkie-style apps (one-way at a time)
5. Recovery & RestartAllows recovery if the connection is interruptedResume file download from last saved point

Imagine a phone call:

  • Session Start: You dial and the other person picks up — session established.

  • Session Maintenance: You talk — the session stays alive as long as you’re both connected.

  • Session Termination: You hang up — session ends.

This process of managing the conversation is what the Session Layer does for computers.

Transport Layer

The Transport Layer is the 4th layer of the OSI Model. The Transport Layer is responsible for reliable data transfer between two systems.
It ensures that data sent from one application on a device is delivered correctly, in order, and without errors to the corresponding application on another device.

Transport layer is a big topic in itself. Mostly TCP (Transmission Control Protocol) is used in Transport Layer and TCP uses 3 way handshake method to establish connection and it is use for port to port delivery means in a computer there may be many application are running in different different ports, So TCP protocol records the port number of the sender application and revicer application in TCP header therefore TCP is responsible for the delivery of the data to the correct application running in any specific port of a computer under network.

I have given a basic idea about the Transport Layer. We will discuss about the Transport Layer indepth in any other article, there we will study deeply about TCP and UDP, TCP headers, 3 way handshake and other thing about the Transport Layer.

Key Functions of the Transport Layer

FunctionDescriptionExample
1. Segmentation and ReassemblyBreaks large messages into smaller pieces (segments) for sending, and reassembles them at the destinationSplitting a large file into packets
2. End-to-End CommunicationEnsures two applications on different devices can talk to each other directlyA web browser talking to a web server
3. Reliable Data TransferUses acknowledgments, sequencing, and retransmission to guarantee deliveryTCP ensures your email or file arrives correctly
4. Flow ControlControls the rate of data to prevent overwhelming the receiverTCP uses sliding windows
5. Error Detection and CorrectionEnsures data is not corrupted during transferTCP uses checksums and acknowledgments
6. MultiplexingAllows multiple applications to use the network simultaneouslyYou can browse, stream, and download at the same time
7. Connection Establishment and TerminationManages connection setup and teardown between devicesTCP’s 3-way handshake

Protocols used in Transport Layer

ProtocolDescriptionPort Example
TCP (Transmission Control Protocol)Reliable, connection-oriented, slowerHTTP (80), HTTPS (443), FTP (21)
UDP (User Datagram Protocol)Unreliable, connectionless, fasterDNS (53), VoIP (5060), DHCP (67/68)

Network Layer

This is the section where we are going to spand most of the time in this article. Network Layer is the 3rd layer from the bottom and in network layer IP (Internet Protocol) address works. IP address is also known as logical address which helps us to identify any computer in a network, The Network Layer is responsible for routing data packets between devices across different networks. It determines how data gets from the source to the destination, possibly through many routers and networks.

Key Functions of the Network Layer

FunctionDescriptionExample
1. Logical AddressingAssigns unique IP addresses to devices so they can be identified on different networksEvery device on the internet has an IP address (like 192.168.1.5 or 8.8.8.8)
2. RoutingChooses the best path from source to destination, even across many networksRouters use algorithms (like OSPF, BGP) to forward data
3. Packet ForwardingMoves packets from one router to another until they reach the destinationYour data may pass through 10+ routers on its way to a website
4. Fragmentation and ReassemblySplits large packets into smaller chunks that can travel over various networks and reassembles themNeeded when a packet is too large for a certain link
5. Error Handling (basic)Checks if packets reached the destination using ICMPPing or traceroute use ICMP to test connectivity

In network layer there is two types of IP address.

  1. Class Based IP address:- Class based IP address are devided in 5 classes
ClassIP RangeDefault Subnet MaskNumber of Hosts per NetworkTypical Use
A1.0.0.0 to 126.255.255.255255.0.0.0 (/8)~16 millionVery large networks (e.g., ISPs, big corporations)
B128.0.0.0 to 191.255.255.255255.255.0.0 (/16)~65,000Medium-sized networks (e.g., universities)
C192.0.0.0 to 223.255.255.255255.255.255.0 (/24)254Small networks (e.g., home or small business)
D224.0.0.0 to 239.255.255.255Not applicableNot used for hostsMulticast
E240.0.0.0 to 255.255.255.255Not applicableReservedExperimental / Research
  1. Classless IP address

In network layer there is IP header, now what is this header, ok listen, header is just like envelop inside the envelop there will be letter and in envelop the address of the sender and reciver will be writen, means Network layer provide a header to every data packer and in header there will be the IP address of the sender and the reciver and router(device) will decide the routing of the data packed according to the headers, Now In network layer we have two types of IP header

  • IPv4 - contains IP address of 32 bit

  • IPv6 - contains IP address of 128 bit

IPv4 Header Formate

IPv6 Header Formate

Common Protocols in the Network Layer

ProtocolPurpose
IP (Internet Protocol)Core protocol for identifying devices and routing data
IPv4Most common version (e.g., 192.168.1.1)
IPv6Newer version with much larger address space
ICMPInternet Control Message Protocol (used for diagnostics like ping)
IGMPInternet Group Management Protocol (for multicast communication)
Routing Protocolse.g., OSPF, BGP, RIP – used by routers to exchange path info

Data link layer is the second layer from the bottom, which works with the frames, if you don’t know what is frame then don’t worry we will understand the frame at the section of life cycle of a data packet. at data link layer every computer’s network interface get there MAC (Media access controll) address.

Physical Layer

Physical layer is the last layer for the top or we can say first layer from the botton which deals with the actual physical devices which are used in computer network like cables, Repater, Hub, switch, Router, Modem etc.

How My Computer get its IP address

In this section we are going to understand all about how our computer get its IP address. In this section we will include networks switches routers ISP(Internet Service Provider) and Internet. So let get started

let suppose there is a building of 3 floors and in every floor many computers are there, if i want to connect all the computers together such that every computer can communicate with each other then I will connect all the computer of each floor with a switch, means all computers of ground floor are connected with a switch a,d the computers of 1st floor are connected with another switch and computers of 2nd floor are connected with another switch.

Now we have 3 networks in a 3 floor building, now a computer can communicate with only those computers which are in same network means There is a local network of ground floor and the computers which are in ground floor and connected with the switch of ground floor can communicate with each other. Similearly computers of second floor can communticate to those computer only which are connected with the switch of second floor, and similearly computers of 3rd floor cna communicate with the computers which are connected with the switch of 3rd floor, but a computer which is connected with the network of ground floor then that computer will not be able to communicate with the computers of the first floor and second floor, similearly the computers which are connected with the network of the second floor can’t communicate with the computer of the ground floor and 3rd floor and similear thing will happend for the 3rd floor computer.

Now understand one thing, In every computer a network interface is installed line in laptop Ethernet port is there that is a network interface or if your computer supporst WiFi that is also a network interface and every network interface have a MAC (Media Access Control) address, is if a computer in a network wants to communicate with the computer which is in same network connected with the switch can communicate using MAC Addresses of each others.

So, I have 3 local network, Ground, first and second floor, now if I want that a computer can communicate with a computer which is out side of its local network means a computer which is in the network of ground floor and want to communicate with the computer which is in network of 1st floor then I have to connect Both the network with a ROUTER, Router is a device which provides the IP address to each network, now we have to connect the switch of all three floors with a router and after connecting all switches a computer of ground floor can communicate with the computer of 2nd and 3rd floor, and computers of the 2nd and 3rd floor can also communicate with each other.

Now 3 networks are connected with a router and now if a computer wants to communicate with the computer of any other network then every computer have a Unique identity also known as IP address, when I connect a network to a router, the router will provide a local IP address to that network

In a router there are so many ports and every port has a IP address, means A router don’t have any IP address to itself but every port in router have unique IP address adn that IP address is also known as Default gateway (eg: 192.168.20.1) so all the computer which are connected in a network and if that network is connected with the router’s that port which has the IP address 192.168.20.1 then the default gateway for every computer in that network will be 192.168.20.1 and router will give every device a IP address(ex: 192.168.20.2, 192.168.20.3, 192.168.20.4) and every computer which wants to communicate with the computer which is outside the local network, the computer will send request or files to default gateway(192.168.20.1) which is like door of a room and a data packet can go outside the network only through the default gateway(door).

If network of the ground floor is connected with the port of the router which has IP address 192.168.20.1 then the network of the 1st floor have to connect to the other post of the router which have anoterh IP address (ex: 192.168.21.1). and this will be the default gate way for the network of the 2nd floor and if ancy compute wants to communicate with a computer outside its local network the computer will send the data packet to the default gateway (192.168.21.1). and network of the third floor will connect with anyother port on router which have again another IP address (ex:192.168.22.1) and this will be the default gateway for the network of 3rd floor.

Note:- No two ports of as router can have same IP address.

Now after connecting all the networks to router, router runs a DSCP(Dynamic Host Configuration Protocol) server which allocates IP address to every port of a router and computer which is connected with any port of the router. Now router have a defalult mask through which a router desides the routing of the data packet every default mask dependson the class of IP address which is allocated to the port of the router ex: if IP is 192.168.20.1 the default mask is 255.255.255.0

Now we have connected all the networks of a building and every computer of the building can communicate to each other through switches and router but the computer are only connected with each other not with Internet so computer of a building can’t transfer data to the internet, If I want to connect my all computer with the Internet I will connect the router with the modem (Device) and the modem will be connected with the ISP(Internet Service Provider) and then ISP also runs a DHCP server to give a public IP address to a port of router (ex: 201.30.56.5). now if a computer sends a data packet, data packet will reach to the router and the router will check the IP address of the destination and if the IP address is not the IP address of the local network the router will replace the IP address of the source to the public IP address (201.30.56.5) and record the original source IP address and destination IP address in a Table known as NAT(Network Address Translation) and then router wull send the data packet to the ISP and ISP will send the data packet to the destination and then destination machine will send the response back to us It will reach to ISP first and then ISP will send the response to the router and then router wull check in NAT table and then router will send the response to the original source computer.

Basicaly the IP address which is provided by the router to our newtork computers will never expose to the internet but ISP provides a public IP address which router uses to send the data packet from the local network to the internet.

Conclusion

We have understand the protocols and the need of the protocols in computer network and using this protocols we created a model known as OSI model and see that how a data packet travels throuth the OSI model. We see all the layers of the OSI model and understand all the concepts of the networking, and at the last we have seen how we connects with the internet and how we get our IP address.

What Next…

My name is Aryan Dhirhi and I am computer engineer and I write this type of blogs, So If you are intrested in the field of technology you can follow me and connect me via linkedin, twitter, hashnode.

0
Subscribe to my newsletter

Read articles from Aryan Dhirhi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aryan Dhirhi
Aryan Dhirhi