Skip to content

Instantly share code, notes, and snippets.

@hunzo
Created November 21, 2024 08:08
Show Gist options
  • Save hunzo/1cf1bca48f1dc0e523dcc37f120c8028 to your computer and use it in GitHub Desktop.
Save hunzo/1cf1bca48f1dc0e523dcc37f120c8028 to your computer and use it in GitHub Desktop.
example config ospf on mikrotik router os version 7

R1

  • initial router R1
/system/identity/set name=R1
/tool/romon/ set enabled=yes
  • set ip address and create bridge
/ip address add address=10.0.0.1/30 interface=ether1
interface/bridge/add name=bridge
  • create vlan 100, 200
interface/vlan/add vlan-id=100 interface=bridge name=vlan100
ip address/add address=192.168.1.1/24 interface=vlan100

interface/vlan/add vlan-id=200 interface=bridge name=vlan200
ip address/add address=192.168.2.1/24 interface=vlan200
  • create ospf instance
/routing ospf instance add name=default version=2 router-id=1.1.1.1
/routing ospf area add name=backbone area-id=0.0.0.0 instance=default
/routing ospf interface-template add networks=10.0.0.0/30 area=backbone
  • add network to ospf routing
/routing ospf interface-template add networks=192.168.1.0/24 area=backbone
/routing ospf interface-template add networks=192.168.2.0/24 area=backbone

R2

  • initial router R2
/system/identity/set name=R2
/tool/romon/ set enabled=yes
  • set ip address and create bridge
/ip address add address=10.0.0.2/30 interface=ether1
/interface/bridge/add name=bridge
  • create vlan 300, 400
/interface/vlan/add vlan-id=300 interface=bridge name=vlan300
/ip address/add address=192.168.3.1/24 interface=vlan100

/interface/vlan/add vlan-id=400 interface=bridge name=vlan400
/ip address/add address=192.168.4.1/24 interface=vlan300
  • create ospf instance
/routing ospf instance add name=default version=2 router-id=2.2.2.2
/routing ospf area add name=backbone area-id=0.0.0.0 instance=default
/routing ospf interface-template add networks=10.0.0.0/30 area=backbone
  • add network to ospf routing
/routing ospf interface-template add networks=192.168.3.0/24 area=backbone
/routing ospf interface-template add networks=192.168.4.0/24 area=backbone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment