使用 EIGRP 中的“匹配接口”控制路由映射分布

网络工程 路由 思科-ios eigrp
2021-07-29 18:15:16

我有一个“Tun0”接口,我在上面讲 EIGRP。在同一台路由器上,我有一个“Vlan1”接口。我想要做的只是谈论通过路由映射的接口,例如

route-map foo permit 10
  match interface Vlan1
router eigrp 100
  distribute-list route-map foo out
  eigrp stub connected summary

但是,这不起作用。调试显示“Vlan1”被路由映射拒绝,而不是被它允许。相关前缀上的“sh ip eigrp top”表明该路由的下一跳是 0.0.0.0。无论是否使用 EIGRP 存根处理,行为似乎都相同,并且在这种情况下需要其他存根处理功能。

如何在 EIGRP 中仅包含源自此接口的路由?

1个回答

如果您只想在选定的接口上启用 eigrp,您可以使用被动接口功能,如果您想重新分配路由,您可以使用leakmap(和/或重新分配),a-la:

router eigrp 10050
 network 10.192.0.0 0.0.255.255
 redistribute static route-map rmap_leak_to_10050 
 passive-interface default
 no passive-interface Vlan816
 no passive-interface Vlan916
 eigrp router-id 10.192.127.218
 eigrp stub connected static leak-map rmap_leak_to_10050

 ip access-list standard leak_to_10050
 permit 10.192.0.0 0.0.255.255
 permit 192.168.0.0 0.0.255.255
 permit 10.10.10.0 0.0.0.255

 route-map rmap_leak_to_10050 permit 10
 match ip address leak_to_10050

添加:

 router eigrp 123
 redistribute connected route-map rm_connected

route-map rm_connected permit 10
 match interface g0/0.123 g0/0.321 g0/0.231

添加:

cisco3750x: Cisco IOS Software, C3750E Software (C3750E-UNIVERSALK9NPE-M), Version 15.0(2)SE, RELEASE SOFTWARE (fc1)

sw1
interface Loopback100
 ip address 172.16.10.1 255.255.255.0

interface GigabitEthernet1/0/48
 switchport access vlan 100
 switchport mode access

interface Vlan100
 ip address 10.0.0.1 255.255.255.252

router eigrp 100
 network 10.0.0.0
 redistribute connected route-map rm_con
 eigrp stub connected summary

route-map rm_con permit 10
 match interface Loopback100


sw2
interface Loopback100
 ip address 172.16.20.1 255.255.255.0
!
interface GigabitEthernet1/0/48
 switchport access vlan 100
 switchport mode access

interface Vlan100
 ip address 10.0.0.2 255.255.255.252

router eigrp 100
 network 10.0.0.0
 redistribute connected route-map rm_con
 eigrp stub connected summary

route-map rm_con permit 10
 match interface Loopback100

sh ip route on sw1:
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, Vlan100
L        10.0.0.2/32 is directly connected, Vlan100
      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
C        172.16.10.0/24 is directly connected, Loopback100
L        172.16.10.1/32 is directly connected, Loopback100
D EX     172.16.20.0/24 [170/130816] via 10.0.0.1, 00:02:31, Vlan100

sh ip route on sw2:
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, Vlan100
L        10.0.0.1/32 is directly connected, Vlan100
      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
D EX     172.16.10.0/24 [170/130816] via 10.0.0.2, 00:02:52, Vlan100
C        172.16.20.0/24 is directly connected, Loopback100
L        172.16.20.1/32 is directly connected, Loopback100

添加(sw1 配置相同,只更改了 sw2):

sw2 config:

interface Loopback100
 ip address 172.16.20.1 255.255.255.0
!
interface GigabitEthernet1/0/48
 switchport access vlan 100
 switchport mode access
!
interface Vlan1
 ip address 172.16.200.1 255.255.255.0
!
interface Vlan100
 ip address 10.0.0.2 255.255.255.252
!
router eigrp 100
 network 10.0.0.0
 redistribute connected route-map rm_con
 eigrp stub connected summary
!
route-map rm_con permit 10
 match interface Loopback100 Vlan1

sw2:
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, Vlan100
L        10.0.0.2/32 is directly connected, Vlan100
      172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C        172.16.20.0/24 is directly connected, Loopback100
L        172.16.20.1/32 is directly connected, Loopback100
D EX     172.16.10.0/24 [170/130816] via 10.0.0.1, 00:05:44, Vlan100
C        172.16.200.0/24 is directly connected, Vlan1
L        172.16.200.1/32 is directly connected, Vlan1



sw1:
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, Vlan100
L        10.0.0.1/32 is directly connected, Vlan100
      172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
D EX     172.16.20.0/24 [170/130816] via 10.0.0.2, 00:06:09, Vlan100
C        172.16.10.0/24 is directly connected, Loopback100
L        172.16.10.1/32 is directly connected, Loopback100
D EX     172.16.200.0/24 [170/3072] via 10.0.0.2, 00:04:29, Vlan100