Skip to content

Internet Layer

Video: Routing Tables | CCNA - Explained

The Internet layer is responsible for routing and logical addressing across networks. While the Network Access layer enables communication between devices on the same local network, the Internet layer enables communication between devices on different networks using IP addresses.

What is the Internet Layer?

The Internet layer sits on top of the Network Access layer and provides logical addressing and routing functionality. It's responsible for identifying the network to which data needs to be sent and the specific device on that network using IP addresses.

Key Functions:

  • Logical Addressing: Assigns IP addresses to devices
  • Routing: Determines the best path for data packets across networks
  • Packet Forwarding: Moves packets between different networks
  • Fragmentation: Breaks large packets into smaller ones when necessary

IP Addressing

What is an IP Address?

An IP (Internet Protocol) address is a logical address assigned to devices on a network. Unlike MAC addresses which are physical and tied to hardware, IP addresses are logical and can be changed or reassigned.

IP Address Characteristics:

  • Logical: Can be changed without changing hardware
  • Hierarchical: Contains network and host portions
  • Global: Unique across the entire internet
  • Versioned: IPv4 (32-bit) and IPv6 (128-bit)

IPv4 Address Structure

IPv4 addresses are 32-bit numbers typically written in dotted decimal notation.

IPv4 Address Format:

cpp
XXX.XXX.XXX.XXX

Where each XXX is a number from 0 to 255

Example IPv4 Address:

cpp
192.168.1.100

IPv4 Address Classes

IPv4 addresses are divided into classes based on the first few bits:

cpp
IPv4 Address Classes

┌─────────────────┬─────────────────┬─────────────────┬─────────────────┐
│     Class A     │     Class B     │     Class C     │     Class D     │
├─────────────────┼─────────────────┼─────────────────┼─────────────────┤
0XXXXXXX.XXXXXXX10XXXXXX.XXXXXXX110XXXXX.XXXXXXX1110XXXX.XXXXXXX
│ .XXXXXXXX.XXXXXXX│ .XXXXXXXX.XXXXXXX│ .XXXXXXXX.XXXXXXX│ .XXXXXXXX.XXXXXXX│
├─────────────────┼─────────────────┼─────────────────┼─────────────────┤
1.0.0.0 -128.0.0.0 -192.0.0.0 -224.0.0.0 -
126.255.255.255191.255.255.255223.255.255.255239.255.255.255
├─────────────────┼─────────────────┼─────────────────┼─────────────────┤
│ Network.Host    │ Network.Host    │ Network.Host    │ Multicast       │
│ .Host.Host      │ .Host.Host      │ .Host.Host      │ Addresses       │
└─────────────────┴─────────────────┴─────────────────┴─────────────────┘

Class A: Large networks (16 million hosts) Class B: Medium networks (65,000 hosts) Class C: Small networks (254 hosts) Class D: Multicast addresses

Subnetting: Dividing Networks

Subnetting allows you to divide a large network into smaller, more manageable networks.

Subnet Mask: A subnet mask indicates which portion of an IP address belongs to the network and which belongs to the host. Example:

cpp
IP Address:    192.168.1.100
Subnet Mask:   255.255.255.0
Network:       192.168.1.0
Host:          100

IPv4 Header Structure

The IPv4 header contains all the information needed to route packets across networks.

cpp
IPv4 Header Structure

┌─────────────────────────────────────────────────────────────────────────────┐
│                              IPv4 Packet (20 + Payload bytes)               │
├─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────────────────┤
│ Ver │ TOS │      Total Length     │      Identification    │ Flags │ Offset │
│(4b) │(8b) │       (16 bits)       │       (16 bits)        │ (3b)  │ (13b)  │
├─────┼─────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┼─────────────────┤
│ TTL │Protocol│      Checksum      │      Source IP Address                 │
│(8b) │ (8b)  │      (16 bits)      │           (32 bits)                    │
├─────┼─────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┼─────────────────┤
│              Destination IP Address              │       Payload            │
│                    (32 bits)                    │      (variable)          │
├─────┼─────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┼─────────────────┤
40  │      Total Size       │      Packet ID         │ 0 0 00
│     │     │                       │                         │       │        │
├─────┼─────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┼─────────────────┤
646  │      Checksum         │     192.168.1.100      │                 │
│     │(TCP)│                       │                         │                 │
├─────┼─────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┼─────────────────┤
10.0.0.50              │       [Upper Layer Data]               │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────────────────┘

Key Header Fields:Version (4 bits): Always 4 for IPv4 Header Length (4 bits): Length of header in 32-bit words Type of Service (8 bits): Quality of service requirements Total Length (16 bits): Total packet size including header Identification (16 bits): Unique packet ID for fragmentation Flags (3 bits): Control fragmentation (Don't Fragment, More Fragments) Fragment Offset (13 bits): Position of fragment in original packet Time to Live (8 bits): Prevents infinite loops, decremented at each hop Protocol (8 bits): Upper layer protocol (6=TCP, 17=UDP, 1=ICMP) Checksum (16 bits): Header integrity check Source IP (32 bits): Sender's IP address Destination IP (32 bits): Recipient's IP address

Routing

What is a Router?

A router is a network device that connects multiple networks and forwards packets between them. Unlike switches that operate at the Network Access layer and forward packets within the same network, routers operate at the Internet layer and forward packets between different networks.

Router Functions:

  • Network Interconnection: Connects different networks together
  • Packet Forwarding: Routes packets to their destination network
  • Path Selection: Chooses the best route for each packet
  • Traffic Control: Manages network congestion and bandwidth
  • Security: Filters traffic and provides network protection

How Routers Work

Routers examine the destination IP address in each packet and determine the best path to reach that network.

Router Operation Process:

  1. Packet Reception: Receives packet on incoming interface
  2. Header Analysis: Extracts destination IP address
  3. Route Lookup: Consults routing table for best path
  4. Interface Selection: Chooses outgoing network interface
  5. Packet Forwarding: Sends packet to next hop or destination

Router vs Switch Comparison

FeatureRouterSwitch
LayerInternet (Layer 3)Network Access (Layer 2)
AddressingIP addressesMAC addresses
FunctionConnect different networksConnect devices on same network
Broadcast DomainSeparates broadcast domainsSingle broadcast domain
IntelligenceMakes routing decisionsSimple forwarding table
PerformanceSlower (software processing)Faster (hardware switching)

What is Routing?

Routing is the process of determining the best path for packets to travel from source to destination across multiple networks.

Routing Process:

  1. Route Lookup: Router checks routing table for destination network
  2. Next Hop: Determines next router or final destination
  3. Interface Selection: Chooses outgoing network interface
  4. Packet Forwarding: Sends packet to next hop

Routing Tables

A routing table contains information about how to reach different networks.

Routing Table Entry:

cpp
Destination Network | Subnet Mask | Next Hop | Interface | Metric
192.168.1.0        | 255.255.255.0| 0.0.0.0  | eth0      | 1
10.0.0.0           | 255.0.0.0    | 192.168.1.1| eth0    | 2
0.0.0.0            | 0.0.0.0      | 192.168.1.1| eth0    | 3

Types of Routing

Static Routing:

  • Routes manually configured by administrator
  • Simple but doesn't adapt to network changes
  • Used in small, stable networks

Dynamic Routing:

  • Routes automatically learned and updated
  • Adapts to network topology changes
  • Used in large, complex networks

Packet Fragmentation

When a packet is too large for a network link, it must be fragmented into smaller pieces.

Fragmentation Process

  1. Size Check: Compare packet size with MTU
  2. Fragmentation: Split packet into smaller fragments
  3. Header Creation: Create new headers for each fragment
  4. Reassembly: Destination reassembles fragments

Questions

Q: What is the main protocol used at the Internet layer?

IP (Internet Protocol) is the main protocol used at the Internet layer. It provides logical addressing and routing functionality.

Q: What is the purpose of IP addresses?

IP addresses provide logical addressing for routing. They identify networks and specific devices on those networks, enabling packets to be routed across different networks.

Q: What is the primary function of a router?

A router connects different networks and routes packets between them. It examines the destination IP address and determines the best path to forward packets.

Q: What does TTL stand for in IP headers?

TTL stands for Time To Live. It's a field in IP headers that prevents packets from circulating forever by limiting the number of hops a packet can take.

Q: What is the purpose of subnetting?

Subnetting divides large networks into smaller, manageable networks. It improves network performance, security, and management by creating logical divisions within a network.

Q: What is the difference between static and dynamic routing?

Static routing is manually configured by administrators and doesn't change, while dynamic routing automatically learns and updates routes based on network topology changes.

Q: What is the purpose of ARP (Address Resolution Protocol)?

ARP finds the MAC address of a device when only its IP address is known. It broadcasts a request asking 'Who has IP address X?' and the device with that IP responds with its MAC address.