控制路由更新数据流(被动接口和分布列表)
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://gairuhe.blog.51cto.com/77728/43397 |
控制路由更新数据流(被动接口和分布列表)
本实验使用拓扑:
![]() 在R1上建立一个环回口模拟R4
1.为什么要控制路由更新
首先假设我们在上面的拓扑中配置rip协议。在默认情况下,r1将通告以下网络:
A.由于子网
B.若r1和r4是通过dial-on-demand(按需拨号)的ISDN链路相连,那么定期的路由更新会让链路保持在线状态,从而产生高额的费用。
2.通过passive-interface控制路由更新
被动接口可以完全阻止接口发送路由更新。此命令适用于所有的IGP协议。
命令格式:(config-router)#passive-interface type number
实例1:禁止e口上发送路由更新。
![]() *Nov 18 08:14:47.639: subnet
*Nov 18 08:14:47.639: subnet
*Nov 18 08:14:47.891: RIP: sending v1 update to 255.255.255.255 via Serial2/0 (
*Nov 18 08:14:47.891: RIP: build update entries
*Nov 18 08:14:47.891: subnet
*Nov 18 08:14:47.891: subnet
*Nov 18 08:14:47.891: subnet
*Nov 18 08:14:57.079: RIP: sending v1 update to 255.255.255.255 via Loopback1 (
*Nov 18 08:14:57.079: RIP: build update entries
*Nov 18 08:14:57.079: subnet
*Nov 18 08:14:57.079: subnet
*Nov 18 08:14:57.079: subnet
现在输入这个命令:
R1(config)#router rip R1(config-router)#passive-interface ethernet 0/0 R1(config-router)#end 观察debug信息
*Nov 18 08:15:15.507: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (
*Nov 18 08:15:15.507: RIP: build update entries
*Nov 18 08:15:15.507: subnet
*Nov 18 08:15:15.507: subnet
*Nov 18 08:15:15.507: subnet
*Nov 18 08:15:25.967: RIP: sending v1 update to 255.255.255.255 via Loopback1 (
*Nov 18 08:15:25.967: RIP: build update entries
*Nov 18 08:15:25.967: subnet
*Nov 18 08:15:25.967: subnet
*Nov 18 08:15:25.967: subnet
*Nov 18 08:15:41.587: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (
*Nov 18 08:15:41.587: RIP: build update entries
*Nov 18 08:15:41.587: subnet
*Nov 18 08:15:41.587: subnet
*Nov 18 08:15:41.587: subnet
*Nov 18 08:15:41.639: RIP: sending v1 update to 255.255.255.255 via Serial2/0 (
*Nov 18 08:15:41.639: RIP: build update entries
*Nov 18 08:15:41.639: subnet
*Nov 18 08:15:41.639: subnet
*Nov 18 08:15:41.639: subnet
*Nov 18 08:15:55.907: RIP: sending v1 update to 255.255.255.255 via Loopback1 (
*Nov 18 08:15:55.907: RIP: build update entries
*Nov 18 08:15:55.907: subnet
*Nov 18 08:15:55.907: subnet
*Nov 18 08:15:55.907: subnet
此时没有e口的更新。
此命令在不同协议下的工作方式:
RIP:只接受路由更新但是不发送
OSPF:即不发送也不接受
EIGRP和OSPF:不发送hello分组,不能在接口上与其他路由器建立邻居关系。
实例2:在OSPF上运用此命令观察现象。
R1(config)#router ospf 10
R1(config-router)#net
R1(config-router)#net
R1(config-router)#net
R1(config-router)#net
R2(config)#router ospf 10
R2(config-router)#net
R3(config)#router ospf 10
R3(config-router)#net
R1#sho ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
R1#debug ip ospf hell
OSPF hello events debugging is on
R1#
*Nov 18 08:32:18.611: OSPF: Rcv hello from
*Nov 18 08:32:18.611: OSPF: End of hello processing
*Nov 18 08:32:19.659: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from *Nov 18 08:32:20.459: OSPF: Send hello to 224.0.0.5 area 0 on Serial2/0 from
*Nov 18 08:32:31.019: OSPF: Send hello to 224.0.0.5 area 0 on Ethernet0/0 from
在接口s1/0上运行此命令:
R1(config)#router ospf 10 R1(config-router)#passive-interface serial 1/0 R1#sho ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
此时发现
3.用分布控制列表过滤路由更新
分布控制列表只抑制某些特定的路由不被发送或接受。
命令格式:
A.应用于进入路由更新
(config-router)#distribute-list access-list number in {interfacename}
B.应用于出口路由更新
(config-router)#distribute-list access-listnumber out (interface name |routing pro|as-number)
实例3:禁止R2接受有关于网络
R2#sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
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
R
R C
R
R2(config)#access-list 1 deny
R2(config)#access-list 1 permit any
R2(config)#router rip
R2(config-router)#distribute-list 180s后查看路由表:
R2#sh ip rou Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - 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 R R routing vi C R
实例4:利用distribute-list“伪”被动EIGRP OSPF的接口。观察效果。
R1(config)#router eigrp 10 R1(config-router)#net R1(config-router)#net R1(config-router)#net R1(config-router)#net
R2(config)#router eigrp 10 R2(config-router)#net
R3(config)#router eigrp 10 R3(config-router)#net
R2#sho ip rou Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - 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 D D C D
R2#sho ip eigrp nei IP-EIGRP neighbors for process 10 H Address Interface Hold Uptime SRTT RTO Q Seq (sec) (ms) Cnt Num 0
R2(config)#access-list 3 deny any R2(config)#router eigrp 10 R2(config-router)#distribute-list 3 out serial 1/0
在240s后查看路由表
R2#sho ip rou Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 |




