Question - 1 Explain BGP AS-PATH attribute.
- AS_Path is the number of ASNs in the AS Path.
- It is Well-known mandatory attribute.
- Always shortest AS_Path will be prefer. You can manipulate (Increase AS_Path length to make less preferable ) AS_Path by using the command as-path prepend or set as-path prepend last-as in route-map. Both command have a different behaviors depend on the inbound and outbound direction. Prepending use to add same ASN multiple time in AS_Path.
- You can disable the AS_Path checking step from BGP path selection by using the command bgp bestpath as-path ignore.
Question - 2 How can we configure BGP AS-PATH attribute ?
Router3 and Router2 are both in AS 20 and advertising same network (5.5.5.0/24) to Router1.
We can use AS Path prepending to make Router1 prefer a certain path.
Initially we will configure the BGP between three routers.
- Router1 Configuration -
Router1#show running-config
interface Ethernet1/0
ip address 192.167.23.1 255.255.255.0
half-duplex
!
interface Ethernet2/0
ip address 192.167.24.1 255.255.255.0
half-duplex
!
router bgp 10
no synchronization
bgp log-neighbor-changes
neighbor 192.167.23.2 remote-as 20
neighbor 192.167.24.3 remote-as 20
no auto-summary
- Router2 Configuration -
Router2#show running-config
!
interface Loopback1
ip address 5.5.5.2 255.255.255.0
!
interface Ethernet1/0
ip address 192.167.23.2 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.23.1 remote-as 10
no auto-summary
- Router3 Configuration -
Router3#show running-config
interface Loopback1
ip address 5.5.5.3 255.255.255.0
!
interface Ethernet2/0
ip address 192.167.24.3 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.24.1 remote-as 10
no auto-summary
Output -
You can see in this output , Router1 prefer 192.167.23.2 as its path to reach network 5.5.5.0/24
So now we will change the AS_Path to make 192.167.24.3 as the preferred path.
Router2#configure terminal
Router2(config)#route-map AS_PATH_PRPEND permit 10 --------- Create Route-map
Router2(config-route-map)#set as-path prepend 20 20 20 20 20 ------- set AS_Path prepend, add you AS multiple time
Router2(config-route-map)#exit
Router2(config)#router bgp 20
Router2(config-router)#neighbor 192.167.23.1 route-map AS_PATH_PRPEND out---------Add the route-map in BGP configuration, and we will send this to our remote neighbor so it should be outbound.
Output -
You can see in this output, now 192.167.24.3 is preferred path, you can also see that the AS Path has become longer for the second entry
We can use AS Path prepending to make Router1 prefer a certain path.
- Router1 Configuration -
interface Ethernet1/0
ip address 192.167.23.1 255.255.255.0
half-duplex
!
interface Ethernet2/0
ip address 192.167.24.1 255.255.255.0
half-duplex
!
router bgp 10
no synchronization
bgp log-neighbor-changes
neighbor 192.167.23.2 remote-as 20
neighbor 192.167.24.3 remote-as 20
no auto-summary
- Router2 Configuration -
!
interface Loopback1
ip address 5.5.5.2 255.255.255.0
!
interface Ethernet1/0
ip address 192.167.23.2 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.23.1 remote-as 10
no auto-summary
- Router3 Configuration -
interface Loopback1
ip address 5.5.5.3 255.255.255.0
!
interface Ethernet2/0
ip address 192.167.24.3 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.24.1 remote-as 10
no auto-summary
Output -
You can see in this output , Router1 prefer 192.167.23.2 as its path to reach network 5.5.5.0/24
So now we will change the AS_Path to make 192.167.24.3 as the preferred path.
Router2#configure terminal
Router2(config)#route-map AS_PATH_PRPEND permit 10 --------- Create Route-map
Router2(config-route-map)#set as-path prepend 20 20 20 20 20 ------- set AS_Path prepend, add you AS multiple time
Router2(config-route-map)#exit
Router2(config)#router bgp 20
Router2(config-router)#neighbor 192.167.23.1 route-map AS_PATH_PRPEND out---------Add the route-map in BGP configuration, and we will send this to our remote neighbor so it should be outbound.
Output -
You can see in this output, now 192.167.24.3 is preferred path, you can also see that the AS Path has become longer for the second entry
0 comments:
Post a Comment
If you like my posts then please comment and if you don’t like then please suggest me to improve, and if you have any query related to post then please text me through the comment box or mail me on upadhyayambition@gmail.com , I will try my best to solve your queries as soon as possible.