Computer Networks / Practical class / Practical class 4
Practical class · Computer Networks

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.

:ik-kitob: Practical class 4 ⏱ 2 academic hours (80 minutes) 🚇 Packet simulators ⚡ Every department gets its own size
04

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)

  1. 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.

Giving 62 addresses where 2 are needed — is that waste?

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.

1

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.

2

/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).

3

Leave a reserve

Departments grow. Leaving ~20–30% reserve and a free block at the end of the plan is good practice.

Table 4.1. FLSM and VLSM: the same requirements, different results (base: 10.20.0.0/22, 1024 addresses)
RequirementHostsFLSM (all equal to the largest: /23)VLSMVLSM waste
Library Wi-Fi300/23 (510 hosts)/23 (510)210
Computer labs120/23 (510)/25 (126)6
Department staff50FLSM: 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 office255
Servers104
Link R1–R220
Link R1–ISP20

Subnetting – dividing networks into smaller segments

Session 2 · complex cases

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.

  1. 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.

  2. Check that it fits

    The sum of the blocks: 512 + 128 + 64 + 32 + 16 + 4 + 4 = 760 ≤ 1024 ✓.

  3. 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.

  4. 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.

  5. Document the free space

    10.20.2.248/29 and 10.20.3.0/24 are a reserve for future departments.

Table 4.2. The final VLSM plan (used in the next router console)
SectionSubnetMaskGateway (1st host)Last hostBroadcastRouter interface
Library Wi-Fi10.20.0.0/23255.255.254.010.20.0.110.20.1.25410.20.1.255R2 (the other router)
Computer labs10.20.2.0/25255.255.255.12810.20.2.110.20.2.12610.20.2.127R1 G0/0
Department10.20.2.128/26255.255.255.19210.20.2.12910.20.2.19010.20.2.191R1 G0/1
Dean’s office10.20.2.192/27255.255.255.22410.20.2.19310.20.2.22210.20.2.223R1 G0/2
Servers10.20.2.224/28255.255.255.24010.20.2.22510.20.2.23810.20.2.239R2
Link R1–ISP10.20.2.240/30255.255.255.25210.20.2.241 (R1)10.20.2.242 (ISP)10.20.2.243R1 S0/0/0
Link R1–R210.20.2.244/30255.255.255.25210.20.2.245 (R1)10.20.2.246 (R2)10.20.2.247R1–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

Base network:
SectionHostsSubnetGatewayBroadcastWaste

Sample task 2. Point-to-point links: /30 or /31

  1. /30 — the classic way

    4 addresses: network, 2 hosts, broadcast. 10.20.2.240/30 → R1 = .241, ISP = .242. One /24 yields 64 links.

  2. /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.

  3. 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”.

sample: configuring one interface
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

ADU-R1>

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.

Case 1 · A department computer
   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.
Case 2 · A dean’s office computer (Windows settings)
   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.
Case 3 · A computer lab computer
   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

ErrorConsequenceCorrect answer
Placing the small requirements first in VLSMthere is no aligned space left for the large block, and addresses are wasted as “holes”sort in decreasing order
Forgetting the linksthere are no addresses left in the plan for the router–router linksinclude the links in the requirement list too (/30 or /31)
Writing a /24 mask on a host “by habit” instead of /27the host thinks the addresses of other departments are “its own network”, and ARP requests go unansweredthe mask is exactly the same as in the plan
Putting the gateway somewhere other than in the plansome hosts cannot find the gatewayconvention: the gateway is the 1st host of the subnet
Intersecting subnets on two interfacesthe router rejects it (“overlaps”), routing breakscheck the plan with overlaps()
Not documenting the plana year later nobody knows which blocks are freea 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).

  1. Build the VLSM plan for your variant by hand (in the form of Table 4.2) and calculate the waste and the unused addresses.
  2. Try splitting the same requirements with FLSM and compare the results.
  3. Check the plan with the “IP plan generator” (a screenshot).
  4. 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 brief and show ip route.
Assessment criteria (individual assignment)
CriterionPoints
The VLSM plan is correct (order, prefixes, boundaries, gateways)2
The waste and free addresses are calculated and compared with FLSM1
Checked with the program1
Router interfaces are configured, show outputs are attached1

Summary

VLSMEvery department gets a subnet of its own size — addresses are saved.
Start with the largestPlacing in decreasing order — aligned blocks, minimal waste.
Links/30 or /31 for router–router.
GatewayConvention: the 1st host of the subnet; it must be in the same subnet as the host.
Router consoleip address + no shutdown; check with show ip interface brief and show ip route.
DiagnosticsMask, gateway, network/broadcast address, overlapping subnets — the 4 main mistakes.
DocumentationA good plan — a table, spare blocks and room for growth.
Two classesPractical 3 — how to calculate; practical 4 — how to plan and check.

Your lesson results

Your results are saved in this browser. Read all the sections and complete the exercises and assignments.

My personal notes