Network engineers often face the challenge of validating routing protocol configurations across multiple devices. A small misconfiguration in EIGRP (Enhanced Interior Gateway Routing Protocol) — such as mismatched AS numbers or missing network statements — can cause routing issues that are difficult to track down manually.
In this article, we’ll explore how to use Python (with the help of Netmiko) to automate the validation of EIGRP configurations on Cisco devices.
Why Automate EIGRP Validation?
Manual validation typically involves logging into each router and checking:
- The EIGRP Autonomous System (AS) number.
- Neighbor adjacencies (
show ip eigrp neighbors). - Advertised networks (
show run | section eigrp). - The routing table (
show ip route eigrp).
While manageable on a few devices, this quickly becomes time-consuming in larger environments. Automation allows us to:
-
Run validation across multiple devices.
-
Standardize checks.
-
Detect and report mismatches faster.
Python Script for EIGRP Validation
Below is an example script using Netmiko. It connects to a list of devices, runs EIGRP validation commands, and parses the output for key details.
from netmiko import ConnectHandler
# Define device list
devices = [
{
"device_type": "cisco_ios",
"ip": "192.168.1.1",
"username": "admin",
"password": "cisco123",
},
{
"device_type": "cisco_ios",
"ip": "192.168.1.2",
"username": "admin",
"password": "cisco123",
},
]
# Expected configuration
expected_as = "100"
expected_networks = ["192.168.1.0", "10.1.1.0"]
def validate_eigrp(device):
print(f"\n--- Connecting to {device['ip']} ---")
connection = ConnectHandler(**device)
# Get EIGRP neighbors
neighbors = connection.send_command("show ip eigrp neighbors")
print("\nEIGRP Neighbors:")
print(neighbors)
# Get EIGRP config section
run_config = connection.send_command("show run | section eigrp")
print("\nEIGRP Config:")
print(run_config)
# Validate AS number
if f"router eigrp {expected_as}" in run_config:
print(f"[OK] EIGRP AS number matches ({expected_as})")
else:
print(f"[ERROR] EIGRP AS number mismatch!")
# Validate networks
for net in expected_networks:
if net in run_config:
print(f"[OK] Network {net} is configured")
else:
print(f"[ERROR] Network {net} missing")
connection.disconnect()
# Run validation on all devices
for device in devices:
validate_eigrp(device)
Example Output
--- Connecting to 192.168.1.1 ---
EIGRP Neighbors:
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
0 192.168.1.2 Fa0/0 13 00:12:34 10 200 0 123
EIGRP Config:
router eigrp 100
network 192.168.1.0
network 10.1.1.0
[OK] EIGRP AS number matches (100)
[OK] Network 192.168.1.0 is configured
[OK] Network 10.1.1.0 is configured
Enhancements and Next Steps
This script is a starting point. You can extend it by:
- Parsing neighbor output to ensure the expected neighbor count is met.
- Checking EIGRP metrics and timers for consistency.
- Exporting results to a CSV or JSON report.
- Integrating with Ansible or Nornir for larger scale validation.
Conclusion
Validating EIGRP manually can be tedious, but Python provides a reliable way to automate the process and ensure consistency across your network. With just a few lines of code, you can detect configuration mismatches early, saving hours of troubleshooting time.

