Subnetting – dividing networks into smaller segments
In practical 3 we split a network into equal pieces. But in real life departments are not equal: the library Wi-Fi needs 300 addresses, while a router–router link needs only 2. This is the 2nd class on subnetting: subnets of different sizes (VLSM), a real address plan for a university building, point-to-point links (/30, /31), configuring interfaces in a Cisco-style router console, and finding faults such as a wrong mask, a wrong gateway and overlapping subnets.
Lesson goals and plan
By the end of the lesson you will…
- You can explain the difference between FLSM and VLSM and show with calculations how VLSM saves addresses
- You can build a VLSM plan from a list of requirements using the “start from the largest” rule
- You can use /30 and /31 subnets for point-to-point links
- You can assign addresses to router interfaces according to a VLSM plan and read the output of show ip interface brief and show ip route
- You can identify mistakes such as a wrong mask, a gateway in another subnet, giving a host the network/broadcast address, and overlapping subnets
- You can automate VLSM planning and checking with a Python program
Plan (according to the syllabus)
- Subnetting – dividing networks into smaller segments
The one golden rule of VLSM: start with the largest requirement. If you place the small subnets first, there may be no “flat” space left for the large block — just like scattering small things in a suitcase first and then not being able to fit the jacket. The magic number and AND skills from practical 3 are needed at every step today.
If all subnets are /26, as in practical 3, even the link between two routers gets 62 addresses, of which only 2 are used. 60 addresses are wasted “into thin air”. And the 300 devices in the library will not fit at all! That is why in real projects every department gets a subnet of its own size. Today we build such a plan for a university building and “bring it to life” in the router console.
Key terms
Theory reminder
A reminder from practical 3: block = 256 − mask octet; network = (octet // block) × block; hosts = 2h − 2; h from a requirement: 2h − 2 ≥ H. Today three new ideas are added to these.
Start with the largest
Sort the requirements in decreasing order of the number of hosts and place them one after another. Then every block starts at an address “aligned” to its own size.
/30 or /31 for links
2 addresses are enough for a router–router link: /30 (4 addresses, 2 hosts) or /31 (2 addresses, both used, RFC 3021).
Leave a reserve
Departments grow. Leaving ~20–30% reserve and a free block at the end of the plan is good practice.
| Requirement | Hosts | FLSM (all equal to the largest: /23) | VLSM | VLSM waste |
|---|---|---|---|---|
| Library Wi-Fi | 300 | /23 (510 hosts) | /23 (510) | 210 |
| Computer labs | 120 | /23 (510) | /25 (126) | 6 |
| Department staff | 50 | FLSM: only 2 × /23 fit inside /22 — the other 5 requirements do not fit! VLSM: everything fits and 10.20.2.248/29 + 10.20.3.0/24 stay free | 12 | |
| Dean’s office | 25 | 5 | ||
| Servers | 10 | 4 | ||
| Link R1–R2 | 2 | 0 | ||
| Link R1–ISP | 2 | 0 | ||
Subnetting – dividing networks into smaller segments
This is the second of the two classes on subnetting. The mask, AND, the magic number and equal subnets were learned in practical 3 — they are not repeated but used as tools. Today’s novelties: VLSM, a real project plan, /30–/31 links, the router console and troubleshooting.
Sample task 1. A VLSM plan for a university building
Condition: The provider allocated the block 10.20.0.0/22 to the “Computer Engineering” building. Requirements: library Wi-Fi — 300 hosts, computer labs — 120, department staff — 50, dean’s office — 25, servers — 10, two router links — 2 hosts each.
- The prefix for each requirement (the formula from practical 3)
300 → 29 − 2 = 510 → /23; 120 → 126 → /25; 50 → 62 → /26; 25 → 30 → /27; 10 → 14 → /28; 2 → 2 → /30.
- Check that it fits
The sum of the blocks: 512 + 128 + 64 + 32 + 16 + 4 + 4 = 760 ≤ 1024 ✓.
- Place them one after another, starting from the largest
Library 10.20.0.0/23 (0.0 – 1.255) → next free address 10.20.2.0. Computer labs 10.20.2.0/25 → next .128. Department .128/26 → .192. Dean’s office .192/27 → .224. Servers .224/28 → .240. Links .240/30 and .244/30.
- Mark the gateways
Convention: the first host address of every subnet is the router interface (the gateway). For example, 10.20.2.1 for the computer labs.
- Document the free space
10.20.2.248/29 and 10.20.3.0/24 are a reserve for future departments.
| Section | Subnet | Mask | Gateway (1st host) | Last host | Broadcast | Router interface |
|---|---|---|---|---|---|---|
| Library Wi-Fi | 10.20.0.0/23 | 255.255.254.0 | 10.20.0.1 | 10.20.1.254 | 10.20.1.255 | R2 (the other router) |
| Computer labs | 10.20.2.0/25 | 255.255.255.128 | 10.20.2.1 | 10.20.2.126 | 10.20.2.127 | R1 G0/0 |
| Department | 10.20.2.128/26 | 255.255.255.192 | 10.20.2.129 | 10.20.2.190 | 10.20.2.191 | R1 G0/1 |
| Dean’s office | 10.20.2.192/27 | 255.255.255.224 | 10.20.2.193 | 10.20.2.222 | 10.20.2.223 | R1 G0/2 |
| Servers | 10.20.2.224/28 | 255.255.255.240 | 10.20.2.225 | 10.20.2.238 | 10.20.2.239 | R2 |
| Link R1–ISP | 10.20.2.240/30 | 255.255.255.252 | 10.20.2.241 (R1) | 10.20.2.242 (ISP) | 10.20.2.243 | R1 S0/0/0 |
| Link R1–R2 | 10.20.2.244/30 | 255.255.255.252 | 10.20.2.245 (R1) | 10.20.2.246 (R2) | 10.20.2.247 | R1–R2 |
Lab 1: VLSM planner
Change the base network and the requirements (“name hosts” — one per line). The planner sorts the requirements, places the subnets and shows in the strip below how the base block gets filled (dark — used hosts, light — waste). Untick Largest first to see why the order matters.
:ik-xarita: VLSM planner
| Section | Hosts | Subnet | Gateway | Broadcast | Waste |
|---|
Sample task 2. Point-to-point links: /30 or /31
- /30 — the classic way
4 addresses: network, 2 hosts, broadcast. 10.20.2.240/30 → R1 = .241, ISP = .242. One /24 yields 64 links.
- /31 — the economical way (RFC 3021)
2 addresses, both assigned to the interfaces, because a link with two devices does not need a broadcast. 10.20.2.240/31 → .240 and .241. One /24 yields 128 links.
- Which one to choose?
Modern routers support /31; training labs and old devices often use /30. Keep one style in the plan.
Lab 2: the router console (Cisco IOS style)
Now bring the plan from Table 4.2 to life on router R1. Task: give the interfaces G0/0, G0/1, G0/2 and S0/0/0 the planned gateway addresses and the correct masks, and enable them. The console responds to errors like a real IOS: wrong mask, network or broadcast address, overlapping subnet. ? — list of commands, ↑ — previous command. When you finish, press “Check the task”.
ADU-R1> enable ADU-R1# configure terminal ADU-R1(config)# interface GigabitEthernet0/0 ADU-R1(config-if)# ip address 10.20.2.1 255.255.255.128 ADU-R1(config-if)# no shutdown ADU-R1(config-if)# exit
:ik-terminal: ADU-R1 console
Troubleshooting: investigator mode
In real work, subnetting mistakes arrive as the complaint “there is no Internet”. In each case, compare the ipconfig output with Table 4.2 and find the cause.
IPv4 Address. . . . . . . . . . . : 10.20.2.170 Subnet Mask . . . . . . . . . . . : 255.255.255.224 Default Gateway . . . . . . . . . : 10.20.2.129 C:\> ping 10.20.2.129 Reply from 10.20.2.170: Destination host unreachable.
IP address: 10.20.2.223 Subnet mask: 255.255.255.224 Default gateway: 10.20.2.193 [Microsoft TCP/IP] The combination of IP address and subnet mask is invalid.
IPv4 Address. . . . . . . . . . . : 10.20.2.77 Subnet Mask . . . . . . . . . . . : 255.255.255.128 Default Gateway . . . . . . . . . : 10.20.2.1 C:\> ping 10.20.2.150 Request timed out.
Independent tasks
7 tasks — you write the VLSM and diagnostic tools yourself. The formulas from practical 3 are assumed to be ready; you may use ipaddress.
Common mistakes
| Error | Consequence | Correct answer |
|---|---|---|
| Placing the small requirements first in VLSM | there is no aligned space left for the large block, and addresses are wasted as “holes” | sort in decreasing order |
| Forgetting the links | there are no addresses left in the plan for the router–router links | include the links in the requirement list too (/30 or /31) |
| Writing a /24 mask on a host “by habit” instead of /27 | the host thinks the addresses of other departments are “its own network”, and ARP requests go unanswered | the mask is exactly the same as in the plan |
| Putting the gateway somewhere other than in the plan | some hosts cannot find the gateway | convention: the gateway is the 1st host of the subnet |
| Intersecting subnets on two interfaces | the router rejects it (“overlaps”), routing breaks | check the plan with overlaps() |
| Not documenting the plan | a year later nobody knows which blocks are free | a table: department, subnet, gateway, VLAN, spare blocks |
Boss level
Boss level: full address plan (IP plan) generator
Automatically build the document a network engineer hands over. Input as in task 2. For each subnet (in decreasing order) one line: Nom subnet niqob shlyuz oxirgi_xost broadcast isrof (separated by spaces). At the end: Bo‘sh: N manzil — the number of addresses left unallocated in the base block. If they do not fit — only Sig‘maydi. +60 XP
Kutubxona 10.20.0.0/23 255.255.254.0 10.20.0.1 10.20.1.254 10.20.1.255 210 Komp_sinflari 10.20.2.0/25 255.255.255.128 10.20.2.1 10.20.2.126 10.20.2.127 6 ... Bo‘sh: 264 manzil
Reinforcement
Review questions
What is the difference between FLSM and VLSM?
FLSM — all subnets have the same mask; VLSM — each subnet gets a mask matching its requirement. VLSM saves addresses and accommodates departments of different sizes.
State the algorithm for building a VLSM plan.
Find the prefix for each requirement (2h − 2 ≥ H) → check that it fits → sort in decreasing order → place sequentially → mark the gateways → document the free blocks.
Why is the “start from the largest” rule important?
Each block must start at an address that is a multiple of its own size. If the small ones are placed first, aligning for the large block creates gaps (waste) or the large block does not fit at all.
What is the difference between /30 and /31 links?
/30: 4 addresses (network, 2 hosts, broadcast). /31: 2 addresses, both assigned to hosts (RFC 3021) — twice as economical.
What errors can appear when assigning an address to a router interface?
“Bad mask … for address” — when a network or broadcast address is given; “overlaps with …” — when it intersects the subnet of another interface; “Invalid input” — a command syntax error.
What problems does a wrong mask on a host lead to?
The host miscalculates its own subnet: the gateway may end up “in another network”, or the addresses of other departments are considered “local” and ARP is sent to them directly.
What is the difference between “Destination host unreachable” and “Request timed out”?
The first means no route was found (the reply is often returned by your own computer or the router); the second means the packet left but no reply came (the device is off, a firewall, no return path).
What should a good address plan contain?
Department, subnet, mask, gateway, host range, broadcast, responsible person, VLAN (if any), spare blocks and a 20–30% reserve for growth.
Independent work
Independent-study topic in the course program: “IPv4 addressing, subnetting and efficient planning of IP addresses” (6 hours). The part related to this class is efficient planning based on VLSM (equal-size subnetting is in the independent work of practical 3).
- Build the VLSM plan for your variant by hand (in the form of Table 4.2) and calculate the waste and the unused addresses.
- Try splitting the same requirements with FLSM and compare the results.
- Check the plan with the “IP plan generator” (a screenshot).
- In Cisco Packet Tracer (or the console in this lesson), configure at least 3 interfaces according to your plan and attach the output of
show ip interface briefandshow ip route.
| Criterion | Points |
|---|---|
| The VLSM plan is correct (order, prefixes, boundaries, gateways) | 2 |
| The waste and free addresses are calculated and compared with FLSM | 1 |
| Checked with the program | 1 |
| Router interfaces are configured, show outputs are attached | 1 |
Summary
Your lesson results
Your results are saved in this browser. Read all the sections and complete the exercises and assignments.