MikroTik distributes a free to use appliance with its RouterOS called operating system. This virtual appliance, called CHR, can be downloaded at the gn3 marketplace website or directly on the MikroTik website. It can be run using QEMU or using GNS3. The free CHR router has a maximal 1Mbit/s throughput. But that is enough to configure a virtual lab with 2 or more CHR routers using a dynamic routing protocol.
The networking scenario is easy, it is using 2 directly connected CHR appliances, via the ether1 interface. Direct point to point connection. Each router has additionally configured ip loopback address and announces the IP prefix to its neighbor.
loopback loopback
10.255.255.1/32 10.255.255.2/32
+-------+ +-------+
| | eth1 10.0.0.0/30 eth1 | |
| R1 |-----------------------------------| R2 |
| | .1 .2 | |
+-------+ +-------+
user: admin
<blank password>
For first steps, read the friendly manual
- set hostname R1 and R2
- configure a loopback0 interface
- add ip addresses to interfaces
Enter following configuration commands on R1:
/system identity set name=R1
/interface bridge add name=loopback0
/ip address
add address=10.255.255.1/32 interface=loopback0
add address=10.0.0.1/30 interface=ether1
Enter configuration commands on R2:
/system identity set name=R2
/interface bridge add name=loopback0
/ip address
add address=10.255.255.2/32 interface=loopback0
add address=10.0.0.2/30 interface=ether1
Show current ip configuration using the ip address print command:
ip address print
[admin@R1] > ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 10.255.255.1/32 10.255.255.1 loopback0
1 10.0.0.1/30 10.0.0.0 ether1
Verify connectivity on directly connected interfaces on R1:
[admin@R1] > ping 10.0.0.2 count=2
SEQ HOST SIZE TTL TIME STATUS
0 10.0.0.2 56 64 1ms
1 10.0.0.2 56 64 1ms
sent=2 received=2 packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=1ms
Connectivity check from R2:
[admin@R2] > ping 10.0.0.1 count=2
SEQ HOST SIZE TTL TIME STATUS
0 10.0.0.1 56 64 0ms
1 10.0.0.1 56 64 1ms
sent=2 received=2 packet-loss=0% min-rtt=0ms avg-rtt=0ms max-rtt=1ms
- configure OSPF process
- advertise loopback interfaces
- advertise transfer network
- add networks to the area 0, backbone area
Configure on R1:
routing ospf network add network=10.255.255.1/32 area=backbone
routing ospf network add network=10.0.0.0/30 area=backbone
Configure on R2:
routing ospf network add network=10.255.255.2/32 area=backbone
routing ospf network add network=10.0.0.0/30 area=backbone
Verify the routing table, using the ip route print command:
[admin@R1] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 ADC 10.0.0.0/30 10.0.0.1 ether1 0
1 ADC 10.255.255.1/32 10.255.255.1 loopback0 0
2 ADo 10.255.255.2/32 10.0.0.2 110
R2's loopback interface address 10.255.255.2 should appear in the routing table of R1:
[admin@R1] > routing ospf route print
# DST-ADDRESS STATE COST GATEWAY INTERFACE
0 10.0.0.0/30 intra-area 10 0.0.0.0 ether1
1 10.255.255.1/32 intra-area 10 0.0.0.0 loopback0
2 10.255.255.2/32 intra-area 20 10.0.0.2 ether1
Show OSPF neighbors:
[admin@R1] > routing ospf neighbor print
0 instance=default router-id=10.0.0.2 address=10.0.0.2 interface=ether1
priority=1 dr-address=10.0.0.1 backup-dr-address=10.0.0.2 state="Full"
state-changes=5 ls-retransmits=0 ls-requests=0 db-summaries=0
adjacency=40m7s
[admin@R2] > routing ospf neighbor print brief
# ROUTER-ID ADDRESS STATE STATE-CHANGES
0 10.255.255.1 10.0.0.1 Full 5
For directly connected OSPF neighbors, there is no need for BDR DR elections. The directly connected link on will be set to point-to-point. This should improve the convergence time of OSPF.
On both routers, R1 and R2 add the following:
/routing ospf interface add network-type=point-to-point
Additionally set the OSPF router-id on R1:
/routing ospf instance
set default router-id=10.255.255.1
Set the OSPF router-id on R2 too:
/routing ospf instance
set default router-id=10.255.255.2
Verfiy the dr-address and backup-dr-address OSPF neighbor output, it is set to 0.
[admin@R2] > routing ospf neighbor print
0 instance=default router-id=10.255.255.1 address=10.0.0.1 interface=ether1
priority=1 dr-address=0.0.0.0 backup-dr-address=0.0.0.0 state="Full"
state-changes=4 ls-retransmits=0 ls-requests=0 db-summaries=0
adjacency=2h48m9s