The ISP That Wouldn't Talk - Automating OSPF in Oracle VM (Part 1)

Today was supposed to be simple: Spin up 3 VyOS routers in Oracle VM, make them talk OSPF, and prove my Python automation works. Instead, I spent the evening fighting PowerShell and a silent OSPF process.

This is Part 1 of building the ISP backbone for my lab.

The Goal

Configure OSPF Area 0 across three VyOS routers:

  • VyOS-R1 (192.168.56.101) - router-id 10.0.0.1
  • VyOS-R2 (192.168.56.102) - router-id 10.0.0.2
  • VyOS-R3 (192.168.56.103) - router-id 10.0.0.3 All on 192.168.56.0/24

All configuration must be done via automation, not console clicks.

The Script That Was Sent via SSH

This is the script I ran from Windows PowerShell using Netmiko over SSH. It sends VyOS config commands as the vyos user.

File: OSPF12NOV.py (on Desktop)

import getpass
from netmiko import ConnectHandler

routers = [
{"host": "192.168.56.101", "router_id": "10.0.0.1"},
{"host": "192.168.56.102", "router_id": "10.0.0.2"},
{"host": "192.168.56.103", "router_id": "10.0.0.3"},
]

username = "vyos"
password = getpass.getpass("VyOS password: ")

for r in routers:
print(f"\n--- Configuring OSPF on {r['host']} ---")
device = {
"device_type": "vyos",
"host": r['host'],
"username": username,
"password": password,
}
conn = ConnectHandler(**device)

config_commands = [ "configure", f"set protocols ospf area 0 network 192.168.56.0/24", f"set protocols ospf parameters router-id {r['router_id']}", "commit", "save", "exit" ] output = conn.send_config_set(config_commands) print(output) conn.disconnect() 

The script reported no errors. I thought I was done.

What Went Wrong - The 2 Bugs

Bug 1: PowerShell Command Precedence

I tried to run the script like this:
PS> neighbors.py

Error:
neighbors.py : The term 'neighbors.py' is not recognized...

Fix: Windows PowerShell does not run files from the current directory without .\
Correct way:
PS> python .\neighbors.py
or
PS> .\neighbors.py

Bug 2: The Silent OSPF Process - The Big One

After fixing 1 and 2, I checked the router directly:

vyos@VyOS-R1:~$ show configuration commands | match ospf
set protocols ospf area 0 network '192.168.56.0/24'
set protocols ospf parameters router-id '10.0.0.1'

Config is there. Committed. Saved. Looks good.

Then:

vyos@VyOS-R1:~$ show ip ospf
vyos@VyOS-R1:~$

Nothing. Blank. And:
vyos@VyOS-R1:~$ show ip ospf neighbor
% OSPF is not enabled

The configuration exists but the OSPF daemon never started. This is why automation matters - if I had clicked it manually I would have assumed I made a typo. Because the script ran with no errors, I know the commit succeeded but the service did not.

What I Will Do Tomorrow to Fix It - Part 2 Plan

I am NOT fixing it manually tonight. If I fix it by hand, this is no longer an automation lab and I won't know if the script can properly delete and recreate.

Tomorrow's plan:

  1. Create a clean delete script (delete_ospf.py) to wipe OSPF:
    configure
    delete protocols ospf
    commit
    save

  2. Re-run the add script (OSPF12NOV.py) fresh after delete

  3. Debug why FRR/OSPF is not starting:

    • Check show ip ospf interface
    • Check show log | match ospf
    • Potentially need to specify area-type or explicitly enable on interface
    • Test with a manual minimal config on one router first, then put that working config back into the Python script
  4. Final verification that proves automation works:
    ssh vyos@192.168.56.101
    show ip ospf neighbor
    -> Should show Full state for .102 and .103

Goal for Part 2: From "OSPF is not enabled" to "Full/BDR" using only Python scripts.

Status at end of Part 1: Config present, OSPF process silent. Lab left in broken state on purpose.