实验目的
1、掌握使用Route-Map过滤BGP的路由。
实验拓扑
接口ip配置与bgp基础配置详见:
CSDNhttps://mp.csdn.net/mp_blog/creation/editor/125210020查看R3的路由表:
R3#show ip route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 4 subnets
B 1.1.0.0 [20/0] via 23.23.23.2, 00:00:01
B 1.1.1.0 [20/0] via 23.23.23.2, 00:00:01
B 1.1.2.0 [20/0] via 23.23.23.2, 00:04:53
B 1.1.3.0 [20/0] via 23.23.23.2, 00:04:53
23.0.0.0/24 is subnetted, 1 subnets
C 23.23.23.0 is directly connected, FastEthernet0/1
12.0.0.0/24 is subnetted, 1 subnets
B 12.12.12.0 [20/0] via 23.23.23.2, 00:04:53
在R2上配置Route-map路由过滤:
R2(config)#access-list 1 deny 1.1.0.0 0.0.0.255
R2(config)#access-list 1 deny 1.1.1.0 0.0.0.255
R2(config)#access-list 1 permit any
R2(config)#route-map bgpfilter permit 10
R2(config-route-map)#match ip address 1
R2(config)#router bgp 12
R2(config-router)#neighbor 23.23.23.3 route-map bgpfilter out
查看R3的路由表,确认路由过滤的配置:
R3#show ip route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 2 subnets
B 1.1.2.0 [20/0] via 23.23.23.2, 00:07:33
B 1.1.3.0 [20/0] via 23.23.23.2, 00:07:33
23.0.0.0/24 is subnetted, 1 subnets
C 23.23.23.0 is directly connected, FastEthernet0/1
12.0.0.0/24 is subnetted, 1 subnets
B 12.12.12.0 [20/0] via 23.23.23.2, 00:07:33