Enterprise Campus Network Design, Automation & Telemetry
A fault-tolerant 3-tier campus network interconnecting four university engineering departments with HSRP load-sharing, declarative Ansible switch automation, idempotent Python router orchestration, and full-estate Zabbix telemetry.
Verified results and performance
Project details
- Role
- Network & Automation Engineer (Joint Engineering Project)
- Timeline
- 2024 to 2025
- Tracks
- networking, devops, software
Technologies and skills
The Spark: Why I Built This
Enterprise campus networks in academic institutions face three persistent engineering headaches: fragile single-chassis core switches that create campus-wide blackouts when rebooted, manual command-line configuration changes that cause insidious configuration drift over time, and flat Layer 2 networks that lack granular department security boundaries.
"A campus network cannot rely on manual terminal sessions where every engineer types slightly different commands. Configuration must be codified as version-controlled data, and failover must be verified under simulated stress before production deployment."
Traditional university networking labs frequently configure switches manually and leave them unmonitored until users complain about broken default gateways. I wanted to design an enterprise-grade campus infrastructure from first principles: full dual-core hardware redundancy, strict micro-segmented department access control lists, declarative infrastructure as code, and continuous SNMP telemetry that alerts operators the moment a redundant link fails.
Platform Architecture and Big Picture
The network interconnects four academic departments: Electrical and Information Engineering (DEIE), Civil and Environmental Engineering (DCEE), Mechanical and Manufacturing Engineering (DMME), and Interdisciplinary Studies (DIS). The infrastructure follows Cisco's proven three-layer hierarchical design across 11 network devices:
- Core Layer: Redundant Cisco IOSvL2 multilayer switches (SW-CORE-1, SW-CORE-2) running Hot Standby Router Protocol (HSRP) and rapid Spanning Tree.
- Distribution Layer: Dedicated department distribution switches (SW-D-DEIE, SW-D-DCEE, SW-D-DMME, SW-D-DIS) terminating department uplinks and enforcing 802.1Q trunk pruning.
- Access Layer: Edge switches connecting departmental student workstations, servers, and dedicated management hosts.
- Routing & WAN Edge: Cisco IOSv routers (R-CORE, R-EDGE) running single-area OSPF (Area 0) and Port Address Translation (NAT Overload) providing regulated internet connectivity for authorized departments.
Addressing is structured within private subnet space 10.0.0.0/8. Each department receives a dedicated /24 prefix (10.10.10.0/24 through 10.10.40.0/24), while an isolated out-of-band management VLAN (VLAN 99: 10.99.99.0/24) isolates network device management from regular student traffic.
Active-Active Core Gateway Redundancy
To ensure high availability without wasting hardware capital, the redundant core pair runs HSRP with alternating active roles rather than an active-passive topology:
| VLAN | Name | SW-CORE-1 SVI | SW-CORE-2 SVI | HSRP Virtual IP | Active Core | Standby Core |
|---|---|---|---|---|---|---|
| VLAN 10 | DEIE | 10.10.10.2 | 10.10.10.3 | 10.10.10.1 | SW-CORE-1 (Pri 110) | SW-CORE-2 (Pri 100) |
| VLAN 20 | DCEE | 10.10.20.2 | 10.10.20.3 | 10.10.20.1 | SW-CORE-1 (Pri 110) | SW-CORE-2 (Pri 100) |
| VLAN 30 | DMME | 10.10.30.2 | 10.10.30.3 | 10.10.30.1 | SW-CORE-2 (Pri 110) | SW-CORE-1 (Pri 100) |
| VLAN 40 | DIS | 10.10.40.2 | 10.10.40.3 | 10.10.40.1 | SW-CORE-2 (Pri 110) | SW-CORE-1 (Pri 100) |
| VLAN 99 | MGMT | 10.99.99.2 | 10.99.99.3 | 10.99.99.1 | SW-CORE-1 (Pri 110) | SW-CORE-2 (Pri 100) |
Preemption is enabled across all groups. Spanning Tree root priorities are strictly aligned with HSRP gateway priorities (SW-CORE-1 is primary root for VLANs 10, 20, 99; SW-CORE-2 is primary root for VLANs 30, 40). This alignment guarantees that Layer 2 switch forwarding paths match the Layer 3 default gateway, eliminating inefficient cross-core transit traffic during normal operations.
Security Architecture and Access Control
Campus departments require strict traffic isolation. The security policy mandates an explicit default-deny stance, implemented via five named extended access lists applied inbound on the department Switch Virtual Interfaces (SVIs) on both core switches:
Because Cisco IOS access lists are stateless, replies from permitted server sessions would be dropped without explicit return path rules. The policy explicitly engineers return rules on the DIS SVI (ACL_DIS_IN). Reachability was validated across a complete 4x4 inter-department matrix from physical workstation hosts, and verified via IOS hardware ACL hit counters.
Source Destination Policy Action Engineering Rationale
------------------------------------------------------------------------------------
VLAN_DEIE VLAN_DIS Permit All Engineering workstations access IT servers
VLAN_DCEE VLAN_DIS Permit HTTP(S) Web portal access only (Ports 80 & 443)
VLAN_DMME VLAN_DIS Deny All Explicit isolation per security policy
VLAN_DCEE VLAN_DEIE Deny All Inter-department student isolation
VLAN_DMME VLAN_DCEE Deny All Inter-department student isolation
VLAN_DIS VLAN_DEIE Permit All Stateless return path for established flows
VLAN_DIS VLAN_DCEE Permit HTTP(S) Stateless return path for web server replies
VM-ZABBIX All Devices Permit SNMP Monitoring telemetry polling (UDP 161)
MGMT VLAN All Devices Permit SSH Secure administrative access (TCP 22)
Any Any Deny Implicit drop at conclusion of every ACL
Procedural Router Automation with Python and Netmiko
The core and edge routers (R-CORE, R-EDGE) are unique procedural devices that must be bootstrap-capable from bare metal. To manage them without third-party agent overhead, I built a custom Python automation engine utilizing Netmiko.
The critical architectural decision was separating intended state (YAML data) from execution code:
The script features timing-based reading (send_command_timing) to survive emulated control-plane latency, retries empty section responses to avoid mistaking a slow response for a missing interface, and writes timestamped logs for automated change auditing.
# netmiko/configure_routers.py - Idempotency Comparison Logic
def line_is_present(line: str, current: list[str]) -> bool:
"""
Handle IOS negation semantics. A 'no shutdown' command is satisfied
when 'shutdown' is absent from the running-config, because IOS never
writes 'no shutdown' explicitly into the NVRAM text representation.
"""
if line.startswith("no "):
command_target = line[3:].strip()
return command_target not in current
return line in current
def apply_section(connection, section: dict, read_timeout: int = 120) -> bool:
"""
Push full configuration blocks atomically. Sending individual lines
without context (e.g. 'ip address' without 'interface') lands commands
in the wrong sub-mode or triggers syntax rejection.
"""
connection.send_config_set(
section["lines"],
read_timeout=read_timeout,
cmd_verify=False,
exit_config_mode=False,
)
run_command(connection, "end", read_timeout)
return True
Declarative Switch Orchestration with Ansible
While the routers required procedural bootstrap logic, the nine campus switches share near-identical structural patterns: VLAN databases, 802.1Q trunks, access port assignments, and STP priorities. For the switch estate, I engineered an Ansible automation project using the cisco.ios collection across five modular roles:
roles/vlans: Configures VLAN 10, 20, 30, 40, 99, 100 with explicit un-shutdown attributes.roles/trunking: Establishes 802.1Q encapsulation, sets native VLAN 100, and prunes unused department VLANs.roles/access_ports: Assigns host interfaces, disables DTP negotiations, and enables PortFast Edge.roles/stp: Enforces deterministic PVST+ root priorities aligned with HSRP gateways.roles/management: Injects default management gateway routes (ip route 0.0.0.0 0.0.0.0 10.99.99.1).
Concurrency is tuned to forks = 2 in ansible.cfg. Emulated Cisco switch CPU threads fail authentication when bombarded with five simultaneous SSH handshakes. Running with serial batches of two ensures 100% login reliability.
# ansible/site.yml - Multi-Role Orchestration Playbook
---
- name: Orchestrate Department Campus Switch Estate
hosts: core_switches:distribution_switches:access_switches
gather_facts: false
serial: 2
roles:
- role: vlans
- role: trunking
- role: access_ports
- role: stp
- name: Configure Out-of-Band Management Routing
hosts: distribution_switches:access_switches
gather_facts: false
roles:
- role: management
Idempotency Traps: What the Tools Did Not Tell Us
Building automated network pipelines exposed three major idempotency traps where standard configuration syntax produced subtle production failures:
- The Locally Shut VLAN Trap (
act/lshut): During switch rollbacks, recreating a VLAN without an explicit state left it administratively shut down in the VLAN database. Ansible--checkreported 0 changes and green status because every line it managed matched running-config. Yet hosts could not reach their gateway! The lesson: Checking compares declared intent against reality, but remains blind to whatever the intent omitted. - The PortFast Edge Syntax Drift: Cisco IOS 15.2(4)E accepts
spanning-tree portfastbut stores it internally asspanning-tree portfast edge. If playbooks declare the legacy command, the task reportschanged=trueon every single execution. The fix was parameterizing the syntax in role defaults. - The Inactive Default Gateway: Switches in VLAN 99 configured with
ip default-gatewaycould not reply to SNMP queries from the Zabbix server in VLAN 40. On Cisco IOSvL2,ip routingis enabled invisibly by default, causingip default-gatewayto be silently ignored. An explicit static route (ip route 0.0.0.0 0.0.0.0 10.99.99.1) was required.
| Trap Encountered | Symptoms | Root Cause | Engineering Solution |
|---|---|---|---|
VLAN act/lshut | Zero ping reachability despite green --check | Missing shutdown: disabled in VLAN merge | Mapped explicit shutdown disabled state to all VLANs |
| PortFast syntax drift | Endless changed task reports | IOS stores portfast edge variant | Codified exact stored command in role defaults |
| Silent gateway drop | Zabbix telemetry dropped on L2 switches | ip default-gateway inactive when routing on | Configured explicit management static default route |
Zero-Outage Rollback Strategy
Most automation tutorials demonstrate destructive rollbacks: erasing startup-config and reloading the chassis. In an enterprise network, wiping a switch destroys the management VLAN SVI, SSH authentication keys, and trunk uplinks, isolating the switch completely and requiring emergency physical console access.
To prevent this, I engineered a dedicated rollback playbook (ansible/playbooks/rollback/rollback.yml):
The rollback playbook enforces a mandatory --limit flag, protects critical automation uplinks (such as SW-A-DIS Gi2/1 connecting the automation host), removes only automated department VLANs, and preserves the out-of-band management channel so immediate re-provisioning can take place.
# ansible/playbooks/rollback/rollback.yml - Safe Rollback Assertion
- name: Emergency Switch State Rollback
hosts: all
gather_facts: false
tasks:
- name: Assert explicit single-switch limit flag
ansible.builtin.assert:
that:
- ansible_limit is defined
fail_msg: "FATAL: Rollback requires explicit --limit to prevent campus-wide outage"
- name: Restore baseline access interface configuration
cisco.ios.ios_interfaces:
config: "{{ rollback_interfaces }}"
state: overridden
- name: Purge non-baseline department VLANs
cisco.ios.ios_vlans:
config:
- vlan_id: 99
name: MGMT
- vlan_id: 100
name: NATIVE
state: overridden
Continuous Telemetry with Zabbix 6.0 LTS
Deploying a resilient architecture is only half the battle: operators must be immediately alerted when redundant components fail before both nodes go down. The entire 11-device network was brought under continuous monitoring using Zabbix 6.0 LTS over SNMPv2c.
SNMP community strings and host ACL exceptions were pushed to every router and switch via automated Netmiko and Ansible tasks. Four custom triggers were engineered:
- Router/Switch Availability Probe: ICMP and SNMP responsiveness polling every 30 seconds.
- CPU Threshold Trigger: Catches control-plane CPU spikes over 80% on core routers.
- Interface Flap Alert: Detects rapid link status changes on inter-core 802.1Q trunks.
- Core Redundancy Failover Detection: Alerts operators if a core switch loses HSRP active state, detecting a silent single-point failure before the backup core also experiences distress.
The Zabbix environment was validated by intentionally disabling core switch interfaces and observing the triggers fire instantly on the dashboard. Dashboards and host maps were fully codified and exported to JSON for version-controlled disaster recovery.
Key Lessons and Engineering Insights
-
Redundancy Introduces State-Consistency Hazards: Adding a second core switch eliminates hardware single points of failure, but introduces insidious split-brain and synchronization risks. If an access list or VLAN database differs between SW-CORE-1 and SW-CORE-2, traffic behaves unpredictably depending on which HSRP gateway forwards the packet. Automated declarative tooling is not a luxury; it is the only way redundant cores remain safe.
-
Idempotency Must Be Hand-Engineered for Procedural Devices: Netmiko has no native awareness of state. Achieving idempotent router configurations required line-by-line comparison logic, regex parsing, and timing-based command delivery to distinguish between slow responses and missing commands.
-
Treat Network Intent as Version-Controlled Data: Hardcoding IPs or interface lists in automation scripts destroys maintainability. By isolating device parameters into YAML inventories and Jinja2 templates, updating a department subnet requires editing a single line in a data file.
-
Zero-Touch Rollback Must Protect the Management Plane: A rollback routine that removes management interfaces or trunk ports turns a software roll-back into a physical maintenance outage. Safe automation always protects out-of-band access channels.
Discuss this project
Have questions about the architecture or design decisions?