Mikrotik OSPF Multi-Area Network.

The first step is to name the device and activate dhcp on the ether1(WAN)port, to obtain an ip and be able to surf the internet.

R1

1
2
3
4
5
/system identity set name=R1

/ip dhcp-client
remove 0
add interface=ether1 enabled=yes

Enabling dhcp on ether1

It is also necessary to activate nat to be able to mask the internal network.

Activating nat in ether1

Once the router is prepared, the loopback virtual interface is created and the corresponding ips are assigned to the interfaces.

1
2
3
4
5
6
7
8
/interface bridge
add name=loopback

/ip address
add interface=loopback address=172.16.0.1/32

add interface=ether2 address=10.0.0.1/30
add interface=ether3 address=10.0.0.5/30

Creating loopback interface

Assigned ips

Configuring ospf

The default instance is edited, the distribution of the default gateway is activated distribute-default throughout the network and the same identifier of the loopback 172.16.0.1 is assigned to be able to identify it quickly.

1
2
/routing ospf instance
set [ find default=yes ] distribute-default=if-installed-as-type-1 redistribute-connected=as-type-1 router-id=172.16.0.1

Instance default modified

The interfaces that intervene with the authentication key keyPassword1 are added

1
2
3
/routing ospf interface
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether3 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

Interfaces added with authentication

The networks that belong to the backbone area are assigned:

1
2
3
/routing ospf network
add area=backbone network=10.0.0.0/30
add area=backbone network=10.0.0.4/30

Added networks

Up to this point R1 is ready.


R2

1
2
3
4
5
6
7
/system identity set name=R2

/ip dhcp-client
remove 0

/interface bridge
add name=loopback
1
2
3
4
5
6
7
/ip address 
add interface=loopback address=172.16.0.2/32

add interface=ether1 address=10.0.0.2/30
add interface=ether2 address=10.0.0.9/30
add interface=ether3 address=10.0.0.14/30
add interface=ether4 address=10.0.0.17/30

Assigned ip R2

OSPF configuration.

1
2
/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 redistribute-other-ospf=as-type-1 router-id=172.16.0.2

Instance default modified R2

It is necessary to activate the redistribution of other ospf routes, so that the other areas can communicate.

1
2
3
4
5
/routing ospf interface
add interface=ether1 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether3 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether4 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

Interfaces added with authentication

1
2
/routing ospf area
add area-id=0.0.0.1 name=area1

New area added `area1`

1
2
3
4
5
/routing ospf network
add area=backbone network=10.0.0.0/30
add area=backbone network=10.0.0.8/30
add area=area1 network=10.0.0.12/30
add area=area1 network=10.0.0.16/30

Added networks


When reviewing the neighbor of the R1 the new r2 appears 172.16.0.2

The new neighbor of the R1


R3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/system identity set name=R3

/ip dhcp-client
remove 0

/interface bridge
add name=loopback

/ip address
add interface=loopback address=172.16.0.3/32

add interface=ether1 address=10.0.0.6/30
add interface=ether2 address=10.0.0.10/30
add interface=ether3 address=10.0.0.25/30
add interface=ether4 address=10.0.0.29/30

# OSPF configuration

/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 redistribute-other-ospf=as-type-1 router-id=172.16.0.3

/routing ospf interface
add interface=ether1 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether3 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether4 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

/routing ospf area
add area-id=0.0.0.2 name=area2

/routing ospf network
add area=backbone network=10.0.0.4/30
add area=backbone network=10.0.0.8/30
add area=area2 network=10.0.0.24/30
add area=area2 network=10.0.0.28/30

R4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/system identity set name=R4

/ip dhcp-client
remove 0

/interface bridge
add name=loopback

/ip address
add interface=loopback address=172.16.0.4/32

add interface=ether1 address=10.0.0.13/30
add interface=ether2 address=10.0.0.21/30

# OSPF configuration

/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 router-id=172.16.0.4

/routing ospf interface
add interface=ether1 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

/routing ospf area
add area-id=0.0.0.1 name=area1

/routing ospf network
add area=area1 network=10.0.0.12/30
add area=area1 network=10.0.0.20/30

R5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/system identity set name=R5

/ip dhcp-client
remove 0

/interface bridge
add name=loopback

/ip address
add interface=loopback address=172.16.0.5/32

add interface=ether1 address=10.0.0.18/30
add interface=ether2 address=10.0.0.22/30

# OSPF configuration

/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 router-id=172.16.0.5

/routing ospf interface
add interface=ether1 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

/routing ospf area
add area-id=0.0.0.1 name=area1

/routing ospf network
add area=area1 network=10.0.0.16/30
add area=area1 network=10.0.0.20/30

R6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/system identity set name=R6

/ip dhcp-client
remove 0

/interface bridge
add name=loopback

/ip address
add interface=loopback address=172.16.0.6/32

add interface=ether1 address=10.0.0.26/30
add interface=ether2 address=10.0.0.33/30

# OSPF configuration

/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 router-id=172.16.0.6

/routing ospf interface
add interface=ether1 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

/routing ospf area
add area-id=0.0.0.2 name=area2

/routing ospf network
add area=area2 network=10.0.0.24/30
add area=area2 network=10.0.0.32/30

R7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/system identity set name=R7

/ip dhcp-client
remove 0

/interface bridge
add name=loopback

/ip address
add interface=loopback address=172.16.0.7/32

add interface=ether1 address=10.0.0.30/30
add interface=ether2 address=10.0.0.34/30

# OSPF configuration

/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 router-id=172.16.0.7

/routing ospf interface
add interface=ether1 network-type=point-to-point authentication=md5 authentication-key=keyPassword1
add interface=ether2 network-type=point-to-point authentication=md5 authentication-key=keyPassword1

/routing ospf area
add area-id=0.0.0.2 name=area2

/routing ospf network
add area=area2 network=10.0.0.28/30
add area=area2 network=10.0.0.32/30

When finished configuring everything, in the route list of R1 they were added dynamically.

Route list R1

When traceroute from R4 to R7 it crosses through R2-> R3-> R7, and communication already exists in the different areas.

Traceroute to R7

There is also a response when pinging the cloudfare dns.

Ping 1.1.1.1


Design in gns3

Design in gns3

References:

https://wiki.mikrotik.com/wiki/Manual:OSPF_Case_Studies

https://www.youtube.com/watch?v=ksVAvvNdksU

https://www.manitonetworks.com/networking/2018/6/21/mikrotik-ospf-routing

© 2020 Juvenal Yescas All Rights Reserved.
Theme by hiero