Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

BGP and metrics (help with lab)

Hi All,

I'm doing a lab and trying to get my head around BGP and metrics (MED).

In my lab I have 3 border routers and AS as shown below. I want R1 to be able to control which default route to use. R2 and R3 both send the default route to R1.

10.10.10.0/24

R1 (AS4854) --------------------- R2 (AS1221)

|

|

| 10.10.20.0/24

|

|

R3 (AS7474)

If for example I wanted to use R3 as the preferred default route, is it a matter of simply giving it a lower metric? So what I did was create a route-map and for routes received from R3, give it a metric of 100, and for routes received from R2, give it a metric of 200.

R1 config:

router bgp 4854

no synchronization

bgp log-neighbor-changes

network 172.16.1.0 mask 255.255.255.0

neighbor 10.10.10.2 remote-as 1221

neighbor 10.10.10.2 soft-reconfiguration inbound

neighbor 10.10.10.2 route-map BGP-IN-200 in

neighbor 10.10.20.2 remote-as 7474

neighbor 10.10.20.2 soft-reconfiguration inbound

neighbor 10.10.20.2 route-map BGP-IN-100 in

no auto-summary

!

route-map BGP-IN-100 permit 10

set metric 100

!

route-map BGP-IN-200 permit 10

set metric 200

I can see the metrics taking effect, but not sure why R3 (10.10.20.2) isn't the preferred default route when it has a lower metric.

R1#sh ip bgp 0.0.0.0 0.0.0.0 longer-prefixes

BGP table version is 5, local router ID is 172.16.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

*> 0.0.0.0 10.10.10.2 200 0 1221 i

* 10.10.20.2 100 0 7474 i

*> 172.16.1.0/24 0.0.0.0 0 32768 i

*> 172.16.2.0/24 10.10.10.2 200 0 1221 i

*> 172.16.3.0/24 10.10.20.2 100 0 7474 i

R2 config:

router bgp 1221

no synchronization

bgp log-neighbor-changes

network 172.16.2.0 mask 255.255.255.0

neighbor 10.10.10.1 remote-as 4854

neighbor 10.10.10.1 default-originate

neighbor 10.10.10.1 soft-reconfiguration inbound

R3 config:

router bgp 7474

no synchronization

bgp log-neighbor-changes

network 172.16.3.0 mask 255.255.255.0

neighbor 10.10.20.1 remote-as 4854

neighbor 10.10.20.1 default-originate

neighbor 10.10.20.1 soft-reconfiguration inbound

Am I missing something here??? My understanding of metrics (MED) is probably totally wrong!

Thanks.

Andy

1 ACCEPTED SOLUTION

Accepted Solutions

Re: BGP and metrics (help with lab)

Andy,

MED is used to be compared routes from the same AS. What happens when you add a "bgp always-compare-med" command on.

IMHO: You are going to force R1 to use R3 as a preferred router for a default route. It's an outbound policy. What you can do is to change Weight for routes coming from R3.

Hopes you're gonna love this link : http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml

HTH,

Toshi

4 REPLIES

Re: BGP and metrics (help with lab)

Andy,

MED is used to be compared routes from the same AS. What happens when you add a "bgp always-compare-med" command on.

IMHO: You are going to force R1 to use R3 as a preferred router for a default route. It's an outbound policy. What you can do is to change Weight for routes coming from R3.

Hopes you're gonna love this link : http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml

HTH,

Toshi

New Member

Re: BGP and metrics (help with lab)

Hi Toshi,

That worked great. I applied the command "bgp always-compare-med" and cleared bgp and can see better preference given to the route with the lower metric now.

R0#sh ip bgp 0.0.0.0 0.0.0.0 longer-prefixes

BGP table version is 5, local router ID is 172.16.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

* 0.0.0.0 10.10.10.2 200 0 1221 i

*> 10.10.20.2 100 0 7474 i

*> 172.16.1.0/24 0.0.0.0 0 32768 i

*> 172.16.2.0/24 10.10.10.2 200 0 1221 i

*> 172.16.3.0/24 10.10.20.2 100 0 7474 i

Although it worked, I'll have a read of the doco you sent me. I've read the doco before but bgp doesn't really stick with me because I don't use it very often.

Many thanks.

Andy

New Member

Re: BGP and metrics (help with lab)

Is there a way to control inbound traffic so that all traffic coming into R1 comes in from one AS (ISP) only??? Do we have control over this??

Re: BGP and metrics (help with lab)

Andy,

I'm not sure that we can configure at the R1 to tell the other routers that you don't send me traffic.In your case R1 is connecting with 2 ASes.In case you've got the same routes from 2 ASes you can use "Weight" to prefer routes coming from AS you want. In case of you lose routes/connections from that AS R1 still send to the other AS.

F.e. R1 prefers R3

!

ip as-path access-list 1 permit _1221$

ip as-path access-list 2 permit _7474$

!

route-map WEIGHT1000 permit 10

match as-path 1

set weight 1000

!

route-map WEIGHT1000 permit 20

!

!

route-map WEIGHT5000 permit 10

match as-path 2

set weight 5000

!

route-map WEIGHT5000 permit 10

!

router bgp 4854

neighbor 10.10.10.2 route-map WEIGHT1000 in

neighbor 10.10.20.2 route-map WEIGHT5000 in

HTH,

Toshi

273
Views
0
Helpful
4
Replies