Related Documentation
- ACX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- M Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- MX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- PTX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- QFX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- T Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
Example: Disabling Suppression of Route Advertisements
Junos OS does not advertise the routes learned from one EBGP peer back to the same external BGP (EBGP) peer. In addition, the software does not advertise those routes back to any EBGP peers that are in the same autonomous system (AS) as the originating peer, regardless of the routing instance. You can modify this behavior by including the advertise-peer-as statement in the configuration.
If you include the advertise-peer-as statement in the configuration, BGP advertises the route regardless of this check.
To restore the default behavior, include the no-advertise-peer-as statement in the configuration:
The route suppression default behavior is disabled if the as-override statement is included in the configuration. If you include both the as-override and no-advertise-peer-as statements in the configuration, the no-advertise-peer-as statement is ignored.
Requirements
No special configuration beyond device initialization is required before you configure this example.
Overview
This example shows three routing devices with external BGP (EBGP) connections. Device R2 has an EBGP connection to Device R1 and another EBGP connection to Device R3. Although separated by Device R2 which is in AS 64511, Device R1 and Device R3 are in the same AS (AS 64512). Device R1 and Device R3 advertise into BGP direct routes to their own loopback interface addresses.
Device R2 receives these loopback interface routes, and the advertise peer-as statement allows Device R2 to advertise them. Specifically, Device R1 sends the 192.168.0.1 route to Device R2, and because Device R2 has the advertise peer-as configured, Device R2 can send the 192.168.0.1 route to Device R3. Likewise, Device R3 sends the 192.168.0.3 route to Device R2, and advertise peer-as enables Device R2 to forward the route to Device R1.
To enable Device R1 and Device R3 to accept routes that contain their own AS number in the AS path, the loops 2 statement is required on Device R1 and Device R3.
Topology
Figure 1 shows the sample network.
Figure 1: BGP Topology for advertise-peer-as

CLI Quick Configuration shows the configuration for all of the devices in Figure 1.
The section Step-by-Step Procedure describes the steps on Device R1 and Device R2.
Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device R1
Device R2
Device R3
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure Device R1:
- Configure the device interfaces.[edit interfaces]user@R1# set fe-1/2/0 unit 0 family inet address 10.0.0.1/30
user@R1# set lo0 unit 0 family inet address 192.168.0.1/32 - Configure BGP.[edit protocols bgp group ext]user@R1# set type externaluser@R1# set peer-as 200user@R1# set neighbor 10.0.0.2
- Prevent routes from Device R3 from being hidden on Device
R1 by including the loops 2 statement.
The loops 2 statement means that the local device’s own AS number can appear in the AS path up to one time without causing the route to be hidden. The route is hidden if the local device’s AS number is detected in the path two or more times.
[edit protocols bgp family inet unicast]user@R1# set loops 2 - Configure the routing policy that sends direct routes.[edit policy-options policy-statement send-direct term 1]user@R1# set from protocol directuser@R1# set then accept
- Apply the export policy to the BGP peering session with
Device R2.[edit protocols bgp group ext]user@R1# set export send-direct
- Configure the autonomous system (AS) number.[edit routing-options ]user@R1# set autonomous-system 300
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure Device R2:
- Configure the device interfaces.[edit interfaces]user@R2# set fe-1/2/0 unit 0 family inet address 10.0.0.2/30
user@R2# set fe-1/2/1 unit 0 family inet address 10.1.0.1/30
user@R2# set lo0 unit 0 family inet address 192.168.0.2/32 - Configure BGP.[edit protocols bgp group ext]user@R2# set type externaluser@R2# set neighbor 10.0.0.1 peer-as 300user@R2# set neighbor 10.1.0.2 peer-as 300
- Configure Device R2 to advertise routes learned from one
EBGP peer to another EBGP peer in the same AS.
In other words, advertise to Device R1 routes learned from Device R3 (and the reverse), even though Device R1 and Device R3 are in the same AS.
[edit protocols bgp group ext]user@R2# set advertise-peer-as - Configure a routing policy that sends direct routes.[edit policy-options policy-statement send-direct term 1]user@R2# set from protocol directuser@R2# set then accept
- Apply the export policy.[edit protocols bgp group ext]user@R2# set export send-direct
- Configure the AS number.[edit routing-options]user@R2# set autonomous-system 200
Results
From configuration mode, confirm your configuration by entering the show interfaces, show protocols, show policy-options, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Device R1
Device R2
If you are done configuring the devices, enter commit from configuration mode.
Verification
Confirm that the configuration is working properly.
Verifying the BGP Routes
Purpose
Make sure that the routing tables on Device R1 and Device R3 contain the expected routes.
Action
- On Device R2, deactivate the advertise-peer-as statement in the BGP configuration.[edit protocols bgp group ext]user@R2# deactivate advertise-peer-asuser@R2# commit
- On Device R3, deactivate the loops statement
in the BGP configuration.[edit protocols bgp family inet unicast ]user@R3# deactivate unicast loops user@R3# commit
- On Device R1, check to see what routes are advertised
to Device R2.
user@R1> show route advertising-protocol bgp 10.0.0.2inet.0: 5 destinations, 6 routes (5 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self I * 192.168.0.1/32 Self I
- On Device R2, check to see what routes are received from
Device R1.
user@R2> show route receive-protocol bgp 10.0.0.1inet.0: 7 destinations, 9 routes (7 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path 10.0.0.0/30 10.0.0.1 300 I * 192.168.0.1/32 10.0.0.1 300 I
- On Device R2, check to see what routes are advertised
to Device R3.
user@R2> show route advertising-protocol bgp 10.1.0.2inet.0: 7 destinations, 9 routes (7 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self I * 10.1.0.0/30 Self I * 192.168.0.2/32 Self I
- On Device R2, activate the advertise-peer-as statement in the BGP configuration.[edit protocols bgp group ext]user@R2# activate advertise-peer-asuser@R2# commit
- On Device R2, recheck the routes that are advertised to
Device R3.
user@R2> show route advertising-protocol bgp 10.1.0.2inet.0: 7 destinations, 9 routes (7 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self I * 10.1.0.0/30 Self I * 192.168.0.1/32 Self 300 I * 192.168.0.2/32 Self I * 192.168.0.3/32 10.1.0.2 300 I
- On Device R3, check the routes that are received from
Device R2.
user@R3> show route receive-protocol bgp 10.1.0.1inet.0: 5 destinations, 6 routes (5 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 10.1.0.1 200 I 10.1.0.0/30 10.1.0.1 200 I * 192.168.0.2/32 10.1.0.1 200 I
- On Device R3, activate the loops statement
in the BGP configuration.[edit protocols bgp family inet unicast ]user@R3# activate unicast loops user@R3# commit
- On Device R3, recheck the routes that are received from
Device R2.
user@R3> show route receive-protocol bgp 10.1.0.1inet.0: 6 destinations, 8 routes (6 active, 0 holddown, 1 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 10.1.0.1 200 I 10.1.0.0/30 10.1.0.1 200 I * 192.168.0.1/32 10.1.0.1 200 300 I * 192.168.0.2/32 10.1.0.1 200 I
Meaning
First the advertise-peer-as statement and the loops statement are deactivated so that the default behavior can be examined. Device R1 sends to Device R2 a route to Device R1’s loopback interface address, 192.168.0.1/32. Device R2 does not advertise this route to Device R3. After activating the advertise-peer-as statement, Device R2 does advertise the 192.168.0.1/32 route to Device R3. Device R3 does not accept this route until after the loops statement is activated.
Related Documentation
- ACX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- M Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- MX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- PTX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- QFX Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override
- T Series
- Example: Configuring a Layer 3 VPN with Route Reflection and AS Override