IP addressing and subnets — exam-style exercises with masks, classes, fragments and ARP (and the DHCP ports I got the wrong way round)
In the last IC2 mock test I reached the DHCP question in such a hurry that I answered from memory: “the server listens on 68 and the client on 67”. True, next one. It was false, and the worst part is that I knew it: I had read it that very morning. What I was missing was a trick so I would not hesitate. Now I tell myself this: the server arrives first, so it gets the lower number (67), and the client, who comes later, gets the next one (68). Silly, but I have not got it wrong since.
This article is for training exactly that: the details you know but mix up under pressure. There is an interactive quiz with every exam format (single choice, multiple choice where wrong ticks subtract, true or false, gap filling, matching, ordering, short answer and two table calculations, one on fragments and one on subnets), four open questions with model answers, a picture with the whole topic and the cheat sheet for the night before. If you have not read the theory yet, start with IP addressing and subnets explained: here it is taken as known. And if you come from the OSI and TCP/IP models exercises, this is the next step.
Table of Contents
How to use this article
- Do the quiz without looking at the theory. Answer each question and press “Check”: you will see whether you got it right and, above all, why (and why the other options are wrong).
- Treat it like the real exam. In multiple-answer questions every wrong tick subtracts: if you are not sure, do not tick.
- Do the calculations on paper before typing them: the AND byte by byte, the offsets by adding up the previous data, and the hosts with 2^h − 2. In the tables you type a single number per cell.
- Write the open answers before opening the model answer. Then compare it with the “what the marker looks for” list and count how many points you covered. Revise at the end with the cheat sheet and do the quiz again another day: the options are shuffled every time.
The examples use the faculty network from the theory: the laptop 10.110.7.24 with mask 255.255.255.0, the gateway 10.110.7.1 and the campus server 10.200.1.80. If a question sounds strange, think about what that laptop would do.
Quiz: multiple-choice questions
There are 31 questions in the order of the theory: internetworking, addresses and classes, the IP protocol, header and fragmentation, routing, subnets and support protocols. At the end you will see your mark out of 10, calculated as in the exam.
Which of these are premises of the TCP/IP internetwork? (Tick only the ones that are: every wrong tick subtracts)
- Users should not need to know how the networks are interconnected
- No particular topology is imposed
- The internetwork is independent of the user interface
- Every router knows every device on the Internet
- Every physical network uses the same technology
Solution
Answer: Users should not need to know how the networks are interconnected · No particular topology is imposed · The internetwork is independent of the user interface
The idea of the internetwork is to make many different physical networks look like one. To do that, it hides how they are joined, imposes no topology and does not depend on the user interface.
The faculty router receives a datagram for 10.200.1.80. What does it look at to decide where to send it?
- The network the destination belongs to (10.200.1.0), and it looks for the next router
- The server’s MAC
- The server’s domain name
- The service’s TCP port
Solution
Answer: The network the destination belongs to (10.200.1.0), and it looks for the next router
A router does not keep a route for every device in the world: it keeps networks. It works out the destination’s network and looks up the next hop in its table.
About IP addresses:
- An IPv4 address takes 4 bytes
- The laptop’s IP is the same as its Wi-Fi card’s MAC
- In 10.110.7.24 each of the four numbers is one byte written in decimal
- IPv6 uses 64-bit addresses
- The IP identifies the device’s connection to the network, not the device itself
Solution
- T — An IPv4 address takes 4 bytes
- F — The laptop’s IP is the same as its Wi-Fi card’s MAC
- T — In 10.110.7.24 each of the four numbers is one byte written in decimal
- F — IPv6 uses 64-bit addresses
- T — The IP identifies the device’s connection to the network, not the device itself
IPv4 has 32 bits (4 bytes) and IPv6 128. The IP is not the card’s physical address (the MAC), and what it identifies is the connection: a router with three interfaces has three IPs.
Match each address with its class:
| 10.110.7.24 | |
| 172.30.3.5 | |
| 193.145.138.32 | |
| 224.0.0.9 |
Definitions:
- Class D (multicast)
- Class C
- Class A
- Physical address (MAC)
- Class B
Solution
- 10.110.7.24 → Class A
- 172.30.3.5 → Class B
- 193.145.138.32 → Class C
- 224.0.0.9 → Class D (multicast)
The first byte is enough: 0-127 is A (starts with 0), 128-191 is B (10), 192-223 is C (110) and 224-239 is D (1110).
Fill in the leading bits of each class:
A class B address starts with ____, a class C one with ____ and a multicast (class D) one with ____.
Words:
- 1111
- 110
- 01
- 10
- 1110
- 00
Solution
A class B address starts with 10, a class C one with 110 and a multicast (class D) one with 1110.
Each class adds a 1 in front: A = 0, B = 10, C = 110, D = 1110. That is why the first byte of a class C goes from 192 (11000000) to 223 (11011111).
What class is the address 191.4.20.1?
- Class B
- Class C
- Class A
- Class D
Solution
Answer: Class B
Convert it to binary: 191 = 10111111. The first two bits are 10, so it is class B. It is the last class B value for the first byte: 192 is already C.
About the service the IP protocol gives:
- IP does not set up a connection before sending data
- IP reorders datagrams that arrive out of order
- Two datagrams from the same transfer can take different paths
- IP guarantees that no duplicate datagrams arrive
- If a datagram is lost, IP asks for it to be resent
Solution
- T — IP does not set up a connection before sending data
- F — IP reorders datagrams that arrive out of order
- T — Two datagrams from the same transfer can take different paths
- F — IP guarantees that no duplicate datagrams arrive
- F — If a datagram is lost, IP asks for it to be resent
IP is connectionless and does no sequence control, no flow control and no error recovery. It decides the route of each datagram separately, so there may be losses, disorder and duplicates: TCP, further up, takes care of that.
What is the packet called that is the smallest block of information in a datagram-switched network and carries the source and destination in its header?
Solution
Answer: datagram
It is the datagram: since it carries source and destination in its header, each one is handled independently.
Match each IPv4 header field with what it holds:
| IHL | |
| Total length | |
| Identification | |
| Time to live | |
| Fragment offset |
Definitions:
- Size of the whole datagram, in bytes
- Header length, in 32-bit words
- Physical address of the next router
- Stops a datagram going round the network forever
- Number shared by all the fragments of the same datagram
- Position of the fragment's data inside the original datagram
Solution
- IHL → Header length, in 32-bit words
- Total length → Size of the whole datagram, in bytes
- Identification → Number shared by all the fragments of the same datagram
- Time to live → Stops a datagram going round the network forever
- Fragment offset → Position of the fragment’s data inside the original datagram
The next router’s MAC is not in the IP header: it goes in the frame of the network access layer.
An IPv4 header without options is 20 bytes long. What value does its IHL field hold?
Solution
Answer: 5
IHL counts 32-bit (4-byte) words: 20 / 4 = 5. It is the minimum value.
A datagram arrives with IHL = 6. How long is its header?
- 24 bytes
- 6 bytes
- 20 bytes
- 48 bytes
Solution
Answer: 24 bytes
Always multiply by 4: IHL × 4 = header bytes.
A datagram has DF = 1 and does not fit in the next network’s MTU. What does the router do?
- It cannot fragment it: it discards it and tells the source with an ICMP “fragmentation needed” message
- It fragments it anyway
- It reassembles it with other fragments
- It sets MF = 0 and sends it whole
Solution
Answer: It cannot fragment it: it discards it and tells the source with an ICMP “fragmentation needed” message
DF (Don’t Fragment) set to 1 forbids splitting the datagram. If it does not fit, the router drops it and ICMP tells the source (the “fragmentation needed” code).
About the header flags:
- MF = 1 in a fragment means more fragments follow
- The last fragment of a datagram has MF = 0
- Bit 0 of the flags must be 1
- With DF = 0 the datagram can be fragmented
Solution
- T — MF = 1 in a fragment means more fragments follow
- T — The last fragment of a datagram has MF = 0
- F — Bit 0 of the flags must be 1
- T — With DF = 0 the datagram can be fragmented
The flags are 3 bits: bit 0 is reserved and is 0, bit 1 is DF (1 = don’t fragment) and bit 2 is MF (1 = more fragments, 0 = last).
A datagram with 1000 bytes of data reaches a network with MTU 420 (20-byte header, so 400 bytes of data fit per fragment). Fill in the table with the offset in bytes, as in the notes:
| Fragment | Data bytes | Offset | MF |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 |
Solution
| Fragment | Data bytes | Offset | MF |
|---|---|---|---|
| 1 | 400 | 0 | 1 |
| 2 | 400 | 400 | 1 |
| 3 | 200 | 800 | 0 |
400 + 400 + 200 = 1000. Each offset is the sum of the previous data: 0, 400 and 400 + 400 = 800. Only the last one has MF = 0. (In the real header it would be stored in 8-byte units: 0, 50 and 100.)
About fragment reassembly in TCP/IP:
- Fragments are joined at the destination device
- Every router along the way reassembles and fragments again
- If a fragment is lost, the destination cannot rebuild the datagram and discards it when its timer runs out
- All the fragments of a datagram have to take the same path
Solution
- T — Fragments are joined at the destination device
- F — Every router along the way reassembles and fragments again
- T — If a fragment is lost, the destination cannot rebuild the datagram and discards it when its timer runs out
- F — All the fragments of a datagram have to take the same path
Reassembling at the destination frees routers from the work and lets each fragment take its own path. The downside: it is less efficient, and a single lost fragment makes all the others useless.
Work out the network: 10.110.12.5 AND 255.255.255.0 = ?
Solution
Answer: 10.110.12.0
The first three bytes of the mask are 255 (all ones) and go through unchanged; the last one is 0 and sets the byte to zero: 10.110.12.0.
The laptop (10.110.7.24, mask 255.255.255.0) sends a job to the printer 10.110.7.200. How does it deliver it?
- Directly: it is on the same network, so it asks for its MAC with ARP and sends it the frame
- It sends it to the gateway 10.110.7.1
- It asks DNS for the printer
- It discards it because the printer is not a router
Solution
Answer: Directly: it is on the same network, so it asks for its MAC with ARP and sends it the frame
Same AND, same network: direct delivery. The router does not even notice.
By mistake, the laptop has the mask 255.255.0.0 instead of 255.255.255.0 and pings 10.110.12.5, which is in classroom 12, behind the router. What happens?
- The laptop thinks 10.110.12.5 is on its network, asks for its MAC with ARP in classroom 7 and nobody answers
- It sends it correctly to the gateway, because the router fixes the mask
- The classroom switch forwards it to classroom 12
- It works just the same, the mask does not affect sending
Solution
Answer: The laptop thinks 10.110.12.5 is on its network, asks for its MAC with ARP in classroom 7 and nobody answers
10.110.12.5 AND 255.255.0.0 = 10.110.0.0, the same as the laptop’s network with that mask. So it tries direct delivery and the ARP request gets no answer, because the device is on another network.
Match each type of routing with its description:
| Direct | |
| Indirect with static tables | |
| Indirect with dynamic tables |
Definitions:
- The datagram is sent to every device on the Internet
- The administrator writes the routes by hand and they do not change on their own
- Routers exchange information every so often and recalculate the routes
- The destination is on a network the device is connected to
Solution
- Direct → The destination is on a network the device is connected to
- Indirect with static tables → The administrator writes the routes by hand and they do not change on their own
- Indirect with dynamic tables → Routers exchange information every so often and recalculate the routes
Direct = same network, no router. Indirect = through routers, with tables that can be static (by hand, they do not adapt to changes) or dynamic (they build themselves and adapt).
Which columns does a routing table have as a minimum? (every wrong tick subtracts)
- The destination network
- The address of the next router (or the interface’s IP if the network is connected)
- The final destination’s MAC
- The time to live of each datagram
- The destination’s DNS name
Solution
Answer: The destination network · The address of the next router (or the interface’s IP if the network is connected)
The minimum is two columns: destination network and next hop. Fuller tables add the mask and a cost.
Put in order the steps a router follows with its table:
- Compare the result with the row’s destination network
- Take the destination IP from the datagram
- If it matches, send the datagram to that row’s next hop
- If no row matches, discard the datagram
- AND that IP with the row’s mask
Solution
Correct order:
- Take the destination IP from the datagram
- AND that IP with the row’s mask
- Compare the result with the row’s destination network
- If it matches, send the datagram to that row’s next hop
- If no row matches, discard the datagram
It is the algorithm in the notes: row by row, N = ID AND mask; if N matches the row’s network, it is sent; if the rows run out, it is discarded.
What is the 0.0.0.0 row with mask 0.0.0.0 at the end of the table for?
- It is the default route: any IP AND 0.0.0.0 gives 0.0.0.0, so it picks up everything else
- It blocks datagrams with no destination
- It sends the datagram to every device (broadcast)
- It represents the router’s own network
Solution
Answer: It is the default route: any IP AND 0.0.0.0 gives 0.0.0.0, so it picks up everything else
With the mask all zeros, the AND always gives 0.0.0.0, which matches the row’s network. If it came first, it would swallow every datagram.
Complete the definition of a subnet mask:
The mask has 32 bits: a bit set to ____ means that bit belongs to the ____ identifier and a bit set to ____ means it belongs to the ____ identifier.
Words:
- 2
- 0
- router
- network
- host
- 1
- port
Solution
The mask has 32 bits: a bit set to 1 means that bit belongs to the network identifier and a bit set to 0 means it belongs to the host identifier.
Ones mark the network (and subnet) and zeros the host. The notes also call the host the station.
The classroom 7 network, 10.110.7.0, is split into four subnets with the mask 255.255.255.192. Fill in the last byte of each subnet’s network and broadcast addresses, and how many hosts fit:
| Subnet | Network (last byte) | Broadcast (last byte) | Hosts |
|---|---|---|---|
| 1st | |||
| 2nd | |||
| 3rd | |||
| 4th |
Solution
| Subnet | Network (last byte) | Broadcast (last byte) | Hosts |
|---|---|---|---|
| 1st | 0 | 63 | 62 |
| 2nd | 64 | 127 | 62 |
| 3rd | 128 | 191 | 62 |
| 4th | 192 | 255 | 62 |
192 = 11000000: two more bits for the subnet and 6 for the host. Each subnet has 2⁶ = 64 addresses, so they go up in steps of 64. The first one (all zeros) is the network and the last (all ones) the broadcast: that leaves 64 − 2 = 62 hosts.
With the mask 255.255.255.192, what is the network address of the subnet 10.110.7.100 is in?
Solution
Answer: 10.110.7.64
100 AND 192: 01100100 AND 11000000 = 01000000 = 64. The subnet is 10.110.7.64 (from .64 to .127).
How many hosts fit in a subnet with mask 255.255.255.240?
- 14
- 16
- 240
- 30
Solution
Answer: 14
Count the zeros in the mask (h) and work out 2^h − 2.
Match each protocol or application with what it does:
| ARP | |
| RARP | |
| ICMP | |
| DHCP | |
| DNS |
Definitions:
- Carries error and control messages back to the source
- Reassembles fragments at every router
- Gives a device its network configuration when it connects
- Translates a name like www.ulpgc.es into an IP address
- Finds the MAC that corresponds to an IP on the same network
- A device that only knows its MAC asks a server for its IP
Solution
- ARP → Finds the MAC that corresponds to an IP on the same network
- RARP → A device that only knows its MAC asks a server for its IP
- ICMP → Carries error and control messages back to the source
- DHCP → Gives a device its network configuration when it connects
- DNS → Translates a name like www.ulpgc.es into an IP address
ARP goes from IP to MAC and RARP the other way round (Reverse). ICMP reports errors, DHCP configures and DNS translates names. No protocol reassembles fragments at the routers: it happens at the destination.
The laptop needs its gateway’s MAC (10.110.7.1). Put in order what happens:
- IP can now deliver the datagram in a frame addressed to that MAC
- The router recognises its IP and replies only to the laptop with its MAC
- Every device in the classroom receives the request
- The laptop sends the whole network an ARP request with the IP 10.110.7.1 and its own IP-MAC pair
- The laptop stores the IP-MAC pair in its ARP cache
Solution
Correct order:
- The laptop sends the whole network an ARP request with the IP 10.110.7.1 and its own IP-MAC pair
- Every device in the classroom receives the request
- The router recognises its IP and replies only to the laptop with its MAC
- The laptop stores the IP-MAC pair in its ARP cache
- IP can now deliver the datagram in a frame addressed to that MAC
Question by broadcast, direct answer and a cache so it does not ask again. Since the request carries the laptop’s IP-MAC pair, the router can note it down too.
Put in order the messages a laptop uses to get a new address through DHCP:
- DHCPOFFER: each server offers an address
- DHCPREQUEST: the client asks for the offer it chose
- DHCPDISCOVER: the client looks for servers by broadcast
- DHCPACK: the chosen server confirms the allocation
Solution
Correct order:
- DHCPDISCOVER: the client looks for servers by broadcast
- DHCPOFFER: each server offers an address
- DHCPREQUEST: the client asks for the offer it chose
- DHCPACK: the chosen server confirms the allocation
Discover, Offer, Request, Ack (DORA). If the server cannot fulfil it, it answers DHCPNACK and the client starts again; if the client sees with ARP that the IP is already in use, it sends DHCPDECLINE.
About ICMP and DHCP:
- ICMP reports the error to the device that sent the original datagram
- ICMP messages travel inside the data field of an IP datagram
- ping uses ICMP’s echo request and echo reply messages
- In DHCP, the client listens on UDP port 67
- DHCP’s dynamic allocation lends the address for a period of time
Solution
- T — ICMP reports the error to the device that sent the original datagram
- T — ICMP messages travel inside the data field of an IP datagram
- T — ping uses ICMP’s echo request and echo reply messages
- F — In DHCP, the client listens on UDP port 67
- T — DHCP’s dynamic allocation lends the address for a period of time
ICMP only reports to the original source, not to the routers along the way. ping sends echo requests (type 8) and receives replies (type 0). In DHCP the server listens on 67 and the client on 68.
Which DHCP mechanism gives a device a permanent address the first time it connects?
- Automatic allocation
- Dynamic allocation
- RARP
- ARP
Solution
Answer: Automatic allocation
Automatic = for good; dynamic = a timed loan. Careful: the name is misleading, because the server does both without any human involved.
In the class questions, do not convert to binary unless you need to: look at the first byte and compare it with 128, 192 and 224. And in the subnet ones, 256 minus the last byte of the mask gives you the size of each subnet.
Open questions
The IC2 exam has written questions, and how ARP works is one that comes up. Here you have that one and three more that fit the topic: routing with its table, subnets with their mask, and fragmentation. Write your answer in the box (a well-linked paragraph, as in the exam) and then open the model answer.
Explain how the ARP protocol works.
Solution
Model answer:
ARP (Address Resolution Protocol) obtains the physical (MAC) address of a device on the same network from its IP address. When a device A has to deliver a datagram to B and only knows its IP, A’s ARP process sends an ARP request by broadcast with B’s IP and with A’s own IP-MAC pair. Every device on the network receives the request, but only B recognises its IP and answers A directly with an ARP reply containing its MAC. A stores the IP-MAC pair in its ARP cache (you can see it with arp -a), so the following datagrams do not need to ask, and the IP process can now deliver the datagram in a frame addressed to that MAC. If the destination is on another network, what is asked for is the router’s (the gateway’s) MAC. The reverse operation, getting an IP from a MAC, is done by RARP with the help of a server.
What the marker looks for:
- What it does: from IP to MAC, within the same network
- The request goes by broadcast and carries the sender’s IP-MAC pair
- Only the owner of the IP answers, directly to whoever asked
- The ARP cache, so the question is not repeated
- For a destination on another network the gateway’s MAC is asked for, or the difference with RARP
If you tell it with an example (the laptop asking for its gateway), you gain clarity and lose nothing.
Explain the difference between direct and indirect routing and how a router uses its routing table.
Solution
Model answer:
Routing is the network-layer function that decides the path of datagrams between networks. It is direct when the destination is on a network the device is connected to: it is delivered without going through any router (the MAC is found with ARP and the frame is sent). It is indirect when the destination is on another network: the datagram is handed to the next router, which decides again. To decide, the routing table is used, which has at least the destination network and the next hop (or “direct”), and usually the mask and a cost too. The router takes the destination IP from the datagram and, row by row, ANDs it with the mask; if the result matches the row’s network, it sends the datagram to its next hop, and if no row matches, it discards it. The 0.0.0.0 row with mask 0.0.0.0 is the default route and goes last. Tables can be static, written by hand and not adapting to changes, or dynamic, built automatically by routers exchanging information every so often.
What the marker looks for:
- Definition of routing as a network-layer function
- Direct (same network) vs indirect (through the next router)
- Table columns: destination network, next hop (mask and cost)
- The algorithm: AND with the mask, compare, send or discard
- Default route and static vs dynamic tables
A worked example (10.200.1.80 AND 255.255.255.0 = 10.200.1.0) shows you have understood it.
What are subnets and what is the subnet mask for? Give an example.
Solution
Model answer:
Subnets make it possible to use a single network identifier for several physical networks: some of the most significant bits of the host (station) part are used to identify the subnet. From outside it looks like one network, and inside the router shares traffic out among the subnets. The subnet mask has 32 bits: it is 1 in the bits that identify the network (subnet included) and 0 in the ones that identify the host. A bitwise AND between an IP and its mask gives the network it belongs to. For example, the faculty has the network 10.110.0.0 and uses the third byte for the classroom with the mask 255.255.255.0: the laptop 10.110.7.24 is in the subnet 10.110.7.0 (classroom 7) and the printer 10.110.12.5 in 10.110.12.0 (classroom 12), so between them traffic has to go through the router. In each subnet, the address with all host bits at 0 is the network address and the one with them all at 1 is the broadcast address, so 2^h − 2 hosts fit (with 8 host bits, 254).
What the marker looks for:
- Definition: one network identifier for several networks, with bits from the host part for the subnet
- Mask: 1 = network, 0 = host
- The AND between IP and mask to get the network
- An example with numbers that add up
- Network address, broadcast address and number of hosts (2^h − 2)
The definition from the notes is the first two sentences; the example and the calculations are what push the mark up.
Explain the fragmentation of an IP datagram and where it is reassembled, with its advantages and disadvantages.
Solution
Model answer:
Every network has an MTU, the maximum size a frame can carry. If a datagram does not fit in the next network’s MTU, the router splits it into fragments, each with its own IP header. All the fragments carry the same identification; the fragment offset field says which part of the original datagram their data belongs to, and the MF flag is 1 in all of them except the last, which has MF = 0. If the DF flag is 1, the datagram cannot be fragmented. For example, 1400 bytes of data on a network with MTU 620 come out as three fragments of 600, 600 and 200 bytes with offsets 0, 600 and 1200. In TCP/IP, reassembly happens at the destination device. Advantages: each fragment can be routed separately, through different networks, and routers are not overloaded. Disadvantages: it is less efficient and, if a single fragment is lost, the destination cannot rebuild the datagram (the reassembly timer runs out) and the whole datagram is lost.
What the marker looks for:
- Why fragmentation happens: the network’s MTU
- Fields involved: identification, offset, MF and DF
- An example with correct offsets
- Reassembly at the destination, not at the routers
- Advantages and disadvantages
What people forget most in the exam: saying where reassembly happens and why that is an advantage.
Open answers are marked on concepts, not exact sentences. An example with numbers that add up (an AND, some offsets) shows you understand it and often makes the difference.
The whole topic in one picture
Before the cheat sheet, a map of everything that comes up. IP in the middle and, around it, what you need to know about each part. If you can explain every card without looking, you have the topic.
Cheat sheet: IP addressing and subnets
The essentials in 30 seconds
- IPv4 = 32 bits (4 bytes in decimal with dots); IPv6 = 128 bits. The IP identifies the connection and is not the MAC.
- Classes: A starts with
0(1st byte 0-127), B with10(128-191), C with110(192-223), D with1110(224-239, multicast). - IP: connectionless, independent datagrams, no sequence, flow or error control; there can be losses, disorder and duplicates.
- Header: IHL in 32-bit words (minimum 5 = 20 bytes); DF = 1 don’t fragment; MF = 0 last fragment; TTL so it does not circulate forever.
- Routing: direct if it is the same network; indirect with a table (destination network → next hop); network = IP AND mask; the default route 0.0.0.0/0.0.0.0 goes last.
- Subnets: mask 1 = network, 0 = host; 2^h − 2 hosts.
- Protocols: ARP IP → MAC; RARP MAC → IP (server); ICMP errors to the source; DHCP DORA, server 67, client 68.
If they ask you…
| If they ask you… | Answer |
|---|---|
| What routers forward on | The destination network, not the device |
| Goal of the TCP/IP internetwork | Hide the hardware details and give a universal communication service, as if it were a single network |
| The class of an address | Look at the first byte: < 128 A, < 192 B, < 224 C, otherwise D |
| What IP does not do | Sequence control, flow control and error recovery |
| Smallest unit of datagram switching | The datagram |
| Where reassembly happens | At the destination device |
| Minimum columns of a table | Destination network and next router |
| Static vs dynamic | By hand and do not adapt / automatic, periodic exchange, they adapt |
| Which protocol turns IP into MAC | ARP (and RARP the other way) |
| Which protocol sends errors and warnings | ICMP, only to the original source |
| Automatic vs dynamic allocation | Permanent the first time / lent for a period |
| Name to IP | DNS (application) |
The calculations that come up
| I want… | Calculation | Example |
|---|---|---|
| The network of an IP | IP AND mask, byte by byte (255 copies, 0 zeroes) | 10.200.1.80 AND 255.255.255.0 = 10.200.1.0 |
| An in-between mask byte | Convert both to binary and AND them | 100 AND 192 = 01100100 AND 11000000 = 64 |
| Header bytes | IHL × 4 | IHL 6 → 24 bytes |
| Data per fragment | MTU − 20 | MTU 620 → 600 bytes |
| Offsets | Sum of the data in the previous fragments | 0, 600, 1200 |
| Size of each subnet | 256 − last non-zero byte of the mask | .224 → 32 addresses |
| Hosts | 2^h − 2 (h = zeros in the mask) | .240 → 2⁴ − 2 = 14 |
| Broadcast | Next network − 1 | Network .64 with size 64 → broadcast .127 |
Templates for the open questions
- ARP: what it does (IP → MAC, same network) → request by broadcast with the IP wanted and its own IP-MAC pair → everyone receives it, only the owner answers → direct reply with its MAC → ARP cache → IP delivers the frame (if it is another network, it asks for the gateway) → RARP does the opposite.
- Routing: definition (network-layer function) → direct vs indirect → table (destination network, next hop, mask and cost) → algorithm with AND, compare, send or discard → default route → static vs dynamic.
- Subnets: one network identifier for several networks → bits from the host part for the subnet → 1/0 mask → AND → example → network, broadcast and 2^h − 2.
- Fragmentation: MTU → fragments with their own header → identification, offset, MF, DF → example with offsets → reassembly at the destination → advantages and disadvantages.
Symptom and likely cause
| Symptom in your exam | Likely cause |
|---|---|
| You wrote IHL = 20 | You counted bytes; IHL counts 32-bit words |
| The last offset does not add up | You also added the fragment’s own data or took the header off twice |
| You got one host too many per subnet | You used 2^h instead of 2^h − 2 |
| You ticked that routers reassemble | You mixed up fragmenting (at the router) with reassembling (at the destination) |
| You swapped ARP and RARP | You did not stop to think which data you have and which you want |
| A multiple-choice question you thought you had took marks off | You ticked an option “just in case” |
| You put the DHCP server on 68 | The other way round: server 67, client 68 |
Before you hand it in, ask yourself
- Did I check the class with the first byte, not by eye?
- Do my ANDs copy the bytes with 255 and zero the ones with 0, and did I convert the in-between byte to binary if there was one?
- Did I subtract the network and broadcast addresses when counting hosts, and do my offsets add up the previous data?
- Did I leave blank the multiple-choice options I was not sure about?
If something was hard, go back to the IP addressing and subnets theory and repeat the quiz another day. With this topic we finish the networks part of IC2; the next one opens operating systems: what an operating system is.
Keep goingAll Networks articlesDid this article help you? Here is how you can support SergioLearns →




What is an operating system — theory with your laptop on a study afternoon, a write() call and a CPU that never rests (and the three programs that weren’t running at the same time)