November 21, 2024

Change BGP Weight Attribute Cisco Router by Route Maps

Change BGP Weight Attribute Cisco Router by Route Maps

Change BGP Weight Attribute Cisco router by Route Maps. Weight attribute is used by BGP to break the tie when there are more routes to the same network. Route with the highest weight is preferred. Weight attribute is a Cisco feature, it has local meaning and it is not transmitted to other routers. [boxads]

In this example we will discuss about how to change BGP weight attribute cisco router by Route Maps.

Change BGP Weight Attribute Cisco Router by Route Maps
Change BGP Weight Attribute Cisco Router by Route Maps

In the picture you see that WEST router in AS 65520 receives the routes advertised by EAST router in AS 65523 (172.16.0.0/24 and 192.168.100.0/24) over ISP-1 and ISP-2 routers. BGP will choose to reach those routes over ISP-1 or ISP-2. Let’s assume that all configurations are already made and all settings are left default. If so, let’s check bgp table of WEST router:

west
west

As you can see, BGP weight attribute is “0″ for updates received from neighbors. It chose the path over 10.0.1.2 as the best one (marked with “>”), most likely because 10.0.1.2 was the first who advertised the routes received from EAST router. The routes to EAST networks over 10.0.1.2 will be put in routing table by BGP.

Further I will change the weight on WEST router  in such a manner that packets to 192.168.100.0/24 network will be sent over ISP-1, and packets to 172.16.0.0/24 will be sent over ISP-2 router. [bodyads]

First I need two access lists to match networks contained in bgp updates:

WEST(config)#access-list 1 permit 192.168.100.0 0.0.0.255
WEST(config)#access-list 2 permit 172.16.0.0 0.0.0.255

Then two route maps which I named ISP-1 and ISP-2:

WEST(config)#route-map ISP-1 permit 10
WEST(config-route-map)# match ip address 1
WEST(config-route-map)# set weight 100
WEST(config-route-map)#route-map ISP-1 permit 20

WEST(config)#route-map ISP-2 permit 10
WEST(config-route-map)# match ip address 2
WEST(config-route-map)# set weight 100
WEST(config-route-map)#route-map ISP-2 permit 20

Both route maps contain sequence number 10 and 20. Sequence 10 is used to match access lists (route map ISP-1 matches access list 1, ISP-2 matches access list 2). Also in sequence 10 is changed the weight to 100 for those updates matched by corresponding access list. Sequence 20 is empty and is used to avoid implicit deny at the end of route-map, ie, to keep updates unmatched by access list.

Next step is to apply route maps to neighbors:

WEST(config)#router bgp 65520
WEST(config-router)#neighbor 10.0.0.2 route-map ISP-1 in
WEST(config-router)#neighbor 10.0.1.2 route-map ISP-2 in

And that’s all! Because we changed local router policies we need to make router to generate new inbound updates from stored table.

WEST#clear ip bgp * soft in

Now, the best route for 192.168.0.0/24 will be through ISP-1, for 172.16.0.0/24 through ISP-2. Let’s check again:

West BGP table
West BGP table

You can see the results are as expected. Below you see routing table on WEST router:

West routing table
West routing table

That’s it, with route maps also can be changed the weight for updates generated from a specific AS by using as-path access lists and match as-path route-map statement. Thanks for reading!

[bodylink]

Download “Change BGP Weight Attribute Cisco Router by Route Maps” GNS3 Lab

Shahed

Hi! I am Shahed Israr. I try to help GPON Technology users with their queries and provide them with relevant and accurate information to the best of my ability. My main goal is to assist and enhance GPON Technology user and help people find the answers they're looking for quickly and easily.

Follow Me:
TwitterFacebookLinkedInPinterestGoogle PlusDiggYouTubeRedditDelicious

Visited 219 times, 1 visit(s) today

Comments

comments

Shahed

Hi! I am Shahed Israr. I try to help GPON Technology users with their queries and provide them with relevant and accurate information to the best of my ability. My main goal is to assist and enhance GPON Technology user and help people find the answers they're looking for quickly and easily.

View all posts by Shahed →

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

error: Content is protected !!