Networking Concepts

Introduction

Networking concepts are the fundamental ideas and rules that explain how computers and devices connect and communicate with each other. They address everything from the organization and management of networks to the flow of data.

OSI Model

The OSI (Open Systems Interconnection) model is a theoretical framework that breaks down how network communication works into seven distinct layers. It gives us an organized understanding of the intricate data transfer process.The OSI model is composed of seven layers:

  1. Physical Layer

  2. Data Link Layer

  3. Network Layer

  4. Transport Layer

  5. Session Layer

  6. Presentation Layer

  7. Application Layer

Layer 1: Physical Layer

The physical layer (Layer 1) handles the actual connection between devices using wires, cables, or wireless signals. It defines how 0s and 1s are sent through mediums like Ethernet cables, optical fiber, or WiFi signals (2.4 GHz, 5 GHz, 6 GHz).Example:

  • Ethernet cable – used in wired networks

  • Optical fiber – for high-speed internet via light signals

  • WiFi (2.4 GHz, 5 GHz, 6 GHz) – wireless data transmission using radio waves

  • Bluetooth – short-range wireless communication

  • Coaxial cable – used in cable TV and some networks

  • Infrared – remote controls and some short-range devices

The data link layer (Layer 2) defines how devices on the same network segment communicate. It controls how data is placed on the physical medium, uses MAC addresses to identify devices, and ensures that data is delivered correctly with error detection. A network segment is a group of devices sharing the same connection, like computers linked to the same network switch.

Examples:

  • Ethernet (802.3) – wired network communication

  • WiFi (802.11) – wireless network communication

Each device has a MAC address (e.g., 00:1A:2B:3C:4D:5E), which is 6 bytes long. The first 3 bytes identify the manufacturer, and the address is usually shown in hexadecimal with colons.

Layer 3: Network Layer

The network layer (Layer 3) focuses on sending data between different networks. It transfers packets between networks, assigns IP addresses, and chooses the optimal path. The network layer connects several networks, such as offices in various cities or nations, whereas the data link layer connects devices within the same network segment, such as ten PCs in a single office.

For instance, the network layer determines the most efficient way for data to move from computer A in one city to computer B in another. It uses routing to choose the most effective way, even if there are several.

Examples of the network layer include Internet Protocol (IP), Internet Control Message Protocol (ICMP), and Virtual Private Network (VPN) protocols such as IPSec and SSL/TLS VPN.

Layer 4: Transport Layer

The Transport Layer makes sure data is sent correctly and completely from one computer to another. It breaks big data into smaller parts, checks for errors, controls the flow so nothing gets lost, and keeps different app data separate using ports.

Examples of layer 4 are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).

Layer 5: Session Layer

The session layer is responsible for establishing, maintaining, and synchronising communication between applications running on different hosts. Establishing a session entails negotiating the session's requirements and starting communication between apps. Data synchronization guarantees that information is sent in the right sequence and offers contingency plans in the event that a transmission fails.

Examples of the session layer are Network File System (NFS) and Remote Procedure Call (RPC).

Layer 6: Presentation Layer

The presentation layer ensures the data is delivered in a form the application layer can understand. Data encryption, compression, and encoding are managed by Layer 6. Character encoding, like ASCII or Unicode, is an example of encoding.

At the presentation layer, different standards are applied. Think about the situation when we wish to email an image. First, we save our photographs in JPEG, GIF, and PNG formats. Next, we attach the file to our emails using MIME (Multipurpose Internet Mail Extensions), which is concealed from the user by the email client. MIME uses 7-bit ASCII characters to encode a binary file.

Layer 7: Application Layer

The application layer provides network services directly to end-user applications. To upload a file, submit a form, or request a file, your web browser would use the HTTP protocol.

As you utilize various programs, you may have come across many of the protocols of the application layer, which is the top layer. Layer 7 protocols include, for example, HTTP, FTP, DNS, POP3, SMTP, and IMAP.

Summary

Layer NumberLayer NameMain FunctionExample Protocols and Standards
7Application layerProviding services and interfaces to applicationsHTTP, FTP, DNS, POP3, SMTP, IMAP
6Presentation layerData encoding, encryption, and compressionUnicode, MIME, JPEG, PNG, MPEG
5Session layerEstablishing, maintaining, and synchronizing sessionsNFS, RPC
4Transport layerEnd-to-end communication and data segmentationUDP, TCP
3Network layerLogical addressing and routing between networksIP, ICMP, IPSec
2Data link layerReliable data transfer between adjacent nodesEthernet (802.3), WiFi (802.11)
1Physical layerPhysical data transmission mediaElectrical, optical, and wireless signals

TCP/IP Model

The U.S. Department of Defense developed Transmission Control Protocol/Internet Protocol, or TCP/IP, in the 1970s. They designed the network to function even in the event of a military attack or other situation where components are down or destroyed. As the network evolves, the routing protocols may adapt and discover new routes, which is why this works.

The table below shows how the TCP/IP model layers map to the ISO/OSI model layers.

Layer Number

ISO/OSI Model

TCP/IP Model (RFC 1122)

Protocols

7

Application Layer

Application Layer

HTTP, HTTPS, FTP, POP3, SMTP, IMAP, Telnet, SSH, DNS

6

Presentation Layer

5

Session Layer

4

Transport Layer

Transport Layer

TCP, UDP

3

Network Layer

Internet Layer

IP, ICMP, IPSec

2

Data Link Layer

Link Layer

Ethernet 802.3, WiFi 802.11, ARP, RARP

1

Physical Layer

IP Addresses and Subnets

Every device on a network is uniquely identified by its IP address, which is a number like 192.168.0.1. Similar to your home address, it enables people to locate and send you items. Devices cannot effectively communicate if they do not have a unique IP address.

IPv4 (the most popular) and IPv6 (the more recent) are the two primary varieties. The four components of an IPv4 address, known as octets, range from 0 to 255, for example, 192.168.0.1.

Look up your IP address on terminal or command prompt lusing the command

For Linux :ifconfig or ip address show

For Windows:ipconfig

Let’s use ip a s to compare how the network card IP address is presented.

Subnet

A subnet mask like 255.255.255.0 can also be written as /24.This indicates that the IP address's initial 24 bits, or its first three components, remain constant throughout the network.

In the 192.168.66.0/24 network, for instance:

1.The range of usable IP addresses is 192.168.66.1 to 192.168.66.254.
2.The network address is 192.168.66.0; devices do not use it.

The broadcast address, which is used to communicate with every device in the network, is 192.168.66.255.

RFC 1918 defines the following three ranges of private IP addresses:

  • 10.0.0.0 - 10.255.255.255 (10/8)

  • 172.16.0.0 - 172.31.255.255 (172.16/12)

  • 192.168.0.0 - 192.168.255.255 (192.168/16)

Routing

For data, a router is comparable to a post office. The router uses the IP address to determine where to send the data once you send it (like a letter). If it's traveling far, it might traverse via a number of routers before arriving at its destination.

By selecting the most efficient path, routers, which operate at Layer 3 (Network Layer), assist in moving data between various networks.

UDP and TCP

UDP (User Datagram Protocol) is a simple, connection less transport protocol (Layer 4) that sends data without checking if it was received. It’s fast but unreliable—like mailing a letter without delivery confirmation.

Each device is found using an IP address, and each app/process is found using a port number (ranges from 1 to 65535).

UDP is good for speed, like in streaming or online games. But if you need delivery confirmation, use TCP, which is slower but more reliable.

TCP (Transmission Control Protocol) is a connection-oriented protocol at Layer 4 (Transport Layer). It ensures that information is transferred across devices in a dependable and sequential manner. TCP verifies that the data arrives and resends it if necessary, in contrast to UDP.

Key Points: To ensure that everything is received in the correct order, each packet is assigned a sequence number.

To verify that it received the data, the recipient replies with ACKs (acknowledgments).

To establish a connection, TCP starts with a three-way handshake:

  1. SYN: The client says, "Let's connect."

  2. SYN-ACK: The server replies, "All right, I'm ready."

  3. ACK: The client confirms, and the connection is established.

Similar to UDP, TCP identifies the process of initiating or waiting (listening) for a connection using port numbers. As stated, a valid port number ranges between 1 and 65535 because it uses two octets and port 0 is reserved.

Encapsulation

Encapsulation is an essential concept as it allows each layer to focus on its intended function. In the image below, we have the following four steps:

  • Application Data – You type a message (like an email) and hit send.

  • Transport Layer – Adds a TCP or UDP header, making a segment or datagram.

  • Network Layer – Adds an IP header, making a packet.

  • Data Link Layer – Adds an Ethernet/WiFi header and trailer, making a frame.

The Life of a Packet

When you search something on Google, here’s what happens behind the scenes:

  1. You type your search in the Google search bar and press Enter.

  2. Your web browser creates an HTTPS request and passes it to the transport layer.

  3. The TCP layer sets up a three-way handshake to create a reliable connection with Google’s web server.

  4. After the connection is ready, your search request is packed into TCP segments and sent to the Internet (IP) layer.

  5. The IP layer adds your computer’s IP address (source) and Google’s IP address (destination), creating IP packets.

  6. These packets go to the link layer, which adds headers and trailers (like Ethernet or Wi-Fi info) to create frames.

  7. The frame is sent to your router.

Then:

  • The router removes the link layer info, checks the IP address, and forwards the packet.

  • Each router on the way does the same—checks the IP and sends the packet forward—until it reaches Google’s server.

Telnet

Telnet is a simple network tool that lets you connect to a remote system and type text commands. It is frequently used to test or communicate with services that are operating on particular ports and makes use of the TCP protocol.

Telnet Examples of Services You Can Try:
Server Echo (Port 7): returns anything you type.

The current date and time are returned by the daytime server (port 13).
Web Server (Port 80): Returns HTML and other web page data. Only for testing purposes are these services enabled. Daytime and Echo pose security problems in practical systems and are typically turned off.

Press CTRL + j and then type quit to end a Telnet session.

let’s request a web page using telnet. After connecting to port 80, you need to issue the command GET / HTTP/1.1 and identify the host where anything goes, such as Host: telnet.thm. Next, you need to press Enter twice so your last input line is a blank line. The output below shows the exchange. (The page has been redacted.)

Note: You may have to press Enter after sending the information in case you don’t get a response.

Conclusion

We discussed the differences and similarities between the TCP/IP and ISO OSI models. In addition, we talked about IP addresses, subnets, and a quick overview of routing. Moreover, we discussed encapsulation after delving into TCP and UDP. We "talked" to various servers via TCP using telnet for demonstration reasons.

0
Subscribe to my newsletter

Read articles from MD MUNIF MUBTASHIM directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

MD MUNIF MUBTASHIM
MD MUNIF MUBTASHIM

CSE student | Cybersecurity Learner | Red Team Path | Blogging my CTF & hacking journey .