The following example demonstrates how to use an access list to filter routes advertised to a BGP device. Consider the network structure in Figure 2.
Figure 2: Filtering with Access Lists

The following commands configure router Boston to apply access list reject1 to routes inbound from router SanJose. Access list reject1 rejects routes matching 172.24.160.0/19.
- host1(config)#router bgp 17
- host1(config-router)#neighbor 10.5.5.4 remote-as
873
- host1(config-router)#neighbor 10.5.5.4 distribute-list
reject1 in
- host1(config-router)#exit
- host1(config)#access-list reject1 permit 172.24.48.0
0.0.255
- host1(config)#access-list reject1 deny 172.24.160.0
0.0.0.255
- host1(config)#access-list reject1 permit 172.24.24.0
0.0.0.255