Which is NOT a duty of the network layer in the slides?
- Framing is the data link layer.
Network-layer duties, virtual-circuit vs. datagram switching, IPv4 addresses (notation, classes, network/host/broadcast addresses), masks and subnetting, DHCP, ARP, the IPv4 header and fragmentation, and NAT. The subnetting slides have empty practice tables in the PDF; the answers are worked out here in the notes and questions.
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
Services → packet switching (virtual circuit vs. datagram) → IPv4 addressing → subnetting → DHCP, ARP → IPv4 header, fragmentation → NAT.
Practise subnetting until it’s automatic: it is the biggest calculation topic in the course.
Tip Subnet in four lines: block size = 256 - the interesting mask octet · network = the multiple of the block at or below the address · broadcast = next network - 1 · usable = network + 1 to broadcast - 1.
Seen again Ch 1 Part 2, slide 33: Network layer overview
Which is NOT a duty of the network layer in the slides?
Packetizing: wrap the payload in a packet at the source, unwrap at the destination, never change or use it (like the post office).
Routing = run routing protocols to BUILD the routing table (find best paths).
Forwarding = what the router DOES with each arriving packet: pick the output interface.
Memory trick Routing is planning the trip; forwarding is turning at each junction.
Seen again Ch 8, slide 3: Routing protocols fill the table
Deciding which output interface to send an arriving packet on is:
Two packet-switching approaches: virtual circuit (connection-oriented) and datagram (connectionless).
Virtual circuit: set up a connection first, then every packet follows the SAME path and carries a VC identifier (flow label).
Setup reserves resources in every switch. “Virtual” because the circuit is not dedicated wire: resources are shared.
A virtual circuit is called virtual because resources are shared by packets of several connections.
Each switch maps (incoming port, label) → (outgoing port, new label).
Setup and teardown add delay, but no per-packet routing decisions.
Datagram (connectionless): each packet handled independently; packets may take different paths.
Communication at the network layer in the Internet is:
No setup, full addresses in every packet, may arrive out of order, robust (if a router dies, other packets reroute).
Compare the virtual-circuit and datagram approaches.
Virtual circuit: a connection is set up first, all packets follow the same path in order and carry a VC label, resources are reserved, but there is setup delay. Datagram: no setup, every packet carries full source and destination addresses and is routed independently, so packets can take different paths and arrive out of order; it is robust and is what the Internet uses.
In a datagram network, packets are guaranteed to arrive in order.
The router looks only at the destination address.
An IPv4 address is:
2³² ≈ 4.3 billion addresses.
Bit weights: 128 64 32 16 8 4 2 1.
11000000 10101000 00000001 00001010 in dotted decimal is:
Subtract the biggest weight that fits, write 1, continue.
Each octet is 0–255. Also watch for leading zeros (045) and more than four octets.
Which is a valid IPv4 address?
Prefix = network, suffix = host. Network address = host bits all 0.
A router has one IP address PER INTERFACE (one per network it touches).
A router connected to three networks has three IP addresses.
Classful: classes A, B, C, D, E.
First byte: A 0–127 · B 128–191 · C 192–223 · D 224–239 · E 240–255.
Memory trick First-byte limits: 127 / 191 / 223 / 239 / 255.
An address starting with 190 is class:
An address whose first bits are 110 is class:
Class A: /8, 126 usable networks, ~16.7 million hosts each. 127 = loopback.
Class B: /16, 16,384 networks, 65,534 hosts each.
The 127.x.x.x block is reserved for:
How many usable host addresses does one class B block have?
Class C: /24, 254 hosts. Class D: multicast, no net/host split.
Private ranges: 10/8, 172.16–172.31, 192.168/16. Not routable on the Internet (NAT needed).
Seen again This deck, slide 84: Private addresses and NAT
Which address is private?
Class D addresses are used for:
The address 227.12.14.87 is class:
Class A → keep 1 byte, zero the rest: 23.0.0.0.
The network address of 201.14.78.65 (classful) is:
Host bits all 0 → network address. All 1 → directed broadcast. Everything in between is usable.
Directed broadcast = net ID + host all 1s, sent to ANOTHER network. Routers forward it (often blocked: DoS risk).
Trap Directed broadcast (e.g. 192.168.10.255) CAN cross routers; limited broadcast 255.255.255.255 cannot.
Which broadcast address is never forwarded by routers?
The directed broadcast address of 192.168.10.0/24 is:
Shortcut: mask 255 → copy the octet, mask 0 → write 0, otherwise AND in binary.
Tip Mask octets to know by heart: 128 · 192 · 224 · 240 · 248 · 252 · 254 · 255.
Sender ANDs the destination with its mask: same network → deliver directly; different → send to the default gateway.
Host 192.168.10.10/24 sends to 192.168.20.5. What does its network layer do?
It ANDs both addresses with 255.255.255.0: 192.168.10.0 vs. 192.168.20.0, which are different networks, so it hands the packet to the data link layer addressed to the default gateway (the router interface on its own network), not to the destination directly.
Classful is dead: today addresses are classless (CIDR), written /n.
The default mask of a class C address is:
Fill whole octets of 255 (8 bits each), then the leftover bits go in the next octet.
Tip Mask octets to know by heart: 128 · 192 · 224 · 240 · 248 · 252 · 254 · 255.
/20 in dotted decimal is:
/27 in dotted decimal is:
Memorize this list.
1 AND 1 = 1, everything else 0.
Only the octet where the mask is not 255 or 0 needs binary work.
The subnet address of 172.16.200.200/18 is:
The subnet address of 220.1.2.162 with mask 255.255.255.252 is:
One organisation, one block, many departmental LANs → subnetting.
Benefits: less traffic (smaller broadcast domains), easier management, control over the address space, security.
A /22 network has how many usable host addresses?
Example: 192.168.1.0/24 into 5 subnets. 5 - 1 = 4 = 100 → 3 bits → /27 (255.255.255.224).
Weight: the last 1 of the mask sits at 2⁵ = 32 → subnets .0, .32, .64, .96, .128, .160, .192, .224.
Memory trick Bits needed = smallest n with 2ⁿ ≥ subnets. Block size = 256 - the mask octet.
A class C network must be split into 6 subnets. The new mask is:
A class B network uses mask /20. How many subnets?
How many hosts per subnet with mask /20?
The slide’s table is blank in the PDF: these are the answers. Each /27 has 32 addresses, 30 usable.
In 192.168.1.64/27, the broadcast address is:
The first usable host of 192.168.1.160/27 is:
One /27 per floor; .160, .192 and .224 are kept for expansion.
Use the answers on slide 58.
141.14.0.0/16 split into 4 subnets with /18: .0.0, .64.0, .128.0, .192.0.
141.14.0.0/16 is split with mask /18. Which is one of the subnet addresses?
Four settings every host needs: IP address, subnet mask, default gateway, DNS server.
Manual configuration doesn’t work for diskless, newly booted or moved machines → DHCP.
Which is NOT one of the four IP settings a host needs?
Two networks joined by one router: 192.168.10.0/24 (A–D) and 192.168.20.0/24 (S).
Gateway for A–D: the router interface on their LAN (192.168.10.1). For S: 192.168.20.1.
IP: A → S on both sides (unchanged).
MAC from A: source A’s MAC, destination the router’s 192.168.10.1 interface. At S: source the router’s 192.168.20.1 interface, destination S’s MAC.
Seen again Ch 1 Part 2, slide 28: IP stays end to end, MAC changes per hop
In the example, give the source and destination MAC addresses of the frame leaving A, and of the frame arriving at S.
Leaving A: source = A’s MAC, destination = the MAC of the router interface on A’s network (the default gateway). Arriving at S: source = the MAC of the router interface on S’s network, destination = S’s MAC. The IP addresses stay A → S the whole way.
/29 → block 8 → 35 is in 32–39 → network 211.56.77.32, broadcast 211.56.77.39.
Others: 172.16.192.0 and 220.1.2.160 (see slide 52).
The directed broadcast address of 211.56.77.35/29 is:
Trap DHCP lives in the application layer even though it configures network-layer settings.
DHCP is a protocol of which layer?
A DHCP lease means the address is given for a limited period.
IP gets the packet to the right NEXT node logically, but the frame needs that node’s MAC address. ARP finds it.
ARP maps:
Request = BROADCAST (“who has IP N2?”). Reply = UNICAST (“I do, my MAC is L2”).
Memory trick Ask everyone, answer one.
An ARP request is sent as a _ and the reply as a _.
ARP is carried directly in an Ethernet frame (type 0x0806), not inside IP.
Seen again Ch 4, slide 8: The Ethernet type field
TTL: each router subtracts 1; 0 → drop (kills loops).
Protocol field: who gets the payload (TCP 6, UDP 17…). Checksum covers the HEADER only and is recomputed at every router.
Trap The IPv4 checksum does not cover the data.
What happens when a router decrements TTL to 0?
IPv4 fragments can be reassembled at intermediate routers.
The minimum IPv4 header length is:
ICMP 1, IGMP 2, TCP 6, UDP 17, OSPF 89.
The IPv4 protocol value for UDP is:
Each network has its own frame format and size, so a router may have to cut a datagram to fit the next network.
Ethernet MTU = 1500 bytes (= Ethernet’s max data).
The MTU of Ethernet is:
MTU = biggest payload a frame can carry. The datagram must be ≤ MTU, or it gets fragmented.
M = more fragments follow. D = don’t fragment (too big + D = 1 → dropped).
A fragment with M = 0 is:
A router fragments a packet even if D = 1 when it is bigger than the MTU.
Same one’s-complement checksum as Chapter 3, over the header words only.
Seen again Ch 3 Part 1, slide 42: The Internet checksum
Always-on customers each need an address; there aren’t enough. NAT lets many private hosts share one public IP.
Inside: private 172.18.3.x. Outside: one public 200.24.5.8.
Out: the router rewrites the SOURCE (private → public). In: it rewrites the DESTINATION (public → private).
For an outgoing packet, a NAT router changes the:
The table entry made on the way out tells the router where to send the reply.
NAT advantages: saves public addresses, change inside addresses or ISP freely, acts like a firewall (outsiders can’t start a connection in).
Give three advantages of NAT.
It saves public IP addresses (one public address for the whole site); internal addresses can be changed without telling the outside world, and the ISP can be changed without renumbering inside; and it acts like a firewall, since outside hosts cannot open a connection to an internal host unless it started the contact.