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

next-hop self for "network" statement

James Jun
Level 1
Level 1

Consider the following scenario:  Static route of a /24 to a downstream customer router.  Customer isn't running BGP with us, so we advertise his /24 on our IOS XR router and static route it to his connection.

 

When using 'network' statement to advertise a prefix that is pinned to a static route, BGP will advertise the route with the static route's next-hop as the iBGP nexthop, instead of setting the next-hop to self (lo0).  This creates upstream problems, as core network RRs do not have IGP metric visibility on the static route's next-hop, so we lose the optimal exit selection.

 

So I tried the following to get around this, and both attempts failed:

 

1. Tried using 'next-hop self' on the originating route-map used under network statement.  Next-hop-self attachment under 'network' statement is not allowed, so commit fails.  Classic IOS/IOS XE allows this, so this was my first choice, but IOS XR does not allow setting of next-hop on network statements...

 

2.  After failing above, I then tried doing the Juniper policy-statement style of using "installing protocols" to selectively overwrite next-hop to self for network statements tied to statically routed customers, on RPL facing iBGP RR neighbors.  As follows:

!
route-policy next_hop_self
  if community matches-any my_origin_identifier then
    # if route is from eBGP neighbor or announced using 'network'
    # statement, overwrite next-hop to self.
    if path-type is ebgp or protocol in (connected, static) then
      set next-hop self
    endif
    
    # for other iBGP neighbors downstream of me (I am acting as RR server),
    # do _NOT_ overwrite next-hop!
    done
  else
    drop
  endif
end-policy
!
route-policy origination_policy
  # set the identifier community allowed under (my_origin_identifier) set
  set community (64512:57014)
  done
end-policy
!
router static
  address-fam ipv4 u
    10.0.0.0/24 192.168.1.2 description TEST_CUSTOMER
  !
!
router bgp 64512
  address-fam ipv4
    network 10.0.0.0/24 route-policy origination_policy
  !
  neighbor-group ibgp-core
remote-as 64512
update-source Loopback0
address-fam ipv4 u route-policy next_hop_self out ! !

But the above attempt also fails, with the following message:

!!% Policy [next_hop_self] uses the 'protocol' attribute. There is no 'protocol' attribute at the bgp neighbor-out-dflt attach point.

 

Any ideas on what is the best "IOS XR-esque" way to address this?  Basically, I want to set next-hop to "self" only on the following routes:  (1) routes learned from eBGP neighbors attached to the IOS XR router; and (2) network statements for statically routed customers on the IOS XR router.   Other iBGP routes traversing through the box will need to preserve their next-hop.

 

1 Accepted Solution

Accepted Solutions

AARON WEINTRAUB
Level 1
Level 1

You make reference to "other ibgp routes traversing this router will need to preserve their next-hop".   But you've already said you want n-h-s on ebgp routes THIS router learns that will get sent into the ibgp domain as well as static routes that will also get sent into the ibgp domain.  So what other routes are left that this router will be originating into ibgp?  n-h-s is ignored for route-reflector clients so that won't get touched there, so what routes specifically do you want nh preserved on?

View solution in original post

3 Replies 3

AARON WEINTRAUB
Level 1
Level 1

You make reference to "other ibgp routes traversing this router will need to preserve their next-hop".   But you've already said you want n-h-s on ebgp routes THIS router learns that will get sent into the ibgp domain as well as static routes that will also get sent into the ibgp domain.  So what other routes are left that this router will be originating into ibgp?  n-h-s is ignored for route-reflector clients so that won't get touched there, so what routes specifically do you want nh preserved on?

Hey aaronw,

So, yea, I've labbed this out, and it looks like on IOS XR, next-hop self (whether it's done via RPL action or on ibgp neighbor config) is not enforced on iBGP routes learned from RR clients attached to _this_ router (unless enforce-modifications command is used, which we're not using).  This is the desired behavior I'm looking for, so as it turns out, there is nothing I need to do other than just setting next-hop wholesale in the route-policy.  

 

James

 

mostafaamahdy1
Level 1
Level 1

Hello ,

 

just add below command will force your modification : 

 

router bgp XXX
ibgp policy out enforce-modifications