Basic MED:Why MED is not being set correctly?

Answered Question
Mar 2nd, 2010

Hi, this is a very simple configuration. My intention is to set MED on R1 and later make that as my preferred traffic traffic entry point.

I see on R1 'show ip bgp' that incoming traffic is correctly identified as AS '200'.

However MED is not being set on R1 as '999'.

Can you please help me find out why not?

R1(AS 100)-------------------R2(AS 200)

On R1 I do


R1#show ip bgp
BGP table version is 5, local router ID is 10.2.80.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
*> 2.2.2.2/32       10.2.47.193              0             0 200 i
*> 10.2.0.0/16      0.0.0.0                            32768 i
*> 10.2.44.0/24     0.0.0.0                  0         32768 i
*> 10.2.90.0/24     10.2.47.193              0             0 200 i
R1#

!
interface Loopback0
no ip address
!
interface Loopback1
ip address 10.2.80.1 255.255.255.0
!
interface Loopback4
ip address 10.2.44.1 255.255.255.0
!
interface FastEthernet0/0
ip address 10.2.47.204 255.255.255.240
speed 100
full-duplex
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 10.2.44.0 mask 255.255.255.0
aggregate-address 10.2.0.0 255.255.0.0
neighbor 10.2.47.193 remote-as 200
neighbor 10.2.47.193 route-map TO_R1 out
no auto-summary
!
ip forward-protocol nd
!
ip as-path access-list 1 permit _200$
!
ip http server
no ip http secure-server
!
!
route-map TO_R1 permit 10
match as-path 1
set metric 999
!
route-map TO_R1 permit 100
!
!

(end)
---------------------------------


R2#   show ip bgp
BGP table version is 5, local router ID is 10.2.55.133
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
*> 2.2.2.2/32       0.0.0.0                  0         32768 i
*> 10.2.0.0/16      10.2.47.204              0             0 100 i
*> 10.2.44.0/24     10.2.47.204              0             0 100 i
*> 10.2.90.0/24     0.0.0.0                  0         32768 i
R2#

!

desc R2 bgp statement
router bgp 200
no synchronization
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
network 10.2.90.0 mask 255.255.255.0
neighbor 10.2.47.204 remote-as 100
no auto-summary
!

I have this problem too.
0 votes
Correct Answer by Jon Marshall about 6 years 9 months ago

Marlon

As always, glad to have helped. You are going to be a BGP guru by the time you have finished your labs

Jon

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Jon Marshall Tue, 03/02/2010 - 14:13

Marlon

I may not be understanding your topology but MED is set on routes going out from R1 not routes coming in to R1. MED is used to influence how traffic is sent to your AS.

So if you want to make R1 then entry point from R2 you set MED on the routes being advertised to R2.

And if you want to set MED on routes being received by R1 you need to set the MED on R2. Your config doesn't look like it is doing this.

Can you clarify ?

Jon

news2010a Tue, 03/02/2010 - 14:24

Jon, imagine I own and I have control over R1 (AS 100) router only.

So R2 (AS 200) is an ISP which is not going to change their configuration.

So if in the future I have R1 and R3 both in AS 100 connected to R2 AS 200, I am trying to make R1 as the preferred path for ingress traffic coming from the R2 AS 200 "ISP".

I really thought I could control this from the R1 side via MED. Am I wrong?

Jon Marshall Tue, 03/02/2010 - 14:29

news2010a wrote:

Jon, imagine I own and I have control over R1 (AS 100) router only.

So R2 (AS 200) is an ISP which is not going to change their configuration.

So if in the future I have R1 and R3 both in AS 100 connected to R2 AS 200, I am trying to make R1 as the preferred path for ingress traffic coming from the R2 AS 200 "ISP".

I really thought I could control this from the R1 side via MED. Am I wrong?

Marlon

You can do this with MED and your understanding is correct. But your matching criteria in the route-map is -

ip as-path access-list 1 permit _200$

what is that meant to match because the routes when they are sent to R2 will not have AS 200 in them. MED is added to your routes as they are sent out not to R2's routes as they are received.

Jon

news2010a Tue, 03/02/2010 - 14:54

That is true. If it is leaving the AS so AS=200 is not there.
Then I am trying now using a prefix-list. It should work.

However I do 'clear ip bgp*' on R1 and I still do not see the metric set. Any hint?

R1#sho ip prefix-list

ip prefix-list LIST_ENG: 1 entries

   seq 5 permit 10.2.0.0/16 le 32

R1#show run | s bgp

router bgp 100

no synchronization

bgp log-neighbor-changes

network 10.2.20.0 mask 255.255.255.0

aggregate-address 10.2.0.0 255.255.0.0

neighbor 10.2.47.193 remote-as 200

neighbor 10.2.47.193 route-map SETMED out

no auto-summary

R1#show route-map

route-map SETMED, permit, sequence 10

  Match clauses:

    ip address (access-lists): LIST_ENG

  Set clauses:

    metric 999

  Policy routing matches: 0 packets, 0 bytes

route-map SETMED, permit, sequence 100

  Match clauses:

  Set clauses:

  Policy routing matches: 0 packets, 0 bytes
1#
R1#show ip bgp
BGP table version is 6, local router ID is 10.2.30.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
*> 10.2.0.0/16      0.0.0.0                            32768 i
*> 10.2.20.0/24     0.0.0.0                  0         32768 i
*> 192.168.1.0      10.2.47.193              0             0 200 i
R1#

news2010a Tue, 03/02/2010 - 15:02

Ding. I see it on R2 actually. So there is where the MED is set... sure it makes sense.

Thanks for your help.

Correct Answer
Jon Marshall Tue, 03/02/2010 - 15:11

Marlon

As always, glad to have helped. You are going to be a BGP guru by the time you have finished your labs

Jon

Actions

This Discussion