Hello,
An AS path is the autonomous systems that routing information passed through to get to a specified router. It indicates the origin of this route. The AS path is used to prevent routing loops in BGP. You can use this routing information to prefer one path to a destination network over another.
Example for Applying the AS-Path Attribute to a Route-Policy
Applicability
This example applies to all models of AR routers in all versions.
Networking Requirements
As shown in Figure 8-28, four routers belong to different ASs and establish EBGP connections. When RouterD sends routes to RouterA, the AS-Path attribute needs to be changed so that route from RouterA to 192.168.6.1/24 is changed.
Figure 8-28 Networking diagram of applying the AS-Path attribute to a route-policy

Procedure
Configure RouterA.
# sysname RouterA # interface GigabitEthernet1/0/0 ip address 192.168.1.1 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 192.168.2.1 255.255.255.0 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # bgp 100 router-id 1.1.1.1 //Set the router ID. You are advised to set the IP address of Loopback 0 as the router ID. peer 192.168.1.2 as-number 200 //Specify the peer IP address and AS number. peer 192.168.2.2 as-number 400 # ipv4-family unicast undo synchronization peer 192.168.1.2 enable peer 192.168.2.2 enable #
Configure RouterB.
# sysname RouterB # interface GigabitEthernet1/0/0 ip address 192.168.3.1 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 192.168.2.2 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # bgp 200 router-id 2.2.2.2 peer 192.168.2.1 as-number 100 peer 192.168.3.2 as-number 300 # ipv4-family unicast undo synchronization peer 192.168.2.1 enable peer 192.168.3.2 enable #
Configure RouterC.
# sysname RouterC # interface GigabitEthernet1/0/0 ip address 192.168.3.2 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 192.168.4.2 255.255.255.0 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # bgp 300 router-id 3.3.3.3 peer 192.168.3.1 as-number 200 peer 192.168.4.1 as-number 400 # ipv4-family unicast undo synchronization peer 192.168.3.1 enable peer 192.168.4.1 enable #
Configure RouterD.
# sysname RouterD # interface GigabitEthernet1/0/0 ip address 192.168.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 192.168.4.1 255.255.255.0 # interface GigabitEthernet3/0/0 ip address 192.168.6.1 255.255.255.0 # interface LoopBack0 ip address 4.4.4.4 255.255.255.255 # bgp 400 router-id 4.4.4.4 peer 192.168.1.1 as-number 100 peer 192.168.4.2 as-number 300 # ipv4-family unicast undo synchronization network 192.168.6.0 255.255.255.0 //Configure BGP to advertise local routes. peer 192.168.1.1 enable peer 192.168.1.1 route-policy t1 export //Apply a route-policy to the advertised routes. peer 192.168.4.2 enable # route-policy t1 permit node 5 //Create a route-policy. apply as-path 400 400 400 additive //Add AS number 400 400 400 to the AS-Path list. #
Verify the configuration.
# Before a route-policy is applied to RouterD, run the display bgp routing-table command on RouterA. You can see that there are two BGP routes destined for 192.168.6.0/24. A route with next-hop address 192.168.2.2 has AS-Path 200 300 400, and the other route with next-hop address 192.168.1.2 has AS-Path 400. Then run the display ip routing-table command. You can see that the route with next-hop address 192.168.1.2 is preferred.
# After a route-policy is applied to RouterD, run the display bgp routing-table command on RouterA. You can see that there are two BGP routes destined for 192.168.6.0/24. A route with next-hop address 192.168.2.2 has AS-Path 200 300 400, and the other route with next-hop address 192.168.1.2 has AS-Path 400,400,400,400. Then run the display ip routing-table command. You can see that the route with next-hop address 192.168.2.2 is preferred.
Configuration Notes
If no mask or mask length is specified in the network command, the IP address in the network command is considered as a classful address.
By default, IGP-BGP synchronization is disabled.
By default, peers are automatically enabled in the BGP-IPv4 unicast address family view.
Detail
https://support.huawei.com/enterprise/en/doc/EDOC1000138063/217a9db/example-for-applying-the-as-path-attribute-to-a-route-policy
Thanks