Simple MikroTik OSPF Routing (Backbone) With Internet.

The first thing is to disable ether1 as a dhcp client and assign a name:

R1

1
2
3
/ip dhcp-client disable 0

/system identity set name=R1

R2

1
2
3
/ip dhcp-client disable 0

/system identity set name=R2

Assign ip to interfaces and loopback

R1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/ip dhcp-client
add interface=ether1 disabled=no

/interface list
add name=WAN

/interface list member
add interface=ether1 list=WAN

/interface bridge
add name=loopback1

/ip address
add interface=loopback1 address=7.7.7.7/32
add interface=ether2 address=192.168.10.5/30

R2

1
2
3
4
5
6
/interface bridge
add name=loopback1

/ip address
add interface=loopback1 address=6.6.6.6/32
add interface=ether1 address=192.168.10.6/30

Enable nat on router 1 to mask the private routing to the internet

R1

1
2
/ip firewall nat
add chain=srcnat action=masquerade out-interface-list=WAN

OSPF Instance Configuration

We’ll configure the IP addresses created in the previous steps as the OSPF router’s ID. Use the following commands to configure the OSPF instances:

R1

1
2
3
4
5
6
7
8
/routing ospf instance
set [ find default=yes ] distribute-default=if-installed-as-type-1 redistribute-connected=as-type-1 router-id=7.7.7.7

/routing ospf interface
add interface=ether2 network-type=point-to-point

/routing ospf network
add area=backbone network=192.168.10.4/30

R2

1
2
3
4
5
6
7
8
/routing ospf instance
set [ find default=yes ] redistribute-connected=as-type-1 router-id=6.6.6.6

/routing ospf interface
add interface=ether1 network-type=point-to-point

/routing ospf network
add area=backbone network=192.168.10.4/30

Enable DHCP server

Finally we create the dhcp server for lan and can access the routers

R2

1
2
3
4
5
6
7
8
9
10
11
/ip pool
add name=pool1 ranges=192.168.2.2-192.168.2.20

/ip dhcp-server
add address-pool=pool1 disabled=no interface=ether2 name=dhcp1

/ip address
add address=192.168.2.1/24 interface=ether2 network=192.168.2.0

/ip dhcp-server network
add address=192.168.2.0/24 dns-server=1.1.1.1 gateway=192.168.2.1 netmask=24

Exercise in gns3

Exercise in gns3

####### References

https://forum.mikrotik.com/viewtopic.php?t=116968

© 2020 Juvenal Yescas All Rights Reserved.
Theme by hiero