redistribute match and route-map

TASK

redistribute ~ matchで再配送している経路に対して、さらにroute-mapで取捨選択したい

DIAGRAM

CONFIG

hostname R1
!
interface Loopback0
 ip address 10.0.0.1 255.255.255.255
!
interface FastEthernet0/0
 no ip address
 shutdown
!
interface FastEthernet0/1
 ip address 10.1.2.1 255.255.255.0
 no shutdown
!
router bgp 65001
 bgp router-id 10.0.0.1
 neighbor 10.1.2.2 remote-as 65002
!
end
hostname R2
!
interface Loopback0
 ip address 10.0.0.2 255.255.255.255
 ip ospf 65002 area 0
!
interface FastEthernet0/0
 ip address 10.1.2.2 255.255.255.0
 no shutdown
!
interface FastEthernet0/1
 ip address 10.2.3.2 255.255.255.0
 ip ospf 65002 area 0
 no shutdown
!
router ospf 65002
 router-id 10.0.0.2
!
router bgp 65002
 bgp router-id 10.0.0.2
 redistribute ospf 65002 match internal external 1
 neighbor 10.1.2.1 remote-as 65001
!
end
hostname R3
!
interface Loopback0
 ip address 10.0.0.3 255.255.255.255
 ip ospf 65002 area 0
!
interface Loopback1
 ip address 192.168.1.3 255.255.255.0
!
interface Loopback2
 ip address 192.168.2.3 255.255.255.0
!
interface Loopback3
 ip address 192.168.3.3 255.255.255.0
!
interface Loopback4
 ip address 192.168.4.3 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.2.3.3 255.255.255.0
 ip ospf 65002 area 0
 no shutdown
!
interface FastEthernet0/1
 no ip address
 shutdown
!
router ospf 65002
 router-id 10.0.0.3
 redistribute connected subnets route-map CON-INTO-OSPF
!
route-map CON-INTO-OSPF permit 10
 match interface Loopback1 Loopback3
 set metric-type type-1
!
route-map CON-INTO-OSPF permit 20
 match interface Loopback2 Loopback4
 set metric-type type-2
!
end

VERIFY

この時点ではR1にはinternal と type 1だけ再配送

R2#sh ip ro os | b Gate
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O        10.0.0.3/32 [110/2] via 10.2.3.3, 00:06:10, FastEthernet0/1
O E1  192.168.1.0/24 [110/21] via 10.2.3.3, 00:06:10, FastEthernet0/1
O E2  192.168.2.0/24 [110/20] via 10.2.3.3, 00:01:27, FastEthernet0/1
O E1  192.168.3.0/24 [110/21] via 10.2.3.3, 00:06:10, FastEthernet0/1
O E2  192.168.4.0/24 [110/20] via 10.2.3.3, 00:01:27, FastEthernet0/1
R2#
R2#sh ip bgp nei 10.1.2.1 adv | b Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.0.0.2/32      0.0.0.0                  0         32768 ?
 *>  10.0.0.3/32      10.2.3.3                 2         32768 ?
 *>  10.2.3.0/24      0.0.0.0                  0         32768 ?
 *>  192.168.1.0      10.2.3.3                21         32768 ?
 *>  192.168.3.0      10.2.3.3                21         32768 ?

Total number of prefixes 5

R1#sh ip bgp nei 10.1.2.2 route | b Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.0.0.2/32      10.1.2.2                 0             0 65002 ?
 *>  10.0.0.3/32      10.1.2.2                 2             0 65002 ?
 *>  10.2.3.0/24      10.1.2.2                 0             0 65002 ?
 *>  192.168.1.0      10.1.2.2                21             0 65002 ?
 *>  192.168.3.0      10.1.2.2                21             0 65002 ?

Total number of prefixes 5

ここでroute-map を使い、192.168.1.0/24以外の4つだけ広報したい

R2(config)#ip prefix TEST-PREFIX s 10 deny 192.168.1.0/24
R2(config)#ip prefix TEST-PREFIX s 1000 permit 0.0.0.0/0 le 32
R2(config)#
R2(config)#route-map TEST-MAP
R2(config-route-map)# match ip add prefix TEST-PREFIX
R2(config-route-map)#
R2(config-route-map)#router bgp 65002
R2(config-router)# redist os 65002 match int ext 1 route-map TEST-MAP
R2(config-router)#
R2(config-router)#do clear ip bgp * soft
R2(config-router)#
R2#sh ip bgp nei 10.1.2.1 adv | b Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.0.0.2/32      0.0.0.0                  0         32768 ?
 *>  10.0.0.3/32      10.2.3.3                 2         32768 ?
 *>  10.2.3.0/24      0.0.0.0                  0         32768 ?
 *>  192.168.2.0      10.2.3.3                20         32768 ?
 *>  192.168.3.0      10.2.3.3                21         32768 ?
 *>  192.168.4.0      10.2.3.3                20         32768 ?

Total number of prefixes 6
R2#

R1#sh ip bgp nei 10.1.2.2 route | b Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.0.0.2/32      10.1.2.2                 0             0 65002 ?
 *>  10.0.0.3/32      10.1.2.2                 2             0 65002 ?
 *>  10.2.3.0/24      10.1.2.2                 0             0 65002 ?
 *>  192.168.2.0      10.1.2.2                20             0 65002 ?
 *>  192.168.3.0      10.1.2.2                21             0 65002 ?
 *>  192.168.4.0      10.1.2.2                20             0 65002 ?

Total number of prefixes 6
R1#

残念ながらroute-map 併用するとその条件に従い、match は無視されるらしい(併用された状態?)

コメント