Calculate 8 subnets, build in Packet Tracer, and verify connectivity
Imagine a university campus with departments like Engineering, Business, Health Sciences, IT, Student Services, Administration, the Library, and a Research Lab. Putting every device — thousands of computers, printers, and phones — on a single flat network would cause massive broadcast traffic, make troubleshooting a nightmare, and leave no way to isolate sensitive data (e.g. student records from the public Wi-Fi).
Subnetting solves this by dividing one large network into smaller, manageable segments — one per department. Each subnet gets its own broadcast domain, which reduces congestion, improves security (you can apply firewall rules between subnets), and makes it much easier to locate and fix problems. This is exactly how real enterprise and campus networks are designed.
In this practical you will subnet a Class B network into 8 subnets — one for each department. You will calculate the network address, broadcast address, and valid host range for every subnet. Then you will build the network in Packet Tracer using VLANs and a router-on-a-stick configuration, and verify connectivity with ping.
You have been assigned the Class B network:
172.16.0.0255.255.0.0 (/16)How many host bits must you borrow to create at least 8 subnets?
11111111.11111111.11100000.00000000Work out the following from the /19 subnet mask:
| Question | Your Answer |
|---|---|
| Remaining host bits | |
| Total addresses per subnet (2?) | |
| Usable hosts per subnet (2? − 2) |
Fill in the details for each of the 8 subnets.
| Subnet | Network Address | First Usable Host | Last Usable Host | Broadcast Address |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 |
Create the following network in Packet Tracer. We will use a Router-on-a-Stick design: one physical cable carries traffic for all 8 subnets using VLANs (Virtual LANs).
Click on the Switch, go to the CLI tab, and paste the following configuration. This creates 8 VLANs (one per subnet), assigns PC ports to the correct VLAN, and sets up a trunk link to the router.
enable
configure terminal
hostname SubnetSwitch
enable — enters privileged EXEC mode (gives you full access to configuration commands).configure terminal — enters global configuration mode where you can change switch settings.hostname SubnetSwitch — gives the switch a meaningful name so you can identify it in the CLI prompt.We create 8 VLANs — one for each subnet. A VLAN (Virtual LAN) logically separates ports on the same physical switch into isolated networks. Devices in VLAN 10 cannot talk to devices in VLAN 20 without going through the router, just as if they were on completely separate switches.
vlan 10
name Subnet_1
vlan 20
name Subnet_2
vlan 30
name Subnet_3
vlan 40
name Subnet_4
vlan 50
name Subnet_5
vlan 60
name Subnet_6
vlan 70
name Subnet_7
vlan 80
name Subnet_8
vlan 10 — creates (or enters) VLAN number 10.name Subnet_1 — assigns a human-readable name. This is optional but makes show vlan brief much easier to read.Each pair of PCs is plugged into two switch ports. We put those ports in access mode and assign them to the correct VLAN. An access port belongs to exactly one VLAN and strips the VLAN tag before sending frames to the PC (the PC never knows it is on a VLAN).
interface range FastEthernet0/1-2
switchport mode access
switchport access vlan 10
!
interface range FastEthernet0/3-4
switchport mode access
switchport access vlan 20
!
interface range FastEthernet0/5-6
switchport mode access
switchport access vlan 30
!
interface range FastEthernet0/7-8
switchport mode access
switchport access vlan 40
!
interface range FastEthernet0/9-10
switchport mode access
switchport access vlan 50
!
interface range FastEthernet0/11-12
switchport mode access
switchport access vlan 60
!
interface range FastEthernet0/13-14
switchport mode access
switchport access vlan 70
!
interface range FastEthernet0/15-16
switchport mode access
switchport access vlan 80
interface range FastEthernet0/1-2 — selects ports Fa0/1 and Fa0/2 at the same time (saves typing).switchport mode access — tells the port it will connect to an end device and carry traffic for only one VLAN.switchport access vlan 10 — assigns these ports to VLAN 10 (Subnet 1). Any frame arriving on Fa0/1 or Fa0/2 is treated as VLAN 10 traffic.The uplink from the switch to the router must carry traffic for all 8 VLANs over a single cable. We set this port to trunk mode. A trunk port tags every outgoing frame with its VLAN ID (using the 802.1Q standard) so the router knows which subnet the frame belongs to.
interface GigabitEthernet0/1
switchport mode trunk
interface GigabitEthernet0/1 — selects the Gigabit port connected to the router.switchport mode trunk — enables trunking. The switch will now add a 4-byte 802.1Q tag to every frame sent to the router, identifying which VLAN it came from.end
write memory
end — exits back to privileged EXEC mode.write memory — saves the running configuration to NVRAM so it persists after a reboot.Click on the Router, go to the CLI tab, and enter the following configuration. This creates 8 sub-interfaces on a single physical port — one per VLAN/subnet — each acting as the default gateway for its subnet.
enable
configure terminal
hostname SubnetRouter
!
interface GigabitEthernet0/0
no shutdown
enable / configure terminal — same as on the switch: enters global configuration mode.hostname SubnetRouter — names the router for easy identification.interface GigabitEthernet0/0 — selects the physical interface connected to the switch trunk.no shutdown — turns the interface on. By default, router interfaces are administratively shut down (unlike switch ports which default to up). Without this command, none of the sub-interfaces will work.A sub-interface is a logical division of a physical interface. The router uses sub-interfaces to handle traffic from different VLANs on the same physical cable — this is the “router-on-a-stick” design. Each sub-interface needs two things:
interface GigabitEthernet0/0.10
encapsulation dot1Q 10
ip address 172.16.0.1 255.255.224.0
!
interface GigabitEthernet0/0.20
encapsulation dot1Q 20
ip address 172.16.32.1 255.255.224.0
!
interface GigabitEthernet0/0.30
encapsulation dot1Q 30
ip address 172.16.64.1 255.255.224.0
!
interface GigabitEthernet0/0.40
encapsulation dot1Q 40
ip address 172.16.96.1 255.255.224.0
!
interface GigabitEthernet0/0.50
encapsulation dot1Q 50
ip address 172.16.128.1 255.255.224.0
!
interface GigabitEthernet0/0.60
encapsulation dot1Q 60
ip address 172.16.160.1 255.255.224.0
!
interface GigabitEthernet0/0.70
encapsulation dot1Q 70
ip address 172.16.192.1 255.255.224.0
!
interface GigabitEthernet0/0.80
encapsulation dot1Q 80
ip address 172.16.224.1 255.255.224.0
interface GigabitEthernet0/0.10 — creates sub-interface .10 on the GigE0/0 port. The “.10” is just a label — we match it to the VLAN number by convention to keep things clear.encapsulation dot1Q 10 — tells this sub-interface to handle frames tagged with VLAN 10 (the 802.1Q standard). When a frame arrives from the switch with a VLAN 10 tag, the router sends it to this sub-interface for processing.ip address 172.16.0.1 255.255.224.0 — assigns the first usable IP in Subnet 1 as the gateway address. PCs in Subnet 1 will set 172.16.0.1 as their default gateway.The same pattern repeats for all 8 sub-interfaces. Each one uses the next subnet’s first address (172.16.32.1, 172.16.64.1, … 172.16.224.1) and maps to the corresponding VLAN (20, 30, … 80).
end
write memory
end — exits back to privileged EXEC mode.write memory — saves the running configuration to NVRAM so it survives a reboot.Assign a static IP address, subnet mask, and default gateway to each PC. The gateway is the router sub-interface IP for that subnet.
| PC | Subnet | IP Address | Subnet Mask | Default Gateway | Switch Port |
|---|---|---|---|---|---|
| PC1 | 1 | 172.16.0.2 | 255.255.224.0 | 172.16.0.1 | Fa0/1 |
| PC2 | 1 | 172.16.0.3 | 255.255.224.0 | 172.16.0.1 | Fa0/2 |
| PC3 | 2 | 172.16.32.2 | 255.255.224.0 | 172.16.32.1 | Fa0/3 |
| PC4 | 2 | 172.16.32.3 | 255.255.224.0 | 172.16.32.1 | Fa0/4 |
| PC5 | 3 | 172.16.64.2 | 255.255.224.0 | 172.16.64.1 | Fa0/5 |
| PC6 | 3 | 172.16.64.3 | 255.255.224.0 | 172.16.64.1 | Fa0/6 |
| PC7 | 4 | 172.16.96.2 | 255.255.224.0 | 172.16.96.1 | Fa0/7 |
| PC8 | 4 | 172.16.96.3 | 255.255.224.0 | 172.16.96.1 | Fa0/8 |
| PC9 | 5 | 172.16.128.2 | 255.255.224.0 | 172.16.128.1 | Fa0/9 |
| PC10 | 5 | 172.16.128.3 | 255.255.224.0 | 172.16.128.1 | Fa0/10 |
| PC11 | 6 | 172.16.160.2 | 255.255.224.0 | 172.16.160.1 | Fa0/11 |
| PC12 | 6 | 172.16.160.3 | 255.255.224.0 | 172.16.160.1 | Fa0/12 |
| PC13 | 7 | 172.16.192.2 | 255.255.224.0 | 172.16.192.1 | Fa0/13 |
| PC14 | 7 | 172.16.192.3 | 255.255.224.0 | 172.16.192.1 | Fa0/14 |
| PC15 | 8 | 172.16.224.2 | 255.255.224.0 | 172.16.224.1 | Fa0/15 |
| PC16 | 8 | 172.16.224.3 | 255.255.224.0 | 172.16.224.1 | Fa0/16 |
Open the Command Prompt on PC1 and ping PC2 (same subnet):
ping 172.16.0.3
This should succeed immediately — both PCs are in the same VLAN and do not need the router.
From PC1 (Subnet 1), ping PC3 in Subnet 2:
ping 172.16.32.2
This traffic goes: PC1 → Switch → Router (routes between VLANs) → Switch → PC3.
ping 172.16.160.2 (Subnet 3 → Subnet 6)ping 172.16.224.2 (Subnet 4 → Subnet 8)ping 172.16.0.2 (Subnet 8 → Subnet 1)All pings should return successful replies.
On the router CLI, run:
show ip interface brief
You should see all 8 sub-interfaces with status up/up and their correct IP addresses.
ipconfigshow vlan brief to confirm port-to-VLAN mappingshow ip interface brief to confirm sub-interfaces are upencapsulation dot1Q command on the router sub-interfaces?In this practical you have:
ping