cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
576
Views
0
Helpful
3
Replies
Highlighted

BGP advertisement : how to suppress the attributes "next hop" and "metric" inherited from OSPF ?

Hi,

I'm using a router WAN Cisco ASR1001 connected through BGP AS65075 with our ISP.

This router is connected through OSPF with our firewall Cisco 7206VXR/NPE-G2.

Topology :

ISP <- BGP -> RT 1001 <- OSPF -> FW 7206 <-> LAN

On the WAN router, static routes are set up to null0 in order to always announce our networks class C.

ip route 192.168.10.0 255.255.255.0 Null0 250

...

Network directives are placed in our BGP configuration :

router bgp 65075

bgp log-neighbor-changes

neighbor EBGP-PEERS-IPv4 peer-group

neighbor EBGP-PEERS-IPv4 fall-over bfd

neighbor 192.168.88.138 remote-as 65200

neighbor 192.168.88.138 peer-group EBGP-PEERS-IPv4

neighbor 192.168.88.138 description ISP IPv4

neighbor 192.168.88.138 password 7 unknown

!

address-family ipv4

...

  network 192.168.10.0

...

  neighbor EBGP-PEERS-IPv4 soft-reconfiguration inbound

  neighbor EBGP-PEERS-IPv4 distribute-list prefix-v4 out

  neighbor EBGP-PEERS-IPv4 maximum-prefix 100

  neighbor EBGP-PEERS-IPv4 filter-list 1 out

  neighbor 192.168.88.138 activate

  neighbor 192.168.88.138 filter-list 2 in

exit-address-family

A part of these networs are also learned through OSPF. So these routes are active in routing table :

rt-01#sh ip ro 192.168.10.0

Routing entry for 192.168.10.0/24

  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 1

  Advertised by bgp 65075

  Last update from 192.168.0.79 on Port-channel1.28, 7w0d ago

  Routing Descriptor Blocks:

  * 192.168.0.79, from 192.168.0.71, 7w0d ago, via Port-channel1.28

      Route metric is 20, traffic share count is 1

Because these routes are active in rounting table. BGP advertisement is based on its and attributes  "next hop" and "metric" are inherited from OSPF :

rt-01#sh ip bgp neighbors 192.168.88.138 advertised-routes

...

     Network          Next Hop            Metric LocPrf Weight Path

...

*>  192.168.10.0     192.168.0.79           20         32768 i

...

Is there a way to suppress inheritance of attributes from OSPF to BGP ?

How to set "next hop" to value 0.0.0.0 and "metric" to 0 ?

Thanks

Best regards

Jérôme

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Participant

Hello Berthier,

NEXT_HOP is a well-know&mandatory path attribute which value for eBGP is the IP address of the BGP peer (specified in the neighbor remote command) where the router learned the prefix. So, your peer (eBGP) will see always the IP 192.168.88.138 in your BGP updates as Next Hop. I agree you the output of the command "sh ip bgp neighbors 192.168.88.138 advertised-routes" can be confused but do not worried about it.

Metric 20 is due to route is learned by OSPF. BGP copy metric in MED atributte by default. I see that you only have a peer so is not very important change this value because MED is not transitive so this value is not propagated by your ISP to others AS. Anyway, if you want to change, you must:

1- Create an prefix-list with one or more prefixes that you want to "reset" the MED value:

prefix-list prefix-to-reset-MED seq 5 permit 192.168.10.0/24

prefix-list prefix-to-reset-MED seq 10 permit X.X.X

2- Create a route-map

route-map reset-MED permit 5

match ip address prefix-list prefix-to-reset-MED

set metric 0

route-map reset-MED permit 10

!

The last route-map is needed to ensure that the rest of prefixes are sent.

3- Apply the route-map

neighbor EBGP-PEERS-IPv4 route-map reset-MED out

Regards

View solution in original post

3 REPLIES 3
Highlighted
Participant

Hello Berthier,

NEXT_HOP is a well-know&mandatory path attribute which value for eBGP is the IP address of the BGP peer (specified in the neighbor remote command) where the router learned the prefix. So, your peer (eBGP) will see always the IP 192.168.88.138 in your BGP updates as Next Hop. I agree you the output of the command "sh ip bgp neighbors 192.168.88.138 advertised-routes" can be confused but do not worried about it.

Metric 20 is due to route is learned by OSPF. BGP copy metric in MED atributte by default. I see that you only have a peer so is not very important change this value because MED is not transitive so this value is not propagated by your ISP to others AS. Anyway, if you want to change, you must:

1- Create an prefix-list with one or more prefixes that you want to "reset" the MED value:

prefix-list prefix-to-reset-MED seq 5 permit 192.168.10.0/24

prefix-list prefix-to-reset-MED seq 10 permit X.X.X

2- Create a route-map

route-map reset-MED permit 5

match ip address prefix-list prefix-to-reset-MED

set metric 0

route-map reset-MED permit 10

!

The last route-map is needed to ensure that the rest of prefixes are sent.

3- Apply the route-map

neighbor EBGP-PEERS-IPv4 route-map reset-MED out

Regards

View solution in original post

Highlighted

Hi Antonio,

Thanks for your answer.

I can see on ISP looking glass that the next hop is correct :

show ip bgp ipv4 unicast 192.168.10.0 

BGP routing table entry for 192.168.10.0/24, version 516487488 

Paths: (4 available, best #3, table default) 

  Advertised to update-groups: 

     49         

   65075 

    192.168.88.137 from 192.168.88.137 (192.168.0.69) 

      Origin IGP, metric 20, localpref 600, valid, external, best 

      Community: 65200:1001 65200:2003 65200:2011 65200:65200 

  65075, (received-only) 

    192.168.88.137 from 192.168.88.137 (192.168.0.69) 

      Origin IGP, metric 20, localpref 100, valid, external 

The goal of this case is to fix attributes in our BGP advertisement and do not depend of OSPF state.

Actually, il the OSPF route 192.168.10.0/24 disappears from the routing table of the router WAN, this router starts to use the static route to null0.

At this point, the metric is set to 0 in our BGP update and the announce is dampened at ISP side because of metric attribute change. That's why I'd like to fix it in all case.

I'm going to apply a route map.

For some sites, I already use a route map on BGP announce to set a specific community. Should I use the same route map to fix the metric by adding a set argument ?

route-map SET-BGP-COMMUNITY-v4 permit 10

match ip address BGP-COMMUNITY-to-ISP-v4

set community 65200:610

set metric 0

!

route-map SET-BGP-COMMUNITY-v4 permit 20

Thanks

Best regards

Jérôme

Highlighted

Yes,

you can do so many set commands as you want.

Regards.