Redistribution into OSPF

ccnp-routing
Redistribute connected and EIGRP routes into OSPF, compare E1 and E2 external routes, set default metrics, and verify with LSA and route table output.
Published

Dec 10, 2017

Redistributing Connected Routes

  • Provides an alternative to the network keyword but there are some significant differences:
    • When you use network keyword:
      • OSPF generates type-1 and type-2 LSAs
      • Shows up as O or O IA routes
      • Enables OSPF on the interface
    • When you redistribute connected routes
      • Generates external route (Type-5 or Type-7 LSA)
      • Shows up as O E1 or O E2 routes
      • Does not enable OSPF on the interface

Configuration Example

ospf_r_con
R1
R1#show run | s ospf
router ospf 1
 network 10.10.1.1 0.0.0.0 area 0
ASBR
ASBR(config)#router ospf 1
ASBR(config-router)#network 10.10.1.2 0.0.0.0 area 0
ASBR(config-router)#redistribute connected subnets
  • subnets means redistribute classless subnets, otherwise the router only redistributes classful subnets

Verification on R1

R1#show ip route ospf
       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

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
O E2     1.1.1.0/30 [110/20] via 10.10.1.2, 00:03:06, GigabitEthernet0/0
O E2     1.1.2.0/24 [110/20] via 10.10.1.2, 00:03:06, GigabitEthernet0/0
O E2     1.3.0.0/16 [110/20] via 10.10.1.2, 00:03:06, GigabitEthernet0/0
R1#show ip ospf database

            OSPF Router with ID (10.10.1.1) (Process ID 1)

        Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.3.0.1         1.3.0.1         471         0x80000003 0x0045B2 1
10.10.1.1       10.10.1.1       470         0x80000002 0x00CD0C 1

        Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.10.1.1       10.10.1.1       470         0x80000001 0x00649D

        Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
1.1.1.0         1.3.0.1         483         0x80000001 0x008A11 0
1.1.2.0         1.3.0.1         483         0x80000001 0x009106 0
1.3.0.0         1.3.0.1         483         0x80000001 0x008F08 0

\(\mathrm{LSID}_{\text{Type-5}}\) = External Network Number. Let us open one of the AS External LSAs

R1#show ip ospf database external 1.1.1.0

            OSPF Router with ID (10.10.1.1) (Process ID 1)

        Type-5 AS External Link States

  LS age: 605
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.0 (External Network Number )
  Advertising Router: 1.3.0.1
  LS Seq Number: 80000001
  Checksum: 0x8A11
  Length: 36
  Network Mask: /30
    Metric Type: 2 (Larger than any link state path)
    MTID: 0
    Metric: 20
    Forward Address: 0.0.0.0
    External Route Tag: 0
If we were asked to summarize on ASBR those networks to 1.0.0.0/8:
ASBR(config-router)#summary-address 1.0.0.0 255.0.0.0
R1#show ip route ospf
Gateway of last resort is not set

O E2  1.0.0.0/8 [110/20] via 10.10.1.2, 00:01:51, GigabitEthernet0/0

Redistributing EIGRP into OSPF

  • Default metrics for redistributed routes are:
    • From BGP: Metric = 1
    • From other OSPF: The metric will be equal to the metric of the source OSPF
    • All other sources: Metric = 20
      • We can change it by subcommand RD2(config-router)#default-metric 10
  • redistribute protocol [ process-id | as-number ] [ metric bw delay reliability load mtu ] [ match { internal | nssa-external | external 1 | external 2 }] [ tag tag-value ][ route-map name ]
  • By default, the OSPF redistribute command creates Type 2 routes
    • E2: The OSPF routers do not add any internal OSPF cost to the metric for an E2 route
    • E1: OSPF routers calculate the metrics of E1 routes by adding the internal cost to reach the ASBR to the external cost defined on the redistributing ASBR

image

Basic Configuration

BR1
hostname BR1
!
interface GigabitEthernet0/0
 ip address 10.10.10.1 255.255.255.0
!
router ospf 2
 network 10.10.10.1 0.0.0.0 area 0
BR2
hostname BR2
!
interface GigabitEthernet0/0
 ip address 10.10.20.1 255.255.255.0
!
router eigrp BR2
 !
 address-family ipv4 unicast autonomous-system 1
  !
  topology base
  exit-af-topology
  network 10.10.20.1 0.0.0.0
 exit-address-family
!
RD1
hostname RD1
!
interface GigabitEthernet0/0
 ip address 10.10.10.2 255.255.255.0
!
interface GigabitEthernet0/1
 ip address 172.16.1.1 255.255.255.0
 speed 10
!
router ospf 1
 network 172.16.1.1 0.0.0.0 area 0
!
router ospf 2
 network 10.10.10.2 0.0.0.0 area 0
RD2
hostname RD2
!
interface GigabitEthernet0/0
 ip address 10.10.20.2 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 172.31.1.1 255.255.255.0
!
router eigrp RD2
 !
 address-family ipv4 unicast autonomous-system 1
  !
  topology base
  exit-af-topology
  network 10.10.20.2 0.0.0.0
 exit-address-family
!
router ospf 1
 network 172.31.1.1 0.0.0.0 area 0
HQ
hostname HQ
!
interface GigabitEthernet0/0
 ip address 172.16.1.2 255.255.255.0
 speed 10
!
interface GigabitEthernet0/1
 ip address 172.31.1.2 255.255.255.0
!
router ospf 1
 network 172.16.1.2 0.0.0.0 area 0
 network 172.31.1.2 0.0.0.0 area 0
HQ#show ip route
Gateway of last resort is not set

      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C        172.16.1.0/24 is directly connected, GigabitEthernet0/0
L        172.16.1.2/32 is directly connected, GigabitEthernet0/0
      172.31.0.0/16 is variably subnetted, 2 subnets, 2 masks
C        172.31.1.0/24 is directly connected, GigabitEthernet0/1
L        172.31.1.2/32 is directly connected, GigabitEthernet0/1

Redistribution Configuration

RD1(config-router)#redistribute ospf 2 subnets metric-type 1
RD2(config-router)#sredistribute eigrp 1 subnets metric-type 1
HQ#show ip route ospf
Gateway of last resort is not set

      10.0.0.0/24 is subnetted, 2 subnets
O E1     10.10.10.0 [110/11] via 172.16.1.1, 00:02:18, GigabitEthernet0/0
O E1     10.10.20.0 [110/21] via 172.31.1.1, 00:00:40, GigabitEthernet0/1
HQ#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
172.31.1.1        1   FULL/BDR        00:00:35    172.31.1.1      GigabitEthernet0/1
172.16.1.1        1   FULL/BDR        00:00:38    172.16.1.1      GigabitEthernet0/0
HQ#show ip ospf database external adv-router 172.31.1.1

            OSPF Router with ID (172.31.1.2) (Process ID 1)

        Type-5 AS External Link States

  LS age: 154
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.10.20.0 (External Network Number )
  Advertising Router: 172.31.1.1
  LS Seq Number: 80000001
  Checksum: 0x74B6
  Length: 36
  Network Mask: /24
    Metric Type: 1 (Comparable directly to link state metric)
    MTID: 0
    Metric: 20
    Forward Address: 0.0.0.0
    External Route Tag: 0
HQ#show ip ospf database external adv-router 172.16.1.1

            OSPF Router with ID (172.31.1.2) (Process ID 1)

        Type-5 AS External Link States

  LS age: 318
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.10.10.0 (External Network Number )
  Advertising Router: 172.16.1.1
  LS Seq Number: 80000001
  Checksum: 0x9CBA
  Length: 36
  Network Mask: /24
    Metric Type: 1 (Comparable directly to link state metric)
    MTID: 0
    Metric: 1
    Forward Address: 0.0.0.0
    External Route Tag: 0

We can change the default metric RD2(config-router)#default-metric 10

Let us verify this change
HQ#show ip route ospf
Gateway of last resort is not set

      10.0.0.0/24 is subnetted, 2 subnets
O E1     10.10.10.0 [110/11] via 172.16.1.1, 00:10:19, GigabitEthernet0/0
O E1     10.10.20.0 [110/11] via 172.31.1.1, 00:01:57, GigabitEthernet0/1

Now you can redistribute ospf 1 to ospf 2 and eigrp for mutual reachability

RD1(config)#router ospf 2
RD1(config-router)#redistribute ospf 1 subnets metric-type 1
RD2(config)#router eigrp RD2
RD2(config-router)#address-family ipv4 unicast autonomous-system 1
RD2(config-router-af)#topology base
RD2(config-router-af-topology)#redistribute ospf 1 metric 1000000 20 255 255 255
RD2(config-router-af-topology)#exit-af-topology

Verification: Look at Administrative Distances and Metrics

BR1#show ip route ospf
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E1     10.10.20.0/24 [110/22] via 10.10.10.2, 00:06:03, GigabitEthernet0/0
      172.16.0.0/24 is subnetted, 1 subnets
O E1     172.16.1.0 [110/11] via 10.10.10.2, 00:06:03, GigabitEthernet0/0
      172.31.0.0/24 is subnetted, 1 subnets
O E1     172.31.1.0 [110/12] via 10.10.10.2, 00:06:03, GigabitEthernet0/0
BR2#show ip route eigrp
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
D EX     10.10.10.0/24
           [170/10250240] via 10.10.20.2, 00:04:07, GigabitEthernet0/0
      172.16.0.0/24 is subnetted, 1 subnets
D EX     172.16.1.0
           [170/10250240] via 10.10.20.2, 00:04:07, GigabitEthernet0/0
      172.31.0.0/24 is subnetted, 1 subnets
D EX     172.31.1.0
           [170/10250240] via 10.10.20.2, 00:04:07, GigabitEthernet0/0
For traceroute you can issue the command below to make it faster
HQ(config)#no ip icmp rate-limit unreachable
HQ#traceroute 10.10.10.1
Type escape sequence to abort.
Tracing the route to 10.10.10.1
VRF info: (vrf in name/id, vrf out name/id)
  1 172.16.1.1 7 msec 5 msec 4 msec
  2 10.10.10.1 6 msec 7 msec 8 msec
BR2#show ip eigrp topology 172.16.1.0/24
EIGRP-IPv4 VR(BR2) Topology Entry for AS(1)/ID(10.10.20.1) for 172.16.1.0/24
  State is Passive, Query origin flag is 1, 1 Successor(s), FD is 1312030720, RIB is 10250240
  Descriptor Blocks:
  10.10.20.2 (GigabitEthernet0/0), from 10.10.20.2, Send flag is 0x0
      Composite metric is (1312030720/1311375360), route is External
      Vector metric:
        Minimum bandwidth is 1000000 Kbit
        Total delay is 20010000000 picoseconds
        Reliability is 255/255
        Load is 1/255
        Minimum MTU is 1500
        Hop count is 1
        Originating router is 172.16.1.2
      External data:
        AS number of route is 1
        External protocol is OSPF, external metric is 11
        Administrator tag is 0 (0x00000000)
Back to top