Computer Networks Module 7
IPv4 addressing, subnetting and NAT interview questions
Interview questions on IPv4 addressing, subnetting and NAT: warm-ups, then what each harder question tests and how a good answer starts.
Warm-up questions
Short questions with short answers, each answered in full.
-
Fresher
What is the difference between a subnet mask and a prefix length?
Answered in the lesson IPv4 addresses, masks and CIDR notation
-
Fresher
What is the block size of a /27, and what are the first three /27 subnets of 192.168.10.0/24?
-
Fresher
What is VLSM, and why are the largest subnets allocated first?
-
Fresher
What is the difference between basic NAT and NAPT?
Answered in the lesson NAT, port translation and carrier-grade NAT
Questions with model answers
What each question tests, the first step of a good answer and the follow-ups to expect.
-
Fresher to mid
A colleague says the router-to-router link 10.0.0.0/31 cannot work, because a /31 has no usable hosts. Who is right, and where do /30, /31 and /32 each belong in a network design?
- What it tests
- Whether the candidate knows the host-count rule and its exceptions, the point-to-point rule of RFC 3021, and the jobs of the three longest prefixes.
- First step
- Count the addresses: a /31 has two. Then ask what the network and broadcast addresses would be for on a link that has exactly two ends, and whether any standard changes the usual 2^h − 2 rule for such links.
- Follow-ups
-
- What happens if only one of the two routers supports 31-bit prefixes?
- How many addresses does a network with 500 router links save by using /31 instead of /30?
- Python's ipaddress reports a broadcast_address for a /31. Does that matter?
From the lesson IPv4 addresses, masks and CIDR notation
Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.Opening the model answers with your pass…
Model answers open with any MySmartCoPilot pass.
- Pro pass · 1 week₹79$2.99
- 30 days₹179$5.99
- 1 year₹1,699$45
One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.
Passes can’t be bought right now, so the model answers can’t be opened at the moment. If you have a pass, enter your licence key.
It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).
In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
An internal service fetches URLs for users and refuses any URL whose host text starts with "127.". A request for http://0x7f.1/admin still reaches a local admin page. Explain why, and how you would fix the check.
- What it tests
- Knowledge of lenient IPv4 parsing, and whether the fix checks the parsed and resolved address that is actually used rather than the text.
- First step
- Write down how each part of the service reads the host. The check compares text, but the HTTP client hands the host to a parser that accepts hexadecimal, octal and shortened forms. Work out which 32-bit address 0x7f.1 becomes under those rules.
- Follow-ups
-
- Which other spellings reach the same address?
- Why is resolving the host name and checking the result still not enough on its own?
- What must the check do about IPv6 and IPv4-mapped IPv6 addresses?
From the lesson IPv4 addresses, masks and CIDR notation
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Fresher to mid
You are given 172.20.0.0/16 and must create at least 300 equal subnets, each with at least 100 usable hosts. Is it possible? Give the prefix, the number of subnets and hosts per subnet, and the network address of subnet 299, counting from 0.
- What it tests
- Turning two requirements into limits on the prefix length, checking that they meet, and locating a subnet by arithmetic across an octet boundary.
- First step
- Turn each requirement into a limit on the prefix: the number of borrowed bits that gives 300 subnets sets the shortest prefix allowed, and the number of host bits that gives 100 usable hosts sets the longest. Check whether a prefix exists between the two.
- Follow-ups
-
- What changes if every subnet needs 130 hosts?
- What are the usable hosts and the broadcast address of subnet 299?
- Does the answer change if the zero subnet and the all-ones subnet may not be used?
From the lesson Subnetting step by step
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 2 minutes
-
Fresher to mid
A laptop is set to 192.168.10.77 with mask 255.255.255.224 and default gateway 192.168.10.1. It reaches the printers at .70 and .90 on the same switch, but nothing beyond them, not even the gateway. Find the fault and the fix.
- What it tests
- Working out a subnet from a dotted mask, and knowing that a host delivers directly only inside its own subnet, so its default gateway must be inside that subnet.
- First step
- Work out the laptop's own subnet from the mask: 224 in the fourth octet means blocks of 32, so find the block that contains 77. Then check whether the printers and the gateway fall inside that block.
- Follow-ups
-
- Why do the two printers still work?
- There are two possible fixes. How do you choose between them?
- How would DHCP have prevented this mistake?
From the lesson Subnetting step by step
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Fresher to mid
Plan 10.50.0.0/22 for a site with four LANs of 300, 120, 60 and 25 hosts and four point-to-point links between routers. Give each subnet's prefix and range, and say what space is left for growth.
- What it tests
- Sizing each subnet correctly, placing variable-length blocks on aligned boundaries without overlap, and describing the free space as CIDR blocks.
- First step
- Size each subnet first: hosts plus 2, rounded up to a power of two, and a /31 for each link. Add the sizes up to check that they fit in the 1,024 addresses of the /22, then place the blocks from the largest down.
- Follow-ups
-
- Which free block would you keep for growth, and why can the 300-host LAN not simply grow in place?
- How does the plan change if the routers cannot use /31 links?
- What single route can the site announce for all of this, and what else must it configure?
From the lesson VLSM and route summarisation
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A branch router announces 10.8.0.0/21 to the core because its LANs are 10.8.1.0/24 to 10.8.4.0/24. Another site uses 10.8.6.0/24. What can go wrong, and what should the branch announce instead?
- What it tests
- Computing what a summary covers, reasoning with longest-prefix match and failures, and knowing the discard route and exact alternatives.
- First step
- Write down the range 10.8.0.0/21 covers and compare it with the four LANs the branch really has. Then follow a packet for the other site's network, first while its own route is present and then after that route disappears.
- Follow-ups
-
- What does the branch router do with a packet for 10.8.7.5?
- What happens to traffic for 10.8.6.0/24 when the other site's route is withdrawn?
- How would you renumber the branch so that one route describes it exactly?
From the lesson VLSM and route summarisation
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Fresher to mid
A customer forwarded port 8443 on their home router to a camera, but it cannot be reached from outside. The router's WAN address is 100.72.18.9. Diagnose the problem and list the ways to make the camera reachable.
- What it tests
- Recognising shared address space and carrier-grade NAT, explaining why an inbound connection never reaches the home router, and weighing the alternatives, including their security.
- First step
- Classify the WAN address before touching the port-forwarding rule: which block is 100.72.18.9 in, and who uses that block? Then compare it with the public address a website sees for the same connection.
- Follow-ups
-
- How do you show that it is carrier-grade NAT and not a firewall rule?
- Why does IPv6 help, and what must be configured for it to be safe?
- What are the security risks of each way of making the camera reachable?
From the lesson NAT, port translation and carrier-grade NAT
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 4 minutes
-
Mid to senior
A mobile app keeps a UDP socket open to receive push messages. On some networks the messages stop arriving after about a minute of silence, while the app's TCP connections stay up for hours. Explain why, and design a fix.
- What it tests
- Knowing that NAT mappings expire on idle timers, which direction refreshes them, the different TCP and UDP rules, and designing keepalives with numbers.
- First step
- Follow the push message backwards: it arrives at a public address and port that exist only while a NAT keeps the phone's mapping. Ask what keeps that mapping alive, and what the phone sends during a minute of silence.
- Follow-ups
-
- How would you measure the UDP timer of a particular network?
- What does each keepalive cost on a phone, and how do you reduce that cost?
- Would moving the channel to TCP fix the problem completely?
From the lesson NAT, port translation and carrier-grade NAT
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
All Computer Networks interview questions · The Computer Networks track