Saptarshi's Notes 📝
  • HOME
  • Open-Source
    • Issue Template
    • Pull Request Template
    • Greetings Action
    • Stale Action
    • Push to Pull Requests Action
    • Contributing Guide
    • Security
  • Computer Networking
    • Introduction
    • IP Address
    • Data Transmission
      • Network Topologies
      • Structure of The Network
      • Network Devices
    • How does The Internet work?
      • OSI Model
      • TCP/IP Model
        • Application Layer
          • Application Layer Network Protocols
          • Sockets
          • Ports
        • Transport Layer
        • Network Layer
        • Data Link Layer
        • Physical Layer
Powered by GitBook
On this page
  • Parts Of IP Addresses
  • Control Plane
  • Subnetting
  • Class Of IP Addresses
  • Subnet Masking
  • Reserved IP Addresses
  • Middle Boxes
  • Network Layer Protocols

Was this helpful?

  1. Computer Networking
  2. How does The Internet work?
  3. TCP/IP Model

Network Layer

PreviousTransport LayerNextData Link Layer

Last updated 2 days ago

Was this helpful?

In this layer, we work with routers. This layer helps in the data transmission from source to destination. The routing table is a table inside the router containing information about the topology of the network immediately around it. The data packet will contain the data along with the source network layer address. The router checks whether the data is for a device connected to it or not. If not, then the router checks its forwarding table (Or MAC Table) to find in which direction and to which router the data should go. This goes on until the data receives the correct router. This is called hop-by-hop architecture. This hoping happens at ISPs. Routing table contains multiple paths, whereas forwarding table contains one path, thus it's faster. Every router has its own network addresses or Logical addresses.

Parts Of IP Addresses

Here, the Network ID also known as Network address, tells which network your device resides in. The Host ID is the part of an IP address that uniquely identifies a specific host on a given TCP/IP network.

Control Plane

Control plane is used to create the routing tables. Control Plane is like a very big graph in which the nodes are the routers, and the edges are the links between routers. Two types of routing are used to create routing tables:

  • Static Routing - Addresses are added manually. This is time consuming and not adaptable easily.

  • Dynamic Routing - If there is a change in the addresses or network, addresses are modified automatically. Algorithms used here include Bellman-Ford algorithm, Dijkstra's algorithm, etc.

Subnetting

Here, the Network ID is the subnet ID. All the devices connected to that router having that subnet ID, will have the same subnet IDs and differ only in Host IDs.

Class Of IP Addresses

There are five classes (basically denoting a range of IP addresses) of IP Addresses:

  • Class A - from 0.0.0.0 to 127.255.255.255

  • Class B - from 128.0.0.0 to 191.255.255.255

  • Class C - from 192.0.0.0 to 223.255.255.255

  • Class D - from 224.0.0.0 to 239.255.255.255

  • Class E - from 240.0.0.0 to 255.255.255.255

Subnet Masking

Reserved IP Addresses

127.0.0.0/8 means that the first 8 bits are reserved, the rest can be used. This are known as loopback addresses as the processes which are running on the same machine will allow us to contact the same processes, i.e, our computer acts both as a server and a client at the same time. Example: Localhost (127.0.0.1). You can have as many numbers of loopback addresses as you want.

Middle Boxes

This are devices that comes in between router and system endpoint and interact with the data packets. This can be present in network layer or even at transport layer. Example: Firewall and NAT.

  • Firewall - Two types are there - One connected to the global internet and the other connected to your own network. The packets coming to the network can be filtered and even modified (the headers and the destination can also be changed), flags can also be checked. There are stateless and stateful firewalls (uses cache so it's much faster).

Network Layer Protocols

The protocols used by network layer are

IPv4 (Internet Protocol version 4)

IPv4 is a network layer protocol that contains addressing and control information, which helps packets be routed in a network. IP works in tandem with TCP to deliver data packets across the network. Under IP, each host is assigned a 32-bit address comprised of two major parts: the network number and host number. The network number identifies a network and is assigned by the internet, while the host number identifies a host on the network and is assigned by a network admin. The IP is only responsible for delivering the packets, and TCP helps puts them back in the right order.

IPv4 data packets has headers (IP Version, identification numbers, length of data, checksum, addresses, TTL (time to leave), etc.) of 20 bytes apart from the data. If TTL (time to leave) is crossed and the data acknowledgement does not return, the packet will be dropped.

Advantages:

  • IPv4 encrypts data to ensure privacy and security.

  • With IP, routing data becomes more scalable and economical.

Disadvantage:

IPv4 is labor intensive, complex, and prone to errors.

IPv6 (Internet Protocol version 6)

IPv6 is the latest version of the Internet Protocol, a network layer protocol that possesses addressing and control information for enabling packets to be routed in the network. IPv6 was created to deal with IPv4 exhaustion. It increases the IP address size from 32 bits to 128 bits to support more levels of addressing.

There are 8 numbers in the IPv6, and each number is a hexa-decimal number and is of 16 bits.

Advantages:

  • More efficient routing and packet processing compared to IPv4.

  • Better security compared to IPv4.

Disadvantages:

  • IPv6 is not compatible with machines that run on IPv4.

  • Challenge in upgrading the devices to IPv6.

ICMP (Internet Control Message Protocol)

ICMP is a network layer supporting protocol used by network devices to send error messages and operational information. ICMP messages delivered in IP packets are used for out-of-band messages related to network operation or misoperation. ICMP is used to announce network errors, congestion, and timeouts, as well assist in troubleshooting.

Advantage:

ICMP is used to diagnose network issues.

Disadvantages:

  • Sending a lot of ICMP messages increases network traffic.

  • End users are affected if malicious users send many ICMP destination unreachable packets.

It means that the subnet mask is going to mask the network ID and leave the host ID for us to use. Variable length subnets mean that you can set your own length of the subnet ID. assigns the IP Addresses to the ISP without thinking of the classes of IP Addresses but based on REGIONS.

NAT (Network Address Translation) - is a method of mapping an IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device. It is done to slow down the consumption of IP Addresses.

The Internet Engineering Task Force (IETF)
Network address translation (NAT)