[c-nsp] IOS XR BGP default route - prepending AS

Brian Knight brian.t.knight at gmail.com
Tue Apr 26 18:42:23 EDT 2016


So, I did a quick lab test, and it turns out that:

* to influence the default route attributes, one must use a route-policy
attached to the default-originate statement (as Brad mentioned)

* the output of "show bgp neighbor x.x.x.x advertise" does NOT show the
prepended AS path, but

* the receiving router DOES receive the prepended path correctly.

Lab config follows for those interested.  (Routers are running IOS XRv
6.0.0 on VIRL 1.1.1.)

I'll be turning up those BGP sessions again soon, and I'll ask the remote
side if they see the path prepending.

Thanks all for your replies!

-Brian Knight


iosxr-1
-----
RP/0/0/CPU0:ios#show run
Fri Apr 22 04:56:23.042 UTC
Building configuration...
!! IOS XR Configuration 6.0.0
!! Last configuration change at Fri Apr 22 04:53:56 2016 by cisco
!
interface Loopback0
 ipv4 address 53.53.53.53 255.255.255.255
!
interface MgmtEth0/0/CPU0/0
 shutdown
!
interface GigabitEthernet0/0/0/0
!
interface GigabitEthernet0/0/0/0.101
 ipv4 address 192.168.0.1 255.255.255.252
 encapsulation dot1q 101
!
interface GigabitEthernet0/0/0/1
 shutdown
!
prefix-set IPV4-DEFAULT
  0.0.0.0/0
end-set
!
community-set BGP-SITECODE
  53828:1003
end-set
!
route-policy IPV4-DEFAULT-DENY
  if destination in IPV4-DEFAULT then
    drop
  else
    pass
  endif
end-policy
!
route-policy IPV4-BGP-NNI-DIA-IN($localpref)
  apply IPV4-DEFAULT-DENY
  # For primary NNIs, $localpref = 400
  # For backup NNIs, $localpref = 350
  #
  set local-preference $localpref
  set community BGP-SITECODE additive
end-policy
!
route-policy IPV4-BGP-NNI-DIA-OUT($prepend)
  # For primary NNIs, $prepend = 0
  # For backup NNIs, $prepend = 2
  #
  # Announce only default route
  if destination in (0.0.0.0/0) then
    prepend as-path 53828 $prepend
    set community BGP-SITECODE
  else
    drop
  endif
end-policy
!
route-policy IPV4-BGP-NNI-DIA-BACKUP-IN
  apply IPV4-BGP-NNI-DIA-IN(350)
end-policy
!
route-policy IPV4-BGP-NNI-DIA-BACKUP-OUT
  apply IPV4-BGP-NNI-DIA-OUT(2)
end-policy
!
route-policy IPV4-BGP-NNI-DIA-PRIMARY-IN
  apply IPV4-BGP-NNI-DIA-IN(400)
end-policy
!
route-policy IPV4-BGP-NNI-DIA-PRIMARY-OUT
  apply IPV4-BGP-NNI-DIA-OUT(0)
end-policy
!
route-policy IPV4-BGP-NNI-DIA-DEFAULT-BACKUP-OUT
  prepend as-path 53828 2
  set community BGP-SITECODE
end-policy
!
route-policy IPV4-BGP-NNI-DIA-DEFAULT-PRIMARY-OUT
  set community BGP-SITECODE
end-policy
!
router bgp 53828
 bgp router-id 53.53.53.53
 address-family ipv4 unicast
  redistribute connected
  redistribute static
 !
 neighbor 192.168.0.2
  remote-as 2828
  address-family ipv4 unicast
   send-community-ebgp
   route-policy IPV4-BGP-NNI-DIA-BACKUP-IN in
   route-policy IPV4-BGP-NNI-DIA-BACKUP-OUT out
   send-extended-community-ebgp
   default-originate route-policy IPV4-BGP-NNI-DIA-DEFAULT-BACKUP-OUT
   soft-reconfiguration inbound
  !
 !
!
end

RP/0/0/CPU0:ios#sh bgp ipv4 u nei 192.168.0.2 advertised-routes
Fri Apr 22 04:56:26.072 UTC
Network            Next Hop        From            AS Path
0.0.0.0/0          0.0.0.0         Local           i

Processed 1 prefixes, 1 paths
RP/0/0/CPU0:ios#
---

iosxr-2
----
RP/0/0/CPU0:ios#show run
Fri Apr 22 04:57:57.445 UTC
Building configuration...
!! IOS XR Configuration 6.0.0
!! Last configuration change at Fri Apr 22 04:50:19 2016 by cisco
!
vrf VPN
 address-family ipv4 unicast
  import route-target
   2828:1
  !
  export route-target
   2828:1
  !
 !
!
interface Loopback0
 ipv4 address 28.28.28.28 255.255.255.255
!
interface MgmtEth0/0/CPU0/0
 shutdown
!
interface GigabitEthernet0/0/0/0
!
interface GigabitEthernet0/0/0/0.101
 vrf VPN
 ipv4 address 192.168.0.2 255.255.255.252
 encapsulation dot1q 101
!
interface GigabitEthernet0/0/0/1
 vrf VPN
 ipv4 address 172.16.0.1 255.255.255.252
!
route-policy PERMIT-ALL
  pass
end-policy
!
router static
 vrf VPN
  address-family ipv4 unicast
   172.17.0.0/24 172.16.0.1
  !
 !
!
router bgp 2828
 bgp router-id 28.28.28.28
 address-family ipv4 unicast
  redistribute connected
  redistribute static
 !
 address-family vpnv4 unicast
 !
 vrf VPN
  rd 2828:1
  address-family ipv4 unicast
   redistribute connected
   redistribute static
  !
  neighbor 192.168.0.1
   remote-as 53828
   address-family ipv4 unicast
    send-community-ebgp
    route-policy PERMIT-ALL in
    route-policy PERMIT-ALL out
    send-extended-community-ebgp
    soft-reconfiguration inbound
   !
  !
 !
!
end

RP/0/0/CPU0:ios#sh bgp vrf VPN
Fri Apr 22 04:58:02.645 UTC
BGP VRF VPN, state: Active
BGP Route Distinguisher: 2828:1
VRF ID: 0x60000006
BGP router identifier 28.28.28.28, local AS number 2828
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000015   RD version: 7
BGP main routing table version 7
BGP NSR Initial initsync version 3 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 2828:1 (default for vrf VPN)
*> 0.0.0.0/0          192.168.0.1                            0 53828 53828
53828 i
*> 172.16.0.0/30      0.0.0.0                  0         32768 ?
*> 192.168.0.0/30     0.0.0.0                  0         32768 ?

Processed 3 prefixes, 3 paths
RP/0/0/CPU0:ios#sh bgp vrf VPN ipv4 u nei 192.168.0.1 routes
Fri Apr 22 04:58:05.415 UTC
BGP VRF VPN, state: Active
BGP Route Distinguisher: 2828:1
VRF ID: 0x60000006
BGP router identifier 28.28.28.28, local AS number 2828
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000015   RD version: 7
BGP main routing table version 7
BGP NSR Initial initsync version 3 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 2828:1 (default for vrf VPN)
*> 0.0.0.0/0          192.168.0.1                            0 53828 53828
53828 i

Processed 1 prefixes, 1 paths
RP/0/0/CPU0:ios#


More information about the cisco-nsp mailing list