Master CCNA

How to Master CCNA Ebook

 

 

My book will help you Master CCNA

Master CCNP SWITCH

How to master CCNP SWITCH ebook

 

 

My book will help you Master CCNP SWITCH

Master CCNP ROUTE

How to master CCNP ROUTE Ebook

 

 

My book will help you Master CCNP ROUTE

Print

BGP Always compare MED

Written by Rene Molenaar on . Posted in BGP

Scenario:

You are the senior networking engineer working for a huge comic book provider. Your network (AS 100) is connected to 2 different service providers and normally all traffic is being sent to your main ISP which is AS 300. However there is a certain network that is being sent to AS 200 which is your backup ISP. All traffic should be sent towards AS300, is this a cheap trick from your backup ISP to make more money? Or is there something else going on? Time for justice!

Goal:

  • All IP addresses are preconfigured as specified in the topology picture.
  • Configure EBGP between AS 100 and AS 200.
  • Configure EBGP between AS 100 and AS 300, make sure you have a neighbor relationship between router Spiderman and Superman as well as between router Spiderman and Ironman.
  • Configure IBGP within AS 300.
  • Make sure all neighbor relationships are working, advertise the correct networks in BGP to achieve full connectivity.
  • Router Batman AND Superman have the same IP address on the loopback1 interface, advertise this in BGP on both routers.
  • Ensure you can ping the 1.2.3.4 address from router Spiderman.
  • Take a look at the BGP table with 'show ip bgp' on router Spiderman.
  • Which path is being used for the 1.2.3.4 network?
  • Configure router Ironman and Superman so they send a MED of 50 for the 1.2.3.4 network towards router Spiderman.
  • Configure router Batman so it sends a MED of 150 for the 1.2.3.4 network towards router Spiderman.
  • Check router Spiderman with 'show ip bgp' to see the changes you just made, if not do a 'clear ip bgp *'
  • Even though the MED from AS 300 is better, why is traffic towards 1.2.3.4 still being sent towards AS 200?
  • Configure router Spiderman so traffic towards 1.2.3.4 is sent towards AS 300, the only attribute you are allowed to change is MED.

IOS:

c3640-jk9s-mz.124-16.bin

Topology:

BGP Always Compare MED

Video Solution:

You need to a flashplayer enabled browser to view this YouTube video

You need to register to download the GNS3 Topology File. (Registration is Free!)

Related Articles
Only registered users can write comments!

Comments (12)

  • avatar
    galen_kwan

    thanks Rene. I just finished this lab. took me a while but I understand a few things as a result. this is my final Spiderman config.

    router bgp 100
    no synchronization
    bgp always-compare-med
    bgp log-neighbor-changes
    network 192.168.12.0
    network 192.168.13.0
    network 192.168.14.0
    neighbor 192.168.12.2 remote-as 200
    neighbor 192.168.13.3 remote-as 300
    neighbor 192.168.14.4 remote-as 300
    no auto-summary
    !

    and this is my final Batman config.
    router bgp 200
    no synchronization
    bgp log-neighbor-changes
    network 1.2.3.4 mask 255.255.255.255
    neighbor 192.168.12.1 remote-as 100
    neighbor 192.168.12.1 route-map policy1 out
    no auto-summary
    !
    access-list 1 permit 1.2.3.4 0.0.0.0
    !
    route-map policy1 permit 10
    match ip address 1
    set metric 150
    !

    Rene, are you able to help me explain why it prefers the path through Batman for the 1.2.3.4 network (if "bgp always-compare-med" is not added to Spiderman)?

    Still can't figure out.

    thanks.

  • avatar
    ReneMolenaar

    Let me help you a bit...first of all these are the BGP attributes:

    W Weight (Highest)
    L Local_Pref (Highest)
    O Originate (local originate)
    AS As_Path (shortest)
    O Origin Code (IGP < EGP < Incomplete)
    M MED (lowest)
    P Paths (External Paths preferred Over Internal)
    R Router ID (lowest)

    By default MED is only compared when you have multiple links to the SAME AS. When you configure the "always compare MED" it'll compare MED even when it's from different AS'es.

    Walk through the attribute list and try to see why it prefers one route over another :)

  • avatar
    galen_kwan

    thanks Rene. I think I got it which one =) cheers. on to the next lab...

  • avatar
    ReneMolenaar

    Very good :) Just walk down the BGP attribute list whenever you are in doubt and you'll find the answer. Keep in mind that this list can change...an example of this is when you enable BGP Load-balancing. By default BGP only uses a single path but you can enable load balancing which means the list will change/shift ;)

  • avatar
    Dialerstring

    Rene, would it benefit to set the 'bgp determistic-med' bgp subcommand? Your labs are great.

  • avatar
    luismg

    Very nice, I was stopped at
    Network Next Hop Metric LocPrf Weight Path
    * 1.2.3.4/32 192.168.13.3 50 0 300 ?
    * 192.168.14.4 50 0 300 ?
    *> 192.168.12.2 150 0 200 ?

    WOW, better med and no best path :O
    These kind of think you won't think it happen until you face them

  • avatar
    luismg

    Sorry I cannot edit my comment so I asked to delete it, but I think, lower med is better . In my lab is going through Superman
    Superman - 50
    Batman - 150
    Ironman - 50

    After that I used "bgp always-compare-med" under router bgp 100 and nothing changed.

    And I guess that this "Configure router Spiderman so traffic towards 1.2.3.4 is sent towards AS 300, the only attribute you are allowed to change is MED." is done with an incoming route map that enforces to change the MED received from Superman to be lower than 50 and all is done.

    Very interesting lab.

  • avatar
    ReneMolenaar

    First let me explain the difference between BGP deterministic-med and BGP always-compare med.

    BGP deterministic-med will make sure that MED variable will be compared when a route is advertised by different peers in the same AS.

    BGP always-compare will make sure that you compare MED for peers in different AS'es.

    If you want to influence the MED the best thing to do is create a route-map and match/set the prefix :)

    Glad you guys like the labs!

  • avatar
    luismg

    I did it like that, with set metric in the route-map (metric = med)

  • avatar
    Ollie

    I wouldn't have got the #bgp always-compare-med without the hint, in fact it did switch to AS300 when I reset Batman, but not Spiderman, I suppose in 30 mins time that would of changed.

    Nice route-map practice.;)

  • avatar
    zingonet

    Thanks, I remember glancing over the bgp always-compare-med and bgp deterministic-med in my studies. This lab definitely clears it up for me. :D