Project · Computer Networking (CCNA level)
Project: VLANs, DHCP and OSPF for a school
The brief
A senior secondary school in Jaipur wants staff, student and guest devices kept apart on one switch, addresses given out automatically, and a link to the admin block router. Build it in Packet Tracer: three VLANs, an 802.1Q trunk, router-on-a-stick, DHCP pools on the router and OSPF to the second router. Start by writing the longest-prefix-match lookup every router uses.
Why it matters
Schools, colleges, hospitals and offices all separate users with VLANs so that a student laptop cannot reach the staff fee system and a guest phone only gets the internet. Router-on-a-stick, DHCP pools and OSPF are the exact tasks of a network engineer at a systems integrator, and the show commands here are the ones asked for in CCNA labs and job interviews.
Skills you practise
- longest prefix match
- VLANs and access ports
- 802.1Q trunks
- router-on-a-stick
- DHCP pools and excluded addresses
- single-area OSPF
- verifying with show commands
You need
- Cisco Packet Tracer (free with a Cisco Networking Academy account)
- Two 2911 routers (R1 for the school building, R2 for the admin block), one 2960 switch, and at least one PC each for STAFF, STUDENTS and GUEST
What you will have at the end
school.pkt with three working VLANs, a trunk, router-on-a-stick, DHCP and OSPF to the admin block; lookup.py; and design.txt describing the VLANs, subnets and links.
How it is marked (rubric, 100 points)
| VLANs and trunkEvery port is in the right VLAN, and the trunk carries VLANs 10, 20 and 30. | 25 |
|---|---|
| Routing and DHCPSubinterfaces are up/up, every VLAN gets DHCP addresses from .11, inter-VLAN ping works, and OSPF is FULL with the admin LAN learnt. | 35 |
| Route lookup codebest_route() picks the longest prefix whatever the order, and returns None with no match. | 15 |
| Design documentdesign.txt lists every VLAN, subnet, gateway, port range and link, and matches the build. | 15 |
| Can explainYou can trace a ping from a STUDENTS PC to a STAFF PC: the tags, the subinterfaces and the TTL. | 10 |
0/7 steps done
Step 1 of 7
Longest prefix match in Python
best_route(routes, ip) returns the next hop of the most specific route that contains ip, or None when nothing matches.
A router may have several routes that contain a destination: the default route 0.0.0.0/0 contains everything. It always uses the longest prefix, the most specific match. Loop over the routes, keep the matching one with the biggest prefix length, and return its next hop. With ipaddress, address in network tells you if it matches and network.prefixlen gives the length.
In data.py, 192.168.40.5 matches three routes: /0, /24 and /28. The /28 wins.
Run shows what your code prints. Check runs the step's tests. Ctrl+Enter checks too.