TCP/IP Model : Network Layer

Computer Networking Series Part 5

ยท

4 min read

TCP/IP Model : Network Layer

Introduction

This article will take you through the Network Layer of the TCP/IP Model. It is the Part - V of the 6-article series on Computer Networking. Links for all other articles are given at the end.

Network Layer Of The TCP/IP Model

  • Routers are located in this layer.

  • Every router has a Network Address.

  • Router checks in its routing table that consists of every destination address.

  • Hop by Hop forwarding means hopping router to router until it reaches the correct router.

  • Routing table also has a forwarding table inside.

Routing

  • Ex - 192.168.2.30. Here, 192.168.2 is the Network Address Subnet ID and 30 is the device Address Host ID.

  • Control Plane - It creates the database of routing and forwarding tables.

  • Router -> Nodes

  • Links -> Edges

  • Static Routing - Add the route and address manually. Time consuming.

  • Dynamic Routing - Evolves with the change in network. They use pathfinding algorithms.

Internet Protocol (IP)

  • IPv4 -> 32 bits, 4 words

  • IPv6 -> 128 bits, alphanumeric

  • Classes of IPv4 Addresses

    • Class A -> 0.0.0.0 - 127.255.255.255
    • Class B -> 128.0.0.0 - 191.255.255.255
    • Class C -> 192.0.0.0 - 223.255.255.255
    • Class D -> 224.0.0.0 - 239.255.255.255
    • Class E -> 240.0.0.0 - 255.255.255.255
  • Maintained by Internet Engineering Task Force - ietf.org

  • IETF assigns addresses based on regions instead of classes because it is more efficient.

Subnet Masking

  • Mask the network part of IP Addresses and it leaves for us to use the host part.

Mask

Variable Length Subnets

  • 12.0.0.0 / 31 -> First 31 bits are part of subnet. Remains 1 bit.

  • 192.0.1.0 / 24 -> First 24 bits occupied by subnet. Remains 8 bits.

  • 192.0.1.0 - 192.0.1.255 -> Subnet size = 256.

VLS

Reserved Addresses

  • 127.0.0.0 / 8 -> First 8 bits are reserved.

  • Ex - Local Host 127.0.0.1, Loopback Addresses etc.

IP Packets

  • Header -> 20 bytes.

  • Contains IPv, Length, Identification, Flag, Protocols, Checksums, Addresses, Time to Live(TTL) etc.

IP

IPv6 Addresses

  • IPv4 -> 2^32 ~ 4.3 billion unique addresses.

  • IPv6 is 4 times larger than IPv4.

  • IPv6 -> 2^(32X4) = 2^128 ~ 3.4 X 10^38 unique addresses.

  • Cons :

    • Not backward compatible.
    • Requires lot of efforts to shift to IPv6 from IPv4 because so many devices would have to shift. Requires lot of hardware changes.
  • An IPv6 address typically looks like :

    • A : A : A : A : A : A : A : A, where A is a 16 bit hexadecimal value.
    • Ex - ABFE : F001 : 3210 : 9182 : 0 : 0 : 1 : 3
  • Subnet masking like IPv4 can be done with IPv6 as well.

    • Ex - ABFE : F001 : 3210 : 9182 : : / 60
  • Ways of representation :

    • 0000 -> 0 (single zero for mutiple ones).
    • 1 : 0000 : 0000 : 0000 : 9 ~ 1 : 0 : 0 : 0 : 9 ~ 1 : : 9
    • ': :' signifies 'full of zeroes in between'.

Middleboxes

  • Firewalls for global network, your trusted network.

  • Filters out IP Addresses based on various rules.

    • Addresses
    • Modify Packets
    • Port Numbers
    • Flags
    • Protocols
  • Stateless vs Stateful Firewalls

    • Stateful firewalls are more efficient as they use cache memory.
  • Firewalls are present in network layer as well as transport layer.

  • Network Address Translation(NAT)

Conclusion

You can read other articles written by me through these links.

System Design Series
Introduction To Parallel Computing
Deep Dive Into Virtualization
Insights Into Distributed Computing

Cloud Computing Series
1. Cloud Service Models
2. Cloud Deployment Models
3. Cloud Security
4. Cloud Architecture
5. Cloud Storage
6. Networking In The Cloud
7. Cloud Cost Management
8. DevOps In Cloud & CI/CD
9. Serverless Computing
10. Container Orchestration
11. Cloud Migration
12. Cloud Monitoring & Management
13. Edge Computing In Cloud
14. Machine Learning In Cloud

Computer Networking Series
1. Computer Networking Fundamentals
2. OSI Model
3. TCP/IP Model : Application Layer
4. TCP/IP Model : Transport Layer
5. TCP/IP Model : Network Layer
6. TCP/IP Model : Data Link Layer

Version Control Series
1. Complete Guide to Git Commands
2. Create & Merge Pull Requests
3. Making Open Source Contributions

Linux
Complete Guide to Linux Commands

Thanks For Reading! ๐Ÿ’™
Garvit Singh

ย