2013年6月16日星期日

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


Question:

I'm using a router WAN Cisco Catalyst 3560 Price 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 ?


Answer:

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

For more information about Cisco products, please click here.

没有评论:

发表评论