Routes Redistribution with Prefix Lists from OSPF to RIP

sacredboysacredboy Posts: 303Member ■■■□□□□□□□
Hello guys.

In the attachment there is a topology with RIP on the one side and OSPF on another side.

When I'm trying to redistribute routes from RIP to OSPF using prefix lists it works fine.
R2(config)#ip prefix-list [I]RIP_OSPF[/I] permit 172.16.0.0/16 le 24
R2(config)#route-map [I]RIP_OSPF[/I] permit 10
R2(config-route-map)#match ip address prefix-list [I]RIP_OSPF[/I]
R2(config-route-map)#exit
R2(config)#router ospf 1
R2(config-router)#redistribute rip metric 100 subnets route-map [I]RIP_OSPF[/I]
However, when I'm trying to use prefix list to redistribute routes from OSPF to RIP using prefix lists it doesn't work.
R2(config)#ip prefix-list [I]OSPF_RIP[/I] permit 192.168.0.0/16 le 24
R2(config)#route-map [I]OSPF_RIP[/I] permit 10
R2(config-route-map)#match ip address prefix-list [I]OSPF_RIP[/I]
R2(config-route-map)#exit
R2(config)#router ospf 1
R2(config-router)#redistribute ospf 1 metric 2 route-map [I]OSPF_RIP[/I]
Why prefix lists work for redistribution from RIP to OSPF but doesn't for redistribution from OSPF to RIP.

Just for any case below are full configs from all three routers.
R1#sh run
interface Loopback0
 ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
 ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
 ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
 ip address 172.16.3.1 255.255.255.128
!
interface Loopback4
 ip address 172.16.3.129 255.255.255.128
!
interface Loopback5
 ip address 172.16.4.1 255.255.255.128
!
interface Loopback6
 ip address 172.16.4.129 255.255.255.128
!
interface Serial1/0
 ip address 10.1.12.1 255.255.255.252
R2#sh run
!
interface Serial1/0
 ip address 10.1.12.2 255.255.255.252
!
interface Serial1/1
 ip address 10.1.23.1 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 redistribute rip metric 100 metric-type 1 subnets route-map RIP_OSPF
 network 10.1.23.0 0.0.0.3 area 0
!
router rip
 version 2
 redistribute ospf 1 metric 2 route-map OSPF_RIP
 network 10.0.0.0
 no auto-summary
!
ip prefix-list OSPF_RIP seq 5 permit 192.168.0.0/16 le 24
!
ip prefix-list RIP_OSPF seq 5 permit 172.16.0.0/16 le 24
!
route-map OPSF_RIP permit 10
 match ip address prefix-list OSPF_RIP
!
route-map RIP_OSPF permit 10
 match ip address prefix-list RIP_OSPF
R3#sh run
!         
interface Loopback0
 ip address 192.168.0.1 255.255.255.0
 ip ospf network point-to-point
!
interface Loopback1
 ip address 192.168.1.1 255.255.255.0
 ip ospf network point-to-point
!
interface Loopback2
 ip address 192.168.2.1 255.255.255.0
 ip ospf network point-to-point
!
interface Loopback3
 ip address 192.168.3.1 255.255.255.128
 ip ospf network point-to-point
!
interface Loopback4
 ip address 192.168.3.129 255.255.255.128
 ip ospf network point-to-point
!
interface Loopback5
 ip address 192.168.4.1 255.255.255.128
 ip ospf network point-to-point
!
interface Loopback6
 ip address 192.168.4.129 255.255.255.128
 ip ospf network point-to-point
!
interface Serial1/1
 ip address 10.1.23.2 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 0.0.0.0 255.255.255.255 area 0
Best, sacredboy!

Comments

  • d4nz1gd4nz1g Posts: 464Member
    R2(config-router)#redistribute ospf 1 metric 2 route-map OSPF_RIP


    You mean RIP, right?
  • sacredboysacredboy Posts: 303Member ■■■□□□□□□□
    Yes. From RIP to OSPF prefix lists work well, but doesn't work in opposite direction from OSPF to RIP.
    Best, sacredboy!
  • HeeroHeero Posts: 486Member
    That is because you are trying to redistribute OSPF in to OSPF, not OSPF into RIP.
  • sacredboysacredboy Posts: 303Member ■■■□□□□□□□
    Heero, thank you.
    Best, sacredboy!
  • sacredboysacredboy Posts: 303Member ■■■□□□□□□□
    Hello guys.

    Another one question about routes redistribution but with the other topology. Below the configs from all 6 routers:
    R1#sh run
    !
    router ospf 1
     router-id 1.1.1.1
     log-adjacency-changes
     redistribute rip metric 10 metric-type 1 subnets route-map RIP_TO_OSPF
     network 10.1.12.1 0.0.0.0 area 0
     network 10.1.13.1 0.0.0.0 area 0
    !
    router rip
     version 2
     redistribute ospf 1 metric 5 route-map OSPF_TO_RIP
     network 10.0.0.0
     network 172.16.0.0
     no auto-summary
    !
    ip prefix-list OSPF_TO_RIP seq 5 permit 192.168.0.0/16 ge 24
    ip prefix-list OSPF_TO_RIP seq 10 permit 10.1.12.0/30
    ip prefix-list OSPF_TO_RIP seq 15 permit 10.1.13.0/30
    ip prefix-list OSPF_TO_RIP seq 20 permit 10.1.24.0/30
    ip prefix-list OSPF_TO_RIP seq 25 permit 10.1.34.0/30
    !
    ip prefix-list RIP_TO_OSPF seq 5 permit 172.16.0.0/16 ge 24
    ip prefix-list RIP_TO_OSPF seq 10 permit 10.1.15.0/30
    ip prefix-list RIP_TO_OSPF seq 15 permit 10.1.26.0/30
    ip prefix-list RIP_TO_OSPF seq 20 permit 10.1.56.0/30
    !
    route-map OSPF_TO_RIP permit 10
     match ip address prefix-list OSPF_TO_RIP
    !
    route-map RIP_TO_OSPF permit 10
     match ip address prefix-list RIP_TO_OSPF
    
    R2#sh run
    !
    router ospf 1
     router-id 2.2.2.2
     log-adjacency-changes
     redistribute rip metric 10 metric-type 1 subnets route-map RIP_TO_OSPF
     network 10.1.12.2 0.0.0.0 area 0
     network 10.1.24.1 0.0.0.0 area 0
    !
    router rip
     version 2
     redistribute ospf 1 metric 5 route-map OSPF_TO_RIP
     network 10.0.0.0
     network 172.16.0.0
     no auto-summary
    !
    ip prefix-list OSPF_TO_RIP seq 5 permit 192.168.0.0/16 ge 24
    ip prefix-list OSPF_TO_RIP seq 10 permit 10.1.12.0/30
    ip prefix-list OSPF_TO_RIP seq 15 permit 10.1.13.0/30
    ip prefix-list OSPF_TO_RIP seq 20 permit 10.1.24.0/30
    ip prefix-list OSPF_TO_RIP seq 25 permit 10.1.34.0/30
    !
    ip prefix-list RIP_TO_OSPF seq 5 permit 172.16.0.0/16 ge 24
    ip prefix-list RIP_TO_OSPF seq 10 permit 10.1.15.0/30
    ip prefix-list RIP_TO_OSPF seq 15 permit 10.1.26.0/30
    ip prefix-list RIP_TO_OSPF seq 20 permit 10.1.56.0/30
    !
    route-map OSPF_TO_RIP permit 10
     match ip address prefix-list OSPF_TO_RIP
    !
    route-map RIP_TO_OSPF permit 10
     match ip address prefix-list RIP_TO_OSPF
    
    R5#sh run
    !
    router rip
     version 2
     network 10.0.0.0
     network 172.16.0.0
     no auto-summary
    
    R6#sh run
    !
    router rip
     version 2
     network 10.0.0.0
     network 172.16.0.0
     no auto-summary
    
    R3#sh run
    !
    router ospf 1
     router-id 3.3.3.3
     log-adjacency-changes
     network 10.1.13.2 0.0.0.0 area 0
     network 10.1.34.1 0.0.0.0 area 0
     network 192.168.3.0 0.0.0.255 area 0
    
    R4#sh run
    !
    router ospf 1
     router-id 4.4.4.4
     log-adjacency-changes
     network 10.1.24.2 0.0.0.0 area 0
     network 10.1.34.2 0.0.0.0 area 0
     network 192.168.4.0 0.0.0.255 area 0
    


    1. Why R2 learns about subnets 10.1.56.0/30, 172.16.5.0/24 and 172.16.6.0/24 via RIP, but R1 learns about the same subnets via OSPF?
    R1#sh ip route ospf
         172.16.0.0/24 is subnetted, 4 subnets
    O E1    172.16.5.0 [110/11] via 10.1.12.2, 00:15:54, FastEthernet0/1
    O E1    172.16.6.0 [110/11] via 10.1.12.2, 00:15:54, FastEthernet0/1
    O E1    10.1.56.0 [110/11] via 10.1.12.2, 00:15:54, FastEthernet0/1
    
    R2#sh ip route rip
         172.16.0.0/24 is subnetted, 4 subnets
    R       172.16.5.0 [120/2] via 10.1.26.2, 00:00:03, FastEthernet0/0
    R       172.16.6.0 [120/1] via 10.1.26.2, 00:00:03, FastEthernet0/0
         10.0.0.0/30 is subnetted, 7 subnets
    R       10.1.56.0 [120/1] via 10.1.26.2, 00:00:03, FastEthernet0/0
    
    2. Why the traceroute on R3 looks like this?
    R3#traceroute 172.16.5.1
    
      1 10.1.34.2 32 msec
        10.1.13.1 12 msec
        10.1.34.2 8 msec
      2 10.1.12.2 8 msec
        10.1.24.1 20 msec
        10.1.12.2 16 msec
      3 10.1.26.2 48 msec 40 msec 40 msec
      4 10.1.56.1 40 msec 40 msec 40 msec
    
    R3#traceroute 172.16.6.1
    
      1 10.1.13.1 32 msec
        10.1.34.2 12 msec
        10.1.13.1 8 msec
      2 10.1.24.1 8 msec
        10.1.12.2 20 msec
        10.1.24.1 16 msec
      3 10.1.26.2 48 msec 40 msec 40 msec
    
    Best, sacredboy!
  • pevangelpevangel Posts: 342Member
    1. R2 learns the routes from R6, installs the routes in it's routing table and redistributes it into OSPF. Those routes are then advertised to R1. R1 has already learned those same routes via RIP from R5. But the AD of OSPF is lower than RIP so it installs the routes from R2 instead.
    2. Looks like you have equal cost path to those destinations and it's load balancing.
Sign In or Register to comment.