learn.dev42.co.uk

Network Layers And Protocols

[!IMPORTANT] This Page Is Still A Working Progress.

Network Protocols refer to a set of rules and conventions that define how data is transmitted and received over a network. They establish the methods and procedures for communication between different network devices.

Physical Layer (L1)

Transmission of raw bitstreams over physical mediums.

Link Layer Protocols: Protocols that work at the network interface level, facilitating data transfer between devices on the same local network, like Ethernet.

Network Layer (L3)

Routing data packets through the network.

Transport Layer (L4)

Transport Protocols: Protocols responsible for end-to-end communication, ensuring complete data transfer. Examples include TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

Session Layer (L5)

Maintaining sessions and controlling connections.

Presentation Layer (L6)

Translation of data formats and encryption.

Application Layer (L7)

Application Protocols: These protocols provide services directly to end-users and define how applications interact over a network, such as HTTP for web browsing and SMTP for email.

OSI Model

[!NOTE] We Don’t Need To Know This For GCSE AQA!

The Open Systems Interconnection (OSI) model describes seven layers that computer systems use to communicate over a network. The OSI model is divided into seven distinct layers, each with specific responsibilities, ranging from physical hardware connections to high-level application interactions.

Each layer of the OSI model interacts with the layer directly above and below it, encapsulating and transmitting data in a structured manner. The OSI model serves as a universal language for networking, providing a common ground for different systems to communicate effectively.

OSI vs. TCP/IP Model

The Transfer Control Protocol/Internet Protocol (TCP/IP) is older than the OSI model and was created by the US Department of Defense (DoD). A key difference between the models is that TCP/IP is simpler, collapsing several OSI layers into one:

Other important differences:

TCP/IP Model

Transfer Control Protocol/Internet Protocol (TCP/IP)

encapsulation

This is where extra data is added to the original data, such as headers and trailers

there are some protocols that require more info to be added to the end. these are trailers. together the header and the trailer encapsulate the payload(Data)

Application

Data from an application is encapsulated: The application layer works out what the best protocol would be best. these are what manage the communications between applications. The correct Protocol is added to the header, I.E. HTTPS or HTTP If required, a termination message(Trailer) is added at the end of the Payload

Transport

Data is received from the Application layer as a large set of data. the job of the transport layer is to prepare it to be transmitted.

ALL data including the protocol packets are broken up into packet chunks and assigned a packet number in the order of reconstruction. then assigns TCP or UTP for transmission.

If the data packets are sent with TCP, if a packet is missing when being deconstructed then it is sent again.

SOckets are the TCP end point. the consist of IP address and Port number. these persist throughout the transmission connection.

Network

The segment from the Transport layer is encapsulated by the Internet protocol to create an IP Packet. Each IP packet is given a header containing multiple pieces of data. these assist with the delivery of data to the destination. The two most important pieces of header data is the source and destination IP address.

The source address is what was allocated to the computer that is sending the IP packet. The destination address will be looked up via a DNS server.

Link Layers are the physical connections, Protocols that work at the network interface level, facilitating data transfer between devices on the same local network, like Ethernet or 4G LTE.

the IP packet from the network layer are encapsulated in an ethernet frame. this is designed to be transported across a local network.

the header of these ethernet frames contain the source and destination MAC address and a type of field to indicate what they are carrying. Each Network packet gets assigned both MAC addresses, even of they are going to the same destination.

Common Physical Protocols:

Client Server Interaction

Client to Server

Client sends a Http or Https request to the Server. this is a passive server as it only listens on a port for a request, usually port 80/443. The client has 5 diferent HTTP methords that it can use. Get, Push/Patch, Delete, Post. These are send in the HTTP Header.

Each request and update needs a new header and the method to be sent again. if the client wants to keep the connection for a prolonged period of time then the client requests a HTTPS upgrade Websocket in its header. This open a WebSocket and this stays open till the connection is closed or the client hasn’t sent data in a while.

Server to Client

When responding to a request from a client, the server will return a JSON file back. along with sending any requested files, i.e HTML and CSS webfiles. The server may also request an update from the Database if there are non static files that need updating.

Webserver to Database Server

Some systems use a database server, some dont. most likely a database will be on the same server as the webserver whereas a Database server will be connected thorough the network.

The webserver requests updates from the Database server using CRUD - Create Request Update Delete. Then the database server connects to the database and uses: Insert, Select, Update, Delete.

DBMS

DBMS is DataBase Management System and runs on a Database Server only.

Webserver to Database

If the Webserver requests directly from a database it just uses: Insert, Select, Update, Delete. CRUD is only used as a translation between Webserver and Database server.