配置各路由器的IP地址等基本信息,测试互连可达。
配置基本的BGP协议,关闭自动汇总。
在实验“24. Filtering Routing Updates with a Distribute List”中已经详细解释了如何使用分发列表过滤路由,因此在这里只介绍在BGP中如何用分发列表过滤路由。
查看R3的路由表: R3#show ip route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks B 172.16.255.0/30 [20/0] via 10.1.255.1, 00:02:24 B 172.16.0.0/24 [20/0] via 10.1.255.1, 00:02:24 B 172.16.1.0/24 [20/0] via 10.1.255.1, 00:02:24 B 172.16.2.0/24 [20/0] via 10.1.255.1, 00:02:24 B 172.16.3.0/24 [20/0] via 10.1.255.1, 00:02:24 10.0.0.0/30 is subnetted, 1 subnets C 10.1.255.0 is directly connected, Serial0/0 在R2上配置路由过滤: R2(config)#access 1 deny 172.16.0.0 0.0.0.255 R2(config)#access 1 deny 172.16.1.0 0.0.0.255 --->选定作用范围 R2(config)#access 1 per any --->放行其它所有 R2(config)#router bgp 64512 R2(config-router)#neighbor 10.1.255.2 distribute-list 1 out --->对特定邻居使用出接口的分发列表 R2(config-router)#end R2#clear ip bgp * soft 再查看R3中的路由表: R3#show ip route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks B 172.16.255.0/30 [20/0] via 10.1.255.1, 00:00:09 B 172.16.2.0/24 [20/0] via 10.1.255.1, 00:00:09 B 172.16.3.0/24 [20/0] via 10.1.255.1, 00:00:09 10.0.0.0/30 is subnetted, 1 subnets C 10.1.255.0 is directly connected, Serial0/0 此时R3路由器中的172.16.0.0/24 和 172.16.1.0/24 子网已经被成功的过滤。