StudyVault
Home Unit Overview Exam Technique Revision Techniques ← Previous Lesson Next Lesson →

← Back to Dashboard

Overlay:
0:00 / 0:00 Narration generated using AI text-to-speech.

Packet Switching and Routing

What Is Packet Switching?

When you send a large file or load a web page, the data is not sent as one continuous stream. Instead it is broken into small chunks called packets. Each packet travels independently through the network and may take a different route to the same destination. At the destination, the packets are reassembled in the correct order. This approach is called packet switching.

Packet switching was designed to be resilient: if one route through the network is congested or broken, packets are automatically sent via an alternative path. This makes it far more robust than circuit switching, which reserves a dedicated path for the entire duration of a call (as used in traditional telephone networks).

The Structure of a TCP/IP Packet

A packet has two main sections: the packet header and the packet payload.

The header contains:

  • Source IP address — the IP address of the sending device.
  • Destination IP address — the IP address of the receiving device.
  • Packet number / sequence number — used to reassemble packets in the correct order at the destination.
  • Time to Live (TTL) — a counter decremented by each router the packet passes through. When TTL reaches zero, the packet is discarded. This prevents packets looping forever if they get lost.
  • Error-checking data — a checksum value used by the destination to verify the packet arrived without corruption.

The payload carries the actual content — a portion of the file, image or web page being transmitted. Most packets carry between 500 and 1,500 bytes of payload data.

Key Fact

A packet header contains: source IP address, destination IP address, sequence number (for reassembly), Time to Live (TTL, prevents endless looping) and a checksum (error checking). The payload holds the actual data being sent.

How Packet Switching Works

When data is sent:

  1. The sending device breaks the data into packets and adds a header to each one.
  2. Each packet is sent into the network independently. Packets do not have to travel together.
  3. Each router the packet encounters reads the destination IP address in the header and forwards the packet towards its destination along the best available route.
  4. Packets from the same file may arrive at the destination in a different order from the one in which they were sent.
  5. The receiving device uses the sequence numbers in the headers to reassemble the packets in the correct order. If a packet is missing, TCP requests it to be resent.

The advantage of this approach is that the network can route packets around failures and congestion in real time. The internet would not function at global scale without packet switching.

Routing and Routing Cost Calculation

A routing cost is a value assigned to each link between two routers. When a packet needs to travel from source to destination, the router calculates the total cost of each possible path and chooses the path with the lowest total cost.

Routing cost can be based on different factors:

  • Hop count — the number of routers (hops) the packet must pass through. Fewer hops = lower cost.
  • Bandwidth — the capacity of the link. Higher bandwidth links are cheaper (faster).
  • Latency — the time taken for a packet to travel along the link. Lower latency = lower cost.
  • Congestion — a heavily used link has a higher cost.

Consider four routers: A, B, C and D. A packet needs to travel from A to D. The available links and their costs are:

LinkCost
A → B4
A → C2
B → D3
C → D6
C → B1

Possible paths from A to D:

  • Path 1: A → B → D — total cost = 4 + 3 = 7
  • Path 2: A → C → D — total cost = 2 + 6 = 8
  • Path 3: A → C → B → D — total cost = 2 + 1 + 3 = 6

The router would select Path 3 (A → C → B → D) with a total cost of 6 — the lowest. Note that this path goes through three hops, not two, but it is cheaper because the A→C and C→B links are low cost.

Exam tip: always write out all possible paths and add up their costs before identifying the lowest. Do not assume the path with fewest hops is always cheapest.

Routers use a routing table to look up the best path for each destination. There are two ways to populate this table:

Static routing — routes are manually configured by a network administrator. The path never changes unless an administrator updates it. Static routing is simple and predictable but cannot adapt to network failures automatically.

Dynamic routing — routers share information with each other using routing protocols and automatically update their tables when the network changes. If a link fails, dynamic routing finds an alternative path within seconds. Most large networks, including the internet, use dynamic routing.

Key Fact

To calculate the cheapest route in a network, list all possible paths from source to destination, add up the costs of all links on each path, and select the path with the lowest total. The cheapest path is not always the one with the fewest hops.

Practice Questions

Test yourself on this lesson. Pick a question, write your answer, then get it marked.

AI feedback
AI feedback is guidance, not a final exam mark. If you disagree, your teacher's view is always the tie-breaker.
← Back to unit
Video

© 2026 StudyVault · About · FAQ · Copyright & IP · Privacy · Disclaimers

StudyVault Education Ltd · registered in England and Wales, company no. 17490559 · 71–75 Shelton Street, London WC2H 9JQ