← ACARA Digital Technologies Years 9–10

Hops and time to live (TTL)

Time to live: a number in a packet that drops by 1 at each router hop. When it reaches 0 the packet is discarded, so a packet stuck in a loop cannot circle forever.

Understanding Hops and time to live (TTL) in ACARA Digital Technologies Years 9–10

What it does: When a router lowers the TTL to 0, it drops the packet instead of passing it on. Each hop takes 1 off the TTL, so after 3 hops the TTL is 10 minus 3, which is 7. Each router a packet passes through counts as one hop. Three routers means three hops. TTL counts down at every hop. It never counts up. TTL is not about security. It stops lost packets from circling around the network forever. 64 - 5 = 59. TTL drops by 1 at each of the 5 hops. Splitting data is packetising. A hop is each step from one router to the next.

Common mistakes: TTL must go DOWN by 1 at every hop. Adding 1 means it would never reach 0. It should be ttl = ttl - 1. The packet should keep hopping while TTL is greater than 0. ttl < 0 is false at the start, so the loop never runs. It should be while ttl > 0:.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 41–55) and word search (Modules 12–55).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A packet travels from your laptop through 3 routers to reach a server. How many hops did it make?
1 hop, because it is one journey3 hops, one for each router it passed through
Matches
Router A -> Router B -> Router A -> Router B ... TTL stays 30
↓
The TTL must go down at every hop. If it stayed at 30, a packet stuck in a loop would circle forever.
Applying
Meanings
Term
TTL
Meaning
Time to live: a number in a packet that drops by 1 at each router hop. When it reaches 0 the packet is discarded, so a packet stuck in a loop cannot circle forever.
Practice
SET ttl ← 5
Testing
Gaps
ttl = ttl 1
Check Answer
Spots
3while ttl > 0:
4 ttl = ttl + 1

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Moon Jellyfish' badge — Orbital Streak, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A packet travels from your laptop through 3 routers to reach a server. How many hops did it make?
A. 3 hops, one for each router it passed through ✓
B. 1 hop, because it is one journey
Each router a packet passes through counts as one hop. Three routers means three hops.
2. What happens to the TTL value each time a packet reaches a router?
A. It goes up by 1
B. It drops by 1 ✓
TTL counts down at every hop. It never counts up.
3. A packet arrives at a router with a TTL of 1. The router lowers it to 0. What happens next?
A. The packet is discarded ✓
B. The packet is sent on with a TTL of 0
When TTL reaches 0 the router throws the packet away instead of forwarding it.
4. Why do packets carry a TTL value?
A. So the packet can be encrypted
B. So a packet stuck in a loop is eventually discarded ✓
TTL is not about security. It stops lost packets from circling around the network forever.
5. A packet starts with a TTL of 64 and passes through 5 routers. What is its TTL now?
A. 59 ✓
B. 69
64 - 5 = 59. TTL drops by 1 at each of the 5 hops.

Match the Pairs

TTL = 64 → The packet can pass through at most 64 routers (hops) before it is discarded
TTL: 5 -> 4 → The packet has just passed through one router, so its TTL dropped by 1
A packet with TTL 1 is discarded when it reaches the next router, because the TTL hits 0 → TTL = 1 -> 0, discard packet
A packet that goes through 3 routers has made 3 hops, so a starting TTL of 10 becomes 7 → hops = 3, TTL = 10 - 3 = 7
Router A -> Router B -> Router A -> Router B ... TTL stays 30 → The TTL must go down at every hop. If it stayed at 30, a packet stuck in a loop would circle forever.
TTL = 0, so forward the packet to the next router → A packet with TTL 0 must be discarded, not forwarded. Passing it on would let packets live forever.

Key Term

TTL
Time to live: a number in a packet that drops by 1 at each router hop. When it reaches 0 the packet is discarded, so a packet stuck in a loop cannot circle forever.

Fill in the Blanks

1. ttl = ttl - 1
Hint: Type the operator that lowers the TTL by one each time a router passes the packet on.
2. IF ttl = 0 THEN discard packet
Hint: Type the TTL number at which a router throws the packet away.
3. hops = hops + 1
Hint: Type the operator that adds one to the hop count each time a router is crossed.
4. WHILE ttl > 0 DO forward packet to next router ttl = ttl - 1
Hint: Type the loop keyword that keeps forwarding the packet only while its TTL is above zero.
5. ttl = 3 ttl = ttl - 1 PRINT ttl
Hint: Type the variable name that holds the packet's remaining TTL value.

Spot the Error

Question 1
A ttl = 64
B hops = 0
C while ttl > 0:
D ttl = ttl + 1
E hops = hops + 1
Line D — TTL must go DOWN by 1 at every hop. Adding 1 means it would never reach 0. It should be ttl = ttl - 1.
Question 2
A ttl = 5
B while ttl < 0:
C ttl = ttl - 1
D print('Packet discarded')
Line B — The packet should keep hopping while TTL is greater than 0. ttl < 0 is false at the start, so the loop never runs. It should be while ttl > 0:.
Question 3
A path = ['R1', 'R2', 'R3']
B hops = path
C ttl = 64 - hops
D print(ttl)
Line B — The number of hops is the number of routers on the path, so you need len(path). Setting hops = path stores the whole list, not a count.
Question 4
A ttl = 5
B ttl = ttl - 1
C if ttl = 0:
D print('Discard packet')
Line C — A single = assigns a value. To check whether TTL has reached 0 you compare with ==. It should be if ttl == 0:.
Question 5
A hops = 3
B ttl = 64
C ttl = ttl * hops
D print(ttl)
Line C — TTL drops by 1 at each hop, so after 3 hops you subtract 3. Multiplying would make TTL bigger. It should be ttl = ttl - hops.

Student with a class code? Join your class →