Difference between revisions of "OSPF/Summarization and redistribution complex example"

From MikroTik Wiki
Jump to: navigation, search
(Basic OSPF configuration)
Line 9: Line 9:
  
 
== Basic OSPF configuration ==
 
== Basic OSPF configuration ==
 +
 +
OSPF areas configuration is introduced below:
 +
 +
[[Image:OSPF_summarization_2.png]]
  
 
First of all let's configure basic parametrs on our routers.
 
First of all let's configure basic parametrs on our routers.

Revision as of 11:19, 17 June 2009

OSPF routes redistribution, summarization and stub area complex example

Packages required: routing

Let's look at the network topology show below. We have three routes connected to each other via ethernet. Routers R0 and R1 are MikroTik RouterBOARDs running RouterOS 3.25 and router R3 is Cisco 2611. R3 can be any other router and cisco is taken just for example.


OSPF summary.jpeg

Basic OSPF configuration

OSPF areas configuration is introduced below:

OSPF summarization 2.png

First of all let's configure basic parametrs on our routers.

R0 without external routes summarization

/ip address
add address=192.168.88.2/25 broadcast=192.168.88.127 comment="" disabled=no \
    interface=ether1 network=192.168.88.0
add address=192.168.88.129/25 broadcast=192.168.88.255 comment="" disabled=no \
    interface=ether2 network=192.168.88.128
add address=192.168.85.1/24 broadcast=192.168.85.255 comment="" disabled=no \
    interface=loopback0 network=192.168.85.0

This blackhole route will emulate remote network 192.168.84.0/24 reachable via static route:

/ip route
add disabled=no distance=1 dst-address=192.168.84.0/24 type=blackhole

Here we will start OSPF process for router R0 and change default parameters to make redistribution of connected and static routes. Also add 192.168.88.0/24 network to OSPF routing process:

/routing ospf area
set backbone area-id=0.0.0.0 authentication=none disabled=no name=backbone \
   type=default
/routing ospf
set distribute-default=never metric-bgp=20 metric-connected=20 \
    metric-default=1 metric-rip=20 metric-static=20 mpls-te-area=unspecified \
    mpls-te-router-id=unspecified redistribute-bgp=no redistribute-connected=\
    as-type-1 redistribute-rip=no redistribute-static=as-type-1 router-id=0.0.0.0
/routing ospf network
add area=backbone disabled=no network=192.168.88.0/24

Lets's look at R0 routing table:

[admin@R0] > /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-STATE GATEWAY               DISTANCE INTERFACE
1 A SB 192.168.84.0/24                                                        1
2 ADC  192.168.85.0/24    192.168.85.1                                        0        loopback0
3 ADC  192.168.88.0/25    192.168.88.2                                        0        ether1
4 ADC  192.168.88.128/25  192.168.88.129                                      0        ether2
5 ADo  192.168.89.64/26                   reachable     192.168.88.3          110      ether1


R1 without inter-area summarization

/ip address
add address=192.168.88.3/25 broadcast=192.168.88.127 comment="" disabled=no \
    interface=ether1 network=192.168.88.0
add address=192.168.89.66/26 broadcast=192.168.89.127 comment="" disabled=no \
    interface=ether2 network=192.168.89.64

Here we will start OSPF process for router R1. Also add 192.168.89.64/26 and 192.168.88.0/25 networks to OSPF routing process:

/routing ospf area
set backbone area-id=0.0.0.0 authentication=none disabled=no name=backbone \
    type=default
add area-id=0.0.0.1 authentication=none default-cost=1 disabled=no \
    inject-summary-lsa=no name=area1 type=default
/routing ospf
set distribute-default=never metric-bgp=20 metric-connected=20 \
    metric-default=1 metric-rip=20 metric-static=20 mpls-te-area=unspecified \
    mpls-te-router-id=unspecified redistribute-bgp=no redistribute-connected=\
    no redistribute-rip=no redistribute-static=no router-id=0.0.0.0
/routing ospf network
add area=area1 disabled=no network=192.168.89.64/26
add area=backbone disabled=no network=192.168.88.0/25

Lets's look at R1 routing table:

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-STATE GATEWAY               DISTANCE INTERFACE
 0 ADo  192.168.84.0/24                    reachable     192.168.88.2          110      ether1
 1 ADo  192.168.85.0/24                    reachable     192.168.88.2          110      ether1
 2 ADC  192.168.88.0/25    192.168.88.3                                        0        ether1
 3 ADo  192.168.88.128/25                  reachable     192.168.88.2          110      ether1
 4 ADC  192.168.89.64/26   192.168.89.66                                       0        ether2

R2 configuration

R2 configuration is very simple even if you don't know syntax of Cisco IOS configuration:

interface Ethernet0/0
 ip address 192.168.89.65 255.255.255.192
!
interface Ethernet0/1
 ip address 192.168.89.1 255.255.255.192
!
router ospf 1
 network 192.168.89.64 0.0.0.63 area 1
!

0.0.0.63 is wildcard mask for network mask 255.255.255.192. Corresponding RouterOS configuration should look like this:

/routing ospf network
 add area=area1 disabled=no network=192.168.89.64/26

Lets's look at R2 routing table (output omitted):

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2    
       ia - IS-IS inter area, * - candidate default, U - per-user static route
...
     192.168.89.0/26 is subnetted, 2 subnets
C       192.168.89.0 is directly connected, Ethernet0/1
C       192.168.89.64 is directly connected, Ethernet0/0
     192.168.88.0/25 is subnetted, 2 subnets
O IA    192.168.88.0 [110/20] via 192.168.89.66, 00:10:10, Ethernet0/0
O IA    192.168.88.128 [110/30] via 192.168.89.66, 00:10:14, Ethernet0/0
O E1 192.168.85.0/24 [110/40] via 192.168.89.66, 00:09:28, Ethernet0/0
O E1 192.168.84.0/24 [110/40] via 192.168.89.66, 00:09:57, Ethernet0/0

Redistributing static routes and summarization

It's time to start inter-area routes and external routes summarization.

R0

Let's add blackhole summary route for static route 192.168.84.0/24 adn connected route 192.168.85.0/24:

/ip route
add comment="" disabled=no distance=254 dst-address=192.168.84.0/23 type=\
    blackhole

Whith routing filter we will allow only summary route advertisement:

/routing filter
add action=accept chain=ospf-out comment="" disabled=no invert-match=no \
    prefix=192.168.84.0/23
add action=discard chain=ospf-out comment="" disabled=no invert-match=no

Let's look to the routing table of R0 again:

[admin@R0] > /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-STATE GATEWAY               DISTANCE INTERFACE
 0 A SB 192.168.84.0/23                                                        254
 1 A SB 192.168.84.0/24                                                        1
 2 ADC  192.168.85.0/24    192.168.85.1                                        0        loopback0
 3 ADC  192.168.88.0/25    192.168.88.2                                        0        ether1
 4 ADC  192.168.88.128/25  192.168.88.129                                      0        ether2
 5 ADo  192.168.89.0/24                   reachable     192.168.88.3          110      ether1

Notice that route number 0 added.

R1

R1 is Area Border Router. Here we can make inter-area summarization. Inter-area summarization is done via area ranges. 192.168.88.0/25 and 192.168.88.128/25 is combined to 192.168.88.0/24. Network 192.168.89.64/26 is aggregated to 192.168.89.0/24 (f.e. for future use). 192.168.88.0/24 is represents

/routing ospf area range
add advertise=yes area=backbone cost=default disabled=no range=192.168.88.0/24
add advertise=yes area=area1 cost=default disabled=no range=192.168.89.0/24

Let's look to the routing table after aggregation and summarization:

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-STATE GATEWAY               DISTANCE INTERFACE
 0 ADo  192.168.84.0/23                    reachable     192.168.88.2          110      ether1
 1 ADC  192.168.88.0/25    192.168.88.3                                        0        ether1
 2 ADo  192.168.88.128/25                  reachable     192.168.88.2          110      ether1
 3 ADoU 192.168.89.0/24                                                        110
 4 ADC  192.168.89.64/26   192.168.89.66                                       0        ether2

Notice that route number 3 for 192.168.89.0/24 is presented as unreachable.

R2

New routing table on router R2 will look as follows:

    192.168.89.0/26 is subnetted, 2 subnets
C       192.168.89.0 is directly connected, Ethernet0/1
C       192.168.89.64 is directly connected, Ethernet0/0
O IA 192.168.88.0/24 [110/30] via 192.168.89.66, 00:00:02, Ethernet0/0
O E1 192.168.84.0/23 [110/40] via 192.168.89.66, 00:00:02, Ethernet0/0

Area 1 in stub configuration

Finally let's configure area1 as stub area. For this purpose we will configure area type as stub on both R1 and R2. In other case routers will have not to agree the Stub Area Flag and will not form adjacency (like then authentication parameters did not match).


R1

/routing ospf area
add area-id=0.0.0.1 authentication=none disabled=no name=area1 type=stub

R2

router ospf 1
 area 1 stub
 network 192.168.89.64 0.0.0.63 area 1


Routing from stub area is made via default route:

     192.168.89.0/26 is subnetted, 2 subnets
C       192.168.89.0 is directly connected, Ethernet0/1
C       192.168.89.64 is directly connected, Ethernet0/0
O*IA 0.0.0.0/0 [110/11] via 192.168.89.66, 00:06:33, Ethernet0/0

--shados 11:07, 17 June 2009 (EEST)