peer allow-as-loop

Use peer allow-as-loop to allow a local AS number to exist in the AS_PATH attribute of routes from a peer or peer group, and to set the number of times the local AS number can appear.

Use undo peer allow-as-loop to remove the configuration.

Syntax

In BGP IPv4 unicast address family view/BGP-VPN IPv4 unicast address family view/BGP IPv4 multicast address family view:

peer { group-name | ipv4-address [ mask-length ] } allow-as-loop [ number ]

undo peer { group-name | ipv4-address [ mask-length ] } allow-as-loop

In BGP IPv6 unicast address family view:

peer { group-name | ipv6-address [ prefix-length ] } allow-as-loop [ number ]

undo peer { group-name | ipv6-address [ prefix-length ] } allow-as-loop

In BGP-VPN IPv6 unicast address family view/BGP IPv6 multicast address family view:

peer { group-name | ipv6-address [ prefix-length ] } allow-as-loop [ number ]

undo peer { group-name | ipv6-address [ prefix-length ] } allow-as-loop

Default

The local AS number is not allowed to exist in the AS_PATH attribute of routes from a peer or peer group.

Views

BGP IPv4 unicast address family view

BGP-VPN IPv4 unicast address family view

BGP IPv6 unicast address family view

BGP-VPN IPv6 unicast address family view

BGP IPv4 multicast address family view

BGP IPv6 multicast address family view

Predefined user roles

network-admin

Parameters

group-name: Specifies a peer group by its name, a case-sensitive string of 1 to 47 characters. The peer group must have been created.

ipv4-address: Specifies a peer by its IPv4 address. The peer must have been created.

mask-length: Specifies a mask length in the range of 0 to 32. You can use the ipv4-address and mask-length arguments together to specify a subnet. If you specify a subnet in this command, BGP allows a local AS number to exist in the AS_PATH attribute of routes from all dynamic peers in the subnet.

ipv6-address: Specifies a peer by its IPv6 address. The peer must have been created.

prefix-length: Specifies a prefix length in the range of 0 to 128. You can use the ipv6-address and prefix-length arguments together to specify a subnet. If you specify a subnet in this command, BGP allows a local AS number to exist in the AS_PATH attribute of routes from all dynamic peers in the subnet.

number: Specifies the number of times for which the local AS number can appear, in the range of 1 to 10. The default number is 1. If the number of times for which the local AS number appears in a route is more than the specified number, BGP considers that a routing loop occurs and discards the route.

Usage guidelines

By default, BGP does not receive routes that contain the local AS number in the AS_PATH attribute to avoid routing loops. However, in some network environments, the AS_PATH attribute of a route from a peer must be allowed to contain the local AS number. Otherwise, the route cannot be advertised correctly.

Examples

# In BGP IPv4 unicast address family view, set the number of times the local AS number can appear in AS_PATH attribute of routes from peer group test to 2.

<Sysname> system-view
[Sysname] bgp 100
[Sysname-bgp-default] address-family ipv4 unicast
[Sysname-bgp-default-ipv4] peer test allow-as-loop 2