Example: Configuring Access Lists to Filter Routes Advertised to a BGP Device
This example explains how to use an access list to filter routes advertised to a BGP device.
Requirements
This example uses the following software and hardware components:
- JunosE Release 7.1.0 or higher-numbered releases
- E Series router (ERX7xx models, ERX14xx models, the ERX310 router, the E120 router, or the E320 router)
- ASIC-based line modules that support Fast Ethernet or Gigabit Ethernet
Overview
Consider the network structure in Figure 2. In this network, you can configure the router Boston to apply the access list reject1 for routes inbound from the router Sanjose. This access list rejects routes matching 172.24.160.0/19.
Figure 2: Filtering with Access Lists

Configuration
Step-by-Step Procedure
The following example demonstrates about configuring the router Boston to apply the access list reject1 for routes inbound from the router Sanjose.
To apply the access list reject1 for routes inbound from the router Sanjose:
- Configure the BGP routing process.host1(config)#router bgp 17
- Add an entry to the BGP neighbor table.host1(config-router)#neighbor 10.5.5.4 remote-as 873
- Distribute the BGP neighbor information as specified in
the access list.host1(config-router)#neighbor 10.5.5.4 distribute-list reject1 in host1(config-router)#exit
- Define a standard or extended IP access list.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