cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
629
Views
5
Helpful
2
Replies

[BGP - MED] - MED seems to not be used

NicolasDemonty
Level 1
Level 1

Hi all,

I'm using Cisco 2691 routers (ios 12.4(25c)) in GNS3 to simulate a scenario and to test the MED mecanism.

med.jpg

In the diagram :

  • R1 and R2 are routers of AS1 and the others belong to AS10.
  • R5 connects the network 51.51.51.0/24
  • R6 connects the network 61.61.61.0/24
  • R3 and R4 runs eBGP with R1 and R2 respectively
  • An iBGP mesh is configured between R1 and R2
  • An iBGP mesh is configured between R3 to R6

The idea here is to influence to inbound path to Net51 and Net61. I would like that R1 will be used to reach Net51 and R2 to reach Net61. Therefore I'm trying to use the MED attribute :

  • R3 advertises Net51 to R1 with MED = 10 and Net61 with MED = 100.
  • R4 advertises Net51 to R2 with MED = 100 and Net61 with MED = 10.

The problem is simple : it doesn't work . More precisely, R1 and R2 seem to chose the eBGP route instead of evaluating the MED attribute as you can see in the "show ip bgp" output here (I've forced the Local_Pref to be sure it is not used). 10.10.10.0/30 is the link between R1 and R3 and 20.20.20.0/30 is the link between R2 and R4.

PT1#show ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 51.51.51.0/24    10.10.10.2              10      0      0 10 i
* i                 20.20.20.2             100      0      0 10 i
* i61.61.61.0/24    20.20.20.2              10      0      0 10 i
*>                  10.10.10.2             100      0      0 10 i

PT2#show ip bgp
BGP table version is 3, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i51.51.51.0/24    10.10.10.2              10      0      0 10 i
*>                  20.20.20.2             100      0      0 10 i
*> 61.61.61.0/24    20.20.20.2              10      0      0 10 i
* i                 10.10.10.2             100      0      0 10 i

As you can see, the best route choice is not influenced by the MED but it seems that the eBGP route is chosen. If I check the Path Algorithm I can deduct the following :

0. Next hop reachable : yes

1. Weight : tie because all 0

2. Local_Pref : set to 0 to be sure. Tie

3. Locally injected route : no, only BGP

4. AS_Path : identic

5. Origin : all i

6. MED : set to 10 and 100

7. Neighbor type : eBGP here

Well when I look on the algorithm it seems that step 6 is not evaluated correctly and that step 7 determine the route ...

Do you have any idea of the problem ? I've already looked for info on the web but all I've found is consistent to my configuration. Is it a bug or is it a mistake in the configuration (see below) :

R1 :

router bgp 1
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
bgp deterministic-med
neighbor 10.10.10.2 remote-as 10
neighbor 10.10.10.2 default-originate
neighbor 10.10.10.2 route-map LP in
neighbor 100.100.100.2 remote-as 1
no auto-summary
!
access-list 20 permit any
!
route-map LP permit 10
match ip address 20
set local-preference 0
!
route-map LP permit 20

R2 :

router bgp 1
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
bgp deterministic-med
neighbor 20.20.20.2 remote-as 10
neighbor 20.20.20.2 default-originate
neighbor 20.20.20.2 route-map LP in
neighbor 100.100.100.1 remote-as 1
no auto-summary
!
access-list 20 permit any
!
route-map LP permit 10
match ip address 20
set local-preference 0
!
route-map LP permit 20

R3 :

router bgp 10
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 10
neighbor 4.4.4.4 update-source Loopback1
neighbor 4.4.4.4 next-hop-self
neighbor 5.5.5.5 remote-as 10
neighbor 5.5.5.5 update-source Loopback1
neighbor 5.5.5.5 next-hop-self
neighbor 6.6.6.6 remote-as 10
neighbor 6.6.6.6 update-source Loopback1
neighbor 6.6.6.6 next-hop-self
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.10.1 route-map MED out
no auto-summary
!
ip route 4.4.4.4 255.255.255.255 10.10.10.6
ip route 5.5.5.5 255.255.255.255 10.10.10.6
ip route 6.6.6.6 255.255.255.255 10.10.10.6
!
access-list 10 permit 51.51.51.0 0.0.0.255
access-list 11 permit 61.61.61.0 0.0.0.255
!
route-map MED permit 10
match ip address 10
set metric 10
!
route-map MED permit 20
match ip address 11
set metric 100
!
route-map MED permit 30

R4 :

router bgp 10
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 10
neighbor 3.3.3.3 update-source Loopback1
neighbor 3.3.3.3 next-hop-self
neighbor 5.5.5.5 remote-as 10
neighbor 5.5.5.5 update-source Loopback1
neighbor 5.5.5.5 next-hop-self
neighbor 6.6.6.6 remote-as 10
neighbor 6.6.6.6 update-source Loopback1
neighbor 6.6.6.6 next-hop-self
neighbor 20.20.20.1 remote-as 1
neighbor 20.20.20.1 route-map MED out
no auto-summary
!
ip route 3.3.3.3 255.255.255.255 20.20.20.6
ip route 5.5.5.5 255.255.255.255 20.20.20.6
ip route 6.6.6.6 255.255.255.255 20.20.20.6
!
access-list 10 permit 51.51.51.0 0.0.0.255
access-list 11 permit 61.61.61.0 0.0.0.255
!
route-map MED permit 10
match ip address 10
set metric 100
!
route-map MED permit 20
match ip address 11
set metric 10
!
route-map MED permit 30

Thanks a lot for your help

Nicolas

PT1#show ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 51.51.51.0/24    10.10.10.2              10      0      0 10 i
* i                 20.20.20.2             100      0      0 10 i
* i61.61.61.0/24    20.20.20.2              10      0      0 10 i
*>                  10.10.10.2             100      0      0 10 i
Header 1Header 2




2 Replies 2

Peter Paluch
Cisco Employee
Cisco Employee

Hello Nicolas,

I think that there may be a problem with the next hop reachability after all. Note that PT1 (R1) selected only those routes reachable via the next hop 10.10.10.2 while PT2 (R2) selected only routes with the next hop of 20.20.20.2. How do your R1 and R2 know about the 10.10.10.2 and 20.20.20.2 addresses? Are you running any IGP between R1 and R2 that would disseminate the information about R1/R3 and R2/R4 networks?

Can you test show ip route 20.20.20.2 on R1 and show ip route 10.10.10.2 on R2 and see what comes out?

Best regards,

Peter

...

...

and

...

Indeed you're right ! I was so focused on the R3 to R6 all the morning that I didn't see that I forgot to configure the "next-hop-self" on R1 and R2 (or indeed configure an IGP between them)

It is much much much better now !

thanks a lot for your observation

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card