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 300, make sure you have a neighbor relationship between router Spiderman and Superman as well as between router Spiderman and Ironman.
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)?
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
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
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.
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.