Master Computer Networking

Complete guide to understanding networks, protocols, and data communication

Table of Contents

  1. OSI Model
  2. TCP/IP Protocol Suite
  3. IP Addresses & Subnet Masks
  4. Network Devices
  5. How Data Travels

🧩 OSI Model

OSI Model 7 Layers

The OSI (Open Systems Interconnection) model is a conceptual framework that standardizes the functions of a telecommunication or networking system, dividing it into seven layers. This model helps in understanding how different network components interact to enable communication between devices, regardless of their underlying technology.

Key Concept: Created by ISO (International Organization for Standardization), think about layers like steps to communicate between devices. These steps happen in both devices - the sender and receiver do these steps in reverse. If the sender goes from 7 to 1, receiver goes from 1 to 7.

Data Transformation Process

At sender: At each layer, a header can be added to the data unit. At layer 2 a trailer is added as well. When formatted data unit passes through physical layer it is changed into an electromagnetic signal and transported along physical link.

Encapsulation: A packet (header and data) at level 5 is encapsulated in a packet in level 4, and so on. The data portion of packet at level N-1 carries the whole packet (data and header/trailer) from level N.

At destination: Data then moves back up through the layers. Headers and trailers attached to data at the corresponding layer are removed (decapsulated) and action appropriate to that layer are taken. At layer 5 the message is again in form appropriate to the application and is made available to user.

OSI Layers Breakdown

1. Physical Layer

The physical layer is responsible for movements of individual bits from one hop (node) to the next.

2. Data Link Layer (Hop to Hop Delivery)

The data link layer is responsible for moving frames from one hop (node) to the next.

MAC Address Example: Known as the MAC or link address, it's the address of a node as defined by its LAN or WAN. Ethernet uses 6-bytes (48-bits) physical address imprinted on the NIC.

3. Network Layer (End to End Delivery)

The network layer is responsible for the delivery of individual packets from source host to destination host across multiple networks.

IP Addresses: IP addresses are necessary for universal communications independent of physical network. No two host addresses on the internet can have the same IP address. IP addresses are 32-bit addresses that uniquely define a host connected to the Internet.

Key Point: Physical addresses change from hop to hop, but logical addresses remain the same.

4. Transport Layer

Responsible for process-to-process delivery of the entire message.

5. Session Layer

The session layer is responsible for dialog control and synchronization.

6. Presentation Layer

The presentation layer is responsible for translation, compression, and encryption.

7. Application Layer

The application layer provides services to the user such as:

🌐 TCP/IP Protocol Suite

The layers in the TCP/IP protocol suite do not exactly match those in the OSI model. However, when TCP/IP is compared to OSI, we can say that the TCP/IP protocol suite is made of five layers: physical, data link, network, transport, and application.

Physical Addressing in TCP/IP

Most local-area networks use a 48-bit (6-byte) physical address written as 12 hexadecimal digits; every byte (2 hexadecimal digits) is separated by a colon:

07:01:02:01:2C:4B

A 6-byte (12 hexadecimal digits) physical address.

🏠 IP Addresses & Subnet Masks

Let us first look at the working definition of computer networks: Computer networks can be defined as the exchange of network packets between computing machines across the world with the help of data lines like wire cables, optical fibers, etc.

Commonly Used Terms in Computer Networks

Nodes

Nodes in computer networks mean any computing device such as computers, mobile phones, tablets, etc which try to send and receive network packets across the network to another similar device.

Network Packets

Network packets are nothing but the information or units of data that a source node wants to send/receive to/from the destination node.

Internet Protocol (IPs)

Consider you want to send a birthday gift to your friend on their birthday, where will you send it? To their street address right? Same is the case here. An IP of a computer device is the address of that device in a computer network.

Technical Definition: An IP address is a 32-bit number used which identifies devices in a network. All communication to and from the device in that network will be done in terms of its IP address.

IP Address Types

IP Address Classes

IPv4 is classified into five classes named Class A, B, C, D, E.

Class A

First bit of first octet is constant and is "0"

  • Default subnet mask: 255.0.0.0
  • Network bits: 8, Host bits: 24
  • Usable network bits: 7 (8-1 for class identification)
  • Number of networks: 2^7 - 2 = 126
  • Hosts per network: 2^24 - 2 = 16,777,214
  • Range: 1.x.x.x to 126.x.x.x

Class B

First 2 bits are constant (10)

  • Range: 128.0.x.x to 191.255.x.x

Class C

First 3 bits are constant (110)

  • Range: 192.0.0.x to 223.255.255.x

Static vs Dynamic IP Addresses

Important Note: A device can have multiple IP addresses at the same time. IP addresses are assigned to interfaces, not directly to computers.

Network Address Translation (NAT)

Network address translation is a technique used by routers to provide internet service to more devices with less usage of public IPs. A router is assigned a single IP address by the ISP and assigns private IPs to all connected devices.

NAT Example

If you're accessing medium.com (72.14.204.147) from your computer (192.168.1.100):

Private connection: 192.168.1.100:37641 → 72.14.204.147:80
Public connection: 104.244.42.129:59273 → 72.14.204.147:80

Dynamic Host Configuration Protocol (DHCP)

DHCP is responsible for assigning dynamic IP addresses to hosts. The DHCP server is maintained by the ISP or router and handles automatic IP allocation.

Domain Name System (DNS)

A Domain Name Server contains huge records of domain name to IP address mappings. When you type a URL, DNS servers translate the domain name to the corresponding IP address.

How DNS Works

  1. DNS is managed by your ISP
  2. When you type a URL, packets travel to your ISP's DNS server
  3. DNS server looks up the domain in its database
  4. If not found, it queries other DNS servers
  5. Returns the IP address or throws an error

Internet Service Providers (ISPs)

ISPs provide internet access and are organized in a hierarchical structure:

🔧 Network Devices

Network devices are physical devices that allow hardware on a computer network to communicate and interact with each other. They ensure efficient communication between connected devices by controlling data transfer, boosting signals, and linking different networks.

Functions of Network Devices