Internet Protocol (IP)

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Internet Protocol (IP)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does the Internet Protocol (IP) put on each packet so routers can deliver it?
A A password and a username
B Source and destination IP addresses
2. Which statement about IP is true?
A IP is best-effort: it does not guarantee a packet arrives
B IP guarantees every packet arrives
3. A router drops a packet because its link is overloaded. What does IP do about it?
A Nothing. IP does not resend lost packets
B IP automatically resends the packet
4. Which part of the packet does a router read to decide where to forward it?
A The destination IP address
B The source IP address only
5. Which of these is an IPv4 address?
A 2001:0db8:85a3::8a2e:0370:7334
B 192.168.0.12

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Source IP: 192.168.1.20 AIPv4: 192.168.1.20 IPv6: 2001:db8::1
2Destination IP: 203.0.113.8 BPacket 7 dropped by a busy router - IP does not resend it
3IP is best-effort: it tries to deliver each packet but does not guarantee that it arrives CIP is best-effort and gives no guarantee, so packets can be lost, and a protocol like TCP is needed to detect and fix this
4IP has two versions, with IPv4 using shorter addresses than IPv6 DThe receiver's address, which routers read to decide where to forward the packet
5IP guarantees every packet will arrive, so no packet is ever lost EEach packet carries both a source and a destination IP address, so the receiver knows who sent it and can reply
6Each packet carries only a destination IP address, with no source IP address FThe sender's address, which IP puts on each packet so the destination knows where it came from

Definitions

Internet Protocol (IP)

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
packet.______ = "192.168.1.20" packet.dest = "203.0.113.9"
2.
deliveryGuaranteed = _____
3.
addressBits = 32 version = "____"
4.
if version == "IPv6": addressBits = ___
5.
if packet.dest __ myIp: accept(packet) else: forward(packet)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A packet = {}
B packet["src"] = "192.168.1.5"
C packet["dst"] = "203.0.113.9"
D forward_to(packet["src"])
Question 2
A version = 4
B address = "192.168.0.12"
C parts = address.split(".")
D print(len(parts) == 6)
Question 3
A sent = ip_send(packet)
B guaranteed = True
C if not guaranteed:
D print("may be lost")
Question 4
A addr = "2001.db8.0.1"
B groups = addr.split(":")
C print(len(groups))
D print("IPv6 uses colons")
Question 5
A packet = {}
B packet["dst"] = "192.168.1.300"
C send(packet)

Answer Key

Internet Protocol (IP)
Section A: Quick Questions
Q1
B — Source and destination IP addresses
Q2
A — IP is best-effort: it does not guarantee a packet arrives
Q3
A — Nothing. IP does not resend lost packets
Q4
A — The destination IP address
Q5
B — 192.168.0.12
Section B: Match the Pairs
Q1
Source IP: 192.168.1.20 → The sender's address, which IP puts on each packet so the destination knows where it came from
Q2
Destination IP: 203.0.113.8 → The receiver's address, which routers read to decide where to forward the packet
Q3
IP is best-effort: it tries to deliver each packet but does not guarantee that it arrives → Packet 7 dropped by a busy router - IP does not resend it
Q4
IP has two versions, with IPv4 using shorter addresses than IPv6 → IPv4: 192.168.1.20 IPv6: 2001:db8::1
Q5
IP guarantees every packet will arrive, so no packet is ever lost → IP is best-effort and gives no guarantee, so packets can be lost, and a protocol like TCP is needed to detect and fix this
Q6
Each packet carries only a destination IP address, with no source IP address → Each packet carries both a source and a destination IP address, so the receiver knows who sent it and can reply
Section C: Definitions
Q1
Internet Protocol (IP) — The protocol that puts source and destination IP addresses on each packet so routers can deliver it. It is best-effort: it does not guarantee a packet arrives.
Section D: Fill in the Blanks
Q1
packet.source = "192.168.1.20" packet.dest = "203.0.113.9"
Q2
deliveryGuaranteed = false
Q3
addressBits = 32 version = "IPv4"
Q4
if version == "IPv6": addressBits = 128
Q5
if packet.dest == myIp: accept(packet) else: forward(packet)
Section E: Spot the Error
Q1
D — Routers deliver a packet using its destination IP address, not its source address. The line should be forward_to(packet["dst"]).
Q2
D — An IPv4 address is made of four numbers separated by dots, so the check should be len(parts) == 4, not 6.
Q3
B — IP is best-effort, so it does not guarantee that a packet arrives. The line should be guaranteed = False.
Q4
A — IPv6 addresses are written in hexadecimal groups separated by colons, not dots. It should be addr = "2001:db8::1".
Q5
B — Each number in an IPv4 address must be from 0 to 255, so 300 is invalid. A valid destination is "192.168.1.30".