Tuesday, 24 May 2011

Redistribute command. From OSPF into EIGRP/BGP.

Do you know, which routes are redistributed by default? For instance, when redistributing from OSPF into EIGRP, you have 3 different routes: inter-area, intra-area and external. Let's find the answer:



On the picture above (click to enlarge) there is a simple topology, where a distribution between different routing protocol is applied. R1 is performing a mutual distribution between OSPF and BGP, R2 between EIGRP and OSPF. R4 is an OSPF ABR router between area 0 and 1. First, let's take a look into R1 routing table:

R1#show ip route
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
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O E2 102.0.0.0/8 [110/20] via 10.0.0.1, 00:10:48, Serial0/0
     100.0.0.0/24 is subnetted, 1 subnets
B       100.0.0.0 [200/0] via 14.0.0.2, 00:09:04
     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, Serial0/0
     11.0.0.0/30 is subnetted, 1 subnets
O       11.0.0.0 [110/128] via 10.0.0.1, 00:12:34, Serial0/0
     12.0.0.0/30 is subnetted, 1 subnets
O       12.0.0.0 [110/128] via 10.0.0.1, 00:23:09, Serial0/0
     13.0.0.0/30 is subnetted, 1 subnets
O IA    13.0.0.0 [110/192] via 10.0.0.1, 00:23:09, Serial0/0
     14.0.0.0/30 is subnetted, 1 subnets
C       14.0.0.0 is directly connected, Serial0/1
     15.0.0.0/30 is subnetted, 1 subnets
O E2    15.0.0.0 [110/20] via 10.0.0.1, 00:11:40, Serial0/0


Please be advised, that R1 learnt 3 different OSPF routes:
  • intra-area (O): 11.0.0.0/30, 12.0.0.0/30
  • inter-area (IA): 13.0.0.0/30
  • external (E2): 15.0.0.0/30, 102.0.0.0/24
Next, OSPF routes are redistributed into BGP using default settings:

R1#show running-config | section bgp
 router bgp 65000
 no synchronization
 bgp log-neighbor-changes
 redistribute ospf 1
 neighbor 14.0.0.2 remote-as 65000
 no auto-summary


Finally, the routing table derived from R6:

R6#show ip route
!some lines omitted

     100.0.0.0/24 is subnetted, 1 subnets
C       100.0.0.0 is directly connected, Loopback0
     10.0.0.0/30 is subnetted, 1 subnets
B       10.0.0.0 [200/0] via 14.0.0.1, 00:24:42
     11.0.0.0/30 is subnetted, 1 subnets
B       11.0.0.0 [200/128] via 10.0.0.1, 00:24:42
     12.0.0.0/30 is subnetted, 1 subnets
B       12.0.0.0 [200/128] via 10.0.0.1, 00:24:42
     13.0.0.0/30 is subnetted, 1 subnets
B       13.0.0.0 [200/192] via 10.0.0.1, 00:24:42
     14.0.0.0/30 is subnetted, 1 subnets
C       14.0.0.0 is directly connected, Serial0/0
R6#


We can see, that only intra-area and inter-area routes are redistributed with default settings. External routes are ignored, to change this, we can add match external {1|2} to redistribute ospf command.
The same story is with R7, only inter-area and intra-area routes are redistributed from OSPF into EIGRP:

R7#show ip route
!some lines omitted

     102.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       102.0.0.0/24 is directly connected, Loopback0
D       102.0.0.0/8 is a summary, 00:26:25, Null0
     10.0.0.0/30 is subnetted, 1 subnets
D EX    10.0.0.0 [170/2474496] via 15.0.0.1, 00:26:25, Serial0/0
     11.0.0.0/30 is subnetted, 1 subnets
D EX    11.0.0.0 [170/2474496] via 15.0.0.1, 00:26:25, Serial0/0
     12.0.0.0/30 is subnetted, 1 subnets
D EX    12.0.0.0 [170/2474496] via 15.0.0.1, 00:26:25, Serial0/0
     13.0.0.0/30 is subnetted, 1 subnets
D EX    13.0.0.0 [170/2474496] via 15.0.0.1, 00:26:25, Serial0/0
     15.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       15.0.0.0/30 is directly connected, Serial0/0
D       15.0.0.0/8 is a summary, 00:26:26, Null0
R7#