Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


loops (BGP Address Family)


Hierarchy Level


For the specified BGP address family, allow the local device’s AS number in the received AS paths and specify the number of times the detection of the local device’s AS in the AS_PATH attribute is allowed. If the count exceeds the specified loop count, the system discards this route. For example, if you configure loops 1, the route is discarded if the local device's AS number is detected in the path more than once. This prevents routing loops and is the default behavior. If you configure loops 2, the route is discarded if the local device's AS number is detected more than 2 times.

For debugging, you can configure the keep all option If you want to hide this route.

Some examples of BGP address families are as follows:

  • inet unicast

  • inet-vpn multicast

  • inet6 any

  • l2vpn auto-discovery-only

  • ...

This list is truncated for brevity. For a complete list of protocol families for which you can specify the loops statement, enter the help apropos loops configuration command at the [edit protcols bgp] hierarchy level on your device.


When you configure the loops statement for a specific BGP address family, that value is used to evaluate the AS path for routes received by a BGP peer for the specified address family, rather than the loops value configured for the global AS number with the loops statement at the [edit routing-options autonomous-system as-number] hierarchy level.


number—Maximum number of times that the local device’s AS number is allowed in the AS_PATH attribute to accept the route.

  • Range: 1 through 10

  • Default: None. The system does not take any action unless the loops (BGP Address Family) statement is configured.

Required Privilege Level

routing—To view this statement in the configuration.

routing-control—To add this statement to the configuration.

Release Information

Statement introduced in Junos OS Release 9.6.