November 7, 2024

BGP MED Attribute Configuration example

BGP MED Attribute Configuration example

BGP MED Attribute Configuration example BGP MED is an optional non-transitive attribute meaning its not propagated throughout the whole internet but just to adjacent AS. The word “optional” means that this is not necessarily by default sent with the BGP updates. The purpose of MED is to influence how other autonomous systems enter your AS to reach a certain prefix. If the other attributes are set to default, MED will be the attribute used for path selection however, if Weight or Local preference is configured on the adjacent AS router, then MED will not be selected. The lower MED is more preferred. [boxads]

  • Acronym for Multi Exit Discriminator and otherwise known as “Metric” in the BGP table.
  • The lower the MED the more preferred.
  • It is an optional non-transitive attribute.
  • Can dictate how other AS enter your AS.
BGP MED Attribute Configuration example
BGP MED Attribute Configuration example

Configure R4 so that it will advertise a MED value of 30 to R3 and 20 to R2. Afterwards, tweak the route map to set a MED of 10 for network 144.144.144.144/32 in R4 towards R3. The end result should have traffic from AS123 to 4.4.4.4/32 and 44.44.44.44/32 take R2 but traffic for 144.144.144.144/32 should take R3. At the start BGP has been established on all routers.

To start lets configure 2 route maps and set the MED as required.

R4(config)#access-list 20 permit any
R4(config)#access-list 30 permit any
R4(config)#route-map R2SETMED20 permit 10
R4(config-route-map)#match ip address 20
R4(config-route-map)#set metric 20
R4(config-route-map)#route-map R3SETMED30 permit 10
R4(config-route-map)#match ip address 30         
R4(config-route-map)#set metric 30

[bodyads]Access-list matches all routes. Now, lets apply the route map to the neighbors.

R4(config-router)#neighbor 24.24.24.2 route-map R2SETMED20 out
R4(config-router)#neighbor 34.34.34.3 route-map R3SETMED30 out

Its in the “out” direction because R4 is the one advertising the routes. Let’s check what R2 and R3 see in their BGP table.

BGP MED Attribute
BGP MED Attribute

Ok, its clear that the Metric now is changed to 20 and 30 for R2 and R3 respectively. Let’s see how R1 sees the routes.

MED Attribute bgp table
MED Attribute bgp table

R1 sees two paths, but notice that the paths with “>” are with those with lower MED. Therefore it is going to take those paths. Now, lets configure R4 so that the path R1 will take to 144.144.144.144/32 in R4 will be through R3 then clear the BGP session after. [bodylink]

R4(config)#access-list 33 permit 144.144.144.144 0.0.0.0
R4(config)#route-map R3SETMED30 permit 10
R4(config-route-map)#match ip address 33
R4(config-route-map)#set metric 10
R4(config-route-map)#route-map R3SETMED30 permit 20
R4(config-route-map)#match ip address 30
R4(config-route-map)#set metric 30
R4#clear ip bgp *

Now, lets see the outputs.

BGP MED Attribute Configuration example output
BGP MED Attribute Configuration example output

We can see a change in R3 that shows a MED of 10 for 144.144.144.144/32, while R1 shows the same and will now take R3 to reach the subnet.

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 154 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 !!