Understanding OSI Model and HTTP Protocol

Network Protocol
A network protocol is a set of rules that define to control connection, communication, and data transmission in a network. It is used to ensure efficient and secure communication within networks.
Overview of OSI Model
OSI Model stands for Open Systems Interconnection Model. It was created based on recommendations from the International Organization for Standardization (ISO) in 1980. The OSI Model is a conceptual framework that is used to describe the functions of a networking system. It is divide into seven layers. Each layer in OSI Model has its own duties & specific functions to perform.
Data Encapsulation and Decapsulation
Physical Layer
The physical level is responsible for making the connection between devices. Therefore, it focuses on hardware elements, such as cables, repeaters, and network interface cards. This layer is used to transmit and receive raw bits of data, which it converts into electrical, radio, or optical signals. Protocol Data Unit (PDU) at the physical layer is called Bit. The most common protocol used at this layer is Ethernet.
The physical layer provides,
- Data encoding — converting 1s and 0s into physical medium characteristics. It specifies what signal state represents a binary 1, as well as how the transmitting station determines when “bit-time” begins and how a frame is delimited.
- Physical medium attachment — for example, the number of pins in the cable, purpose of each pin.
- Physical medium — whether it transmits through electrical or optical signals.
- Transmission technique — determines whether the encoded bits will be transmitted by baseband (digital) or broadband (analog) signaling.
Some devices used in this Layer:- hubs, repeaters
Data Link Layer
The Data Link layer is the second layer of the OSI model. it provides two important functions such as physical addressing (MAC address) and switching. The data link layer is the place where most LAN, Ethernet, and wireless LAN technologies are defined. PDU at the date link layer is called a Frame.
Duties of Link Layer,
- Framing — encapsulate datagram into the frame, adding a header, trailer
- Reliable delivery between adjacent nodes
- Flow control
- Error detection and error correction
There are two sub-layers in this layer.
- Logical link control (LLC) layer — provides addressing and control of the data link. It handles error checking, flow control, and frame synchronization.
- Medium access control (MAC) layer — controls how a node on the network gains access to the medium and permission to transmit to it.
Most network technologies based on IEEE 802 use MAC addresses that are used in the MAC-layer for addressing purposes.
Some protocols under the data link layer,
- ARP — Address Resolution Protocol
- DARP — Distributed Autonomous Routing Protocol
- PPP — Point to Point Protocol
- NDP — Neighbor Discovery Protocol
- L2TP — Layer 2 Tunneling Protocol
Devices used in this layer:- layer 2 switches, bridges, NIC’s
Network Layer
The network layer is the third layer of the OSI model. It deals with logical addressing (IP address) and routing. This is the place where most Routing and network equipment are defined. PDU at the network layer is called Packet.
Duties of the network layer,
- Internetworking
- Addressing
- Routing
- Packetizing
- Fragmentation
Some protocols under the network layer,
- IPv4 — Internet Protocol version 4
- IPv6 — Internet Protocol version 6
- IPsec — Internet Protocol Security
- RIP — Routing Information Protocol
- DDP — Datagram Delivery Protocol
Devices used in this layer:- layer 3 switches, routers
Transport Layer
The transport layer is the fourth layer of the ISO model. It is responsible for end-to-end communication between the two devices. PDU at the network layer is called Segment.
Duties of the transport layer,
- End to End Connection Management
- Transmission
- Segmentation
- Flow Control
- Error Control
The transport layer has two main protocols as TCP and UDP.
- TCP — responsible for sending the data until it receives the delivered response
- UDP — responsible for only sending the data
Session Layer
The session layer is the fifth layer of the ISO model. It is responsible for session control. In other words, it allows devices to establish and manage sessions.
Duties of the session layer,
- Sessions Management
- Duplex Control
- Authentication
- Authorization
Network equipment and components are used in the session, presentation, and application layers.
- Firewalls
- Gateways
- Computers
- Load Balancers
Some protocols under session layer,
- SIP — Session Initiation Protocol
- PPTP — Point-to-Point Tunneling Protocol
Presentation Layer
The presentation layer is the sixth layer of the ISO model. It handles data organization & conversion so that it is readable by the application layer. The presentation layer is responsible for the translation, encryption, and compression of data.
Duties of the presentation layer,
- Data Formatting & Representation
- Data Encryption/Decryption
- Data Compression/Decompression
Some protocols under the presentation layer,
- ASCII
- SSL — Secure Sockets Layer
Application Layer
The application layer is the seventh layer in the OSI model. It deals with actual applications and end-user processes. In other words, this layer directly interacts with the end-user. Some applications like web browsers and email clients depend on the application layer to initiate communications. This is the layer where real traffic data is generated in most cases.
Duties of the application layer,
- Manage applications software running on a computer or terminal
- Supply Network Services to end-user
Some protocols under the application layer,
- HTTP — Hypertext Transfer Protocol
- DNS- Domain Name System
- FTP — File Transfer Protocol
- POP — Post Office Protocol
- SMTP — Simple Mail Transfer Protocol
Now I hope you understand the OSI model. This video uploaded by
J Kenneth Lim will be really helpful to understand this concept.
HyperText Transfer Protocol
Hypertext Transfer Protocol (HTTP)is an application protocol that can be described as the foundation for communication on the World Wide Web (WWW). HTTP uses a server-client model. A client is some electronic device that can access the web like home computer, laptop, tablet, mobile, etc. A server is typically a web host running web server software like web servers, mail servers, and file servers. The communication between client and server is provided by requests and responses.
For example, when you access a website, your browser sends a request to the corresponding web server and it responds with an HTTP status code. If the URL is valid and the connection is granted, the server will send your browser the webpage and related files. HTTP involves making the connection by HTTP request and response.
The HTTP response has three main components
- HTTP status code
- HTTP response header
- HTTP response body
Some common HTTP status codes include,
- 1xx — Informational messages
- 2xx — Success messages
- 3xx — Redirect messages
- 4xx — Client errors
- 5xx — Server errors
HTTP response header — consists of information in key-value pair. It request and response message.
HTTP response body — contains either the resource requested by the client or some information about the status of the action requested by the client.
HTTP also defined some methods which are used to handle form submissions on websites.
- GET — used to retrieve information from the given server
- HEAD — used to retrieve information from the given server(only response header)
- POST — used to send data to the server
- PUT — used to update a record in the server
- DELETE — used to remove excising record in the server
- PATCH — used to small modifications in the resource
- CONNECT — used to establish a tunnel to the server
- OPTIONS — describes the communication options for the target resource
Evolution of HTTP
HTTP/0.9 — The One-line Protocol
- a simple client-server, request-response, Telenet-friendly protocol
- Support only for the GET method
- Response type is only hypertext
- No Header, No status codes, No URLs, No versioning
Request,
GET /mypage.html
HTTP/1.0 — Building extensibility
- HTTP headers have been introduced for both requests and responses.
- Support methods — GET, HEAD, and POST
- Ability to transmitting other documents than plain HTML files
- Status code has been introduced
HTTP/1.1 — The standardized protocol
- This is the HTTP version currently in common use.
- Support methods — GET, HEAD, POST, PUT, DELETE, TRACE, and OPTIONS
- Introduced pipelined connections (more than one request can send before receiving the response)
- The connection can be reused (saving time to reopen the connection)
- Content negotiations
HTTP/2 — A protocol for greater performance
- Parallel requests can be handled over the same connection (a multiplexed protocol)
- To speed up web performance, Header compression is introduced, Therefore, small files load more quickly than large ones.