Difference between revisions of "Mikrotik: OSPF Sederhana"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "center|400px|thumb [admin@MikroTikR1]/ip address add address=10.10.1.1/30 interface=ether1 [admin@MikroTikR1]/ip address add address=10.10.1.5/30 in...")
 
Line 13: Line 13:
 
  [admin@MikroTikR3]/ip address add address=10.10.1.10/30 interface=ether2
 
  [admin@MikroTikR3]/ip address add address=10.10.1.10/30 interface=ether2
 
  [admin@MikroTikR3]/ip address add address=192.168.1.0/24 interface=ether3
 
  [admin@MikroTikR3]/ip address add address=192.168.1.0/24 interface=ether3
 +
 +
 +
There are three basic elements of OSPF configuration:
 +
 +
* Enable OSPF instance
 +
* OSPF area configuration
 +
* OSPF network configuration
 +
 +
 +
R1:
 +
 +
[admin@MikroTikR1] /routing ospf instance> add name=default
 +
 +
R2:
 +
 +
[admin@MikroTikR2] /routing ospf instance> add name=default
 +
 +
R3:
 +
 +
[admin@MikroTikR3] /routing ospf instance> add name=default
 +
 +
 +
Cek
 +
 +
[admin@MikroTikR1] /routing ospf instance> print
 +
 +
Flags: X - disabled
 +
  0  name="default" router-id=0.0.0.0 distribute-default=never
 +
      redistribute-connected=as-type-1 redistribute-static=as-type-1
 +
      redistribute-rip=no redistribute-bgp=no redistribute-other-ospf=no
 +
      metric-default=1 metric-connected=20 metric-static=20 metric-rip=20
 +
      metric-bgp=auto metric-other-ospf=auto in-filter=ospf-in
 +
out-filter=ospf-out
 +
 +
 +
Create bridge interface named, for example, “loopback”:
 +
 +
[admin@MikroTikR1] /interface bridge> add name=loopback
 +
 +
Add IP address:
 +
 +
[admin@MikroTikR1] > ip address add address=10.255.255.1/32 interface=loopback
 +
 +
Configure router-id as loopback:
 +
 +
[admin@MikroTikR1] /routing ospf instance> set 0 router-id=10.255.255.1
 +
 +
 +
This can be done on other routers (R2, R3) as well.
 +
Note: Remember that backbone area-id is always (zero) 0.0.0.0.
 +
 +
On R1
 +
 +
[admin@MikroTikR1] /routing ospf network> add network=210.13.1.0/28 area=backbone
 +
[admin@MikroTikR1] /routing ospf network> add network=10.10.1.0/30 area=backbone
 +
[admin@MikroTikR1] /routing ospf network> add network=10.10.1.4/30 area=backbone
 +
 +
Instead of typing in each network, you can aggregate networks using appropriate subnet mask. For example, to aggregate 10.10.1.0/30, 10.10.1.4/30, 10.10.1.8/30 networks, you can set up following ospf network:
 +
 +
[admin@MikroTikR1] /routing ospf network> add network=10.10.1.0/24 area=backbone
 +
 +
 +
R2:
 +
 +
[admin@MikroTikR2] /routing ospf network> add network=172.16.1.0/16 area=backbone
 +
[admin@MikroTikR2] /routing ospf network> add network=10.10.1.0/24 area=backbone
 +
 +
R3:
 +
 +
[admin@MikroTikR3] /routing ospf network> add network=192.168.1.0/24 area=backbone
 +
[admin@MikroTikR3] /routing ospf network> add network=10.10.1.0/24 area=backbone
 +
 +
==Verify==
 +
 +
You can verify your OSPF operation as follows:
 +
 +
Look at the OSPF interface menu to verify that dynamic entry was created:
 +
 +
[admin@MikroTikR1] /routing ospf interface> print
 +
 +
Check your OSPF neighbors, what DR and BDR is elected and adjacencies established:
 +
 +
[admin@MikroTikR1] /routing ospf neighbor> print
 +
 +
Check router’s routing table (make sure OSPF routes are present):
 +
 +
[admin@MikroTik_CE1] > ip route print
  
  

Revision as of 08:52, 13 November 2018

Image6005.gif


[admin@MikroTikR1]/ip address add address=10.10.1.1/30 interface=ether1
[admin@MikroTikR1]/ip address add address=10.10.1.5/30 interface=ether2
[admin@MikroTikR1]/ip address add address=210.13.1.0/28 interface=ether3
[admin@MikroTikR2]/ip address add address=10.10.1.6/30 interface=ether1
[admin@MikroTikR2]/ip address add address=10.10.1.9/30 interface=ether2
[admin@MikroTikR2]/ip address add address=172.16.1.0/16 interface=ether3
[admin@MikroTikR3]/ip address add address=10.10.1.2 /30 interface=ether1
[admin@MikroTikR3]/ip address add address=10.10.1.10/30 interface=ether2
[admin@MikroTikR3]/ip address add address=192.168.1.0/24 interface=ether3


There are three basic elements of OSPF configuration:

  • Enable OSPF instance
  • OSPF area configuration
  • OSPF network configuration


R1:

[admin@MikroTikR1] /routing ospf instance> add name=default

R2:

[admin@MikroTikR2] /routing ospf instance> add name=default

R3:

[admin@MikroTikR3] /routing ospf instance> add name=default


Cek

[admin@MikroTikR1] /routing ospf instance> print 
Flags: X - disabled 
 0   name="default" router-id=0.0.0.0 distribute-default=never 
     redistribute-connected=as-type-1 redistribute-static=as-type-1 
     redistribute-rip=no redistribute-bgp=no redistribute-other-ospf=no 
     metric-default=1 metric-connected=20 metric-static=20 metric-rip=20 
     metric-bgp=auto metric-other-ospf=auto in-filter=ospf-in 
out-filter=ospf-out


Create bridge interface named, for example, “loopback”:

[admin@MikroTikR1] /interface bridge> add name=loopback

Add IP address:

[admin@MikroTikR1] > ip address add address=10.255.255.1/32 interface=loopback 

Configure router-id as loopback:

[admin@MikroTikR1] /routing ospf instance> set 0 router-id=10.255.255.1


This can be done on other routers (R2, R3) as well. Note: Remember that backbone area-id is always (zero) 0.0.0.0.

On R1

[admin@MikroTikR1] /routing ospf network> add network=210.13.1.0/28 area=backbone
[admin@MikroTikR1] /routing ospf network> add network=10.10.1.0/30 area=backbone
[admin@MikroTikR1] /routing ospf network> add network=10.10.1.4/30 area=backbone 

Instead of typing in each network, you can aggregate networks using appropriate subnet mask. For example, to aggregate 10.10.1.0/30, 10.10.1.4/30, 10.10.1.8/30 networks, you can set up following ospf network:

[admin@MikroTikR1] /routing ospf network> add network=10.10.1.0/24 area=backbone


R2:

[admin@MikroTikR2] /routing ospf network> add network=172.16.1.0/16 area=backbone
[admin@MikroTikR2] /routing ospf network> add network=10.10.1.0/24 area=backbone

R3:

[admin@MikroTikR3] /routing ospf network> add network=192.168.1.0/24 area=backbone
[admin@MikroTikR3] /routing ospf network> add network=10.10.1.0/24 area=backbone

Verify

You can verify your OSPF operation as follows:

Look at the OSPF interface menu to verify that dynamic entry was created:

[admin@MikroTikR1] /routing ospf interface> print

Check your OSPF neighbors, what DR and BDR is elected and adjacencies established:

[admin@MikroTikR1] /routing ospf neighbor> print

Check router’s routing table (make sure OSPF routes are present):

[admin@MikroTik_CE1] > ip route print





Referensi