In this document we will see basic BGP configuration on IOS XR. We will configure IPv4 IBGP and EBGP neighbors.
In below topology PE1 and PE2 is running Cisco IOS XR and CE1 is running Cisco IOS. We will be having IBGP neighborship between PE1 and PE2.PE2 and CE1 will have EBGP neighborship and we are advertising Loopback address of devices through BGP.IP address are preconfigured as shown in the diagram.
In IOS XR, BGP configure under “router bgp” process similar like in cisco IOS. There are some changes in the command structure of IOS XR than Cisco IOS but your entire fundamental remain same.
In IOS XR there is no concept of default address family. An address family must be explicitly configured under the BGP router configuration for the address family to be activated in BGP.
Similarly, an address family must be explicitly configured under a neighbor for the BGP session to be activated under that address family.
Let’s start with IBGP neighborship configuration between PE1 and PE2.BGP must be able to obtain a router identifier (for example, a configured loopback address).
Neighbor Spk AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down St/PfxRcd
10.1.1.1 0 1 38 38 4 0 0 00:34:57 1
10.2.2.2 0 2 43 43 4 0 0 00:02:22 0 !
You can see PE2 have formed EBGP neighborship with CE1 but not receiving any prefixes advertise by CE1 also not sending any to CE1.The reason behind this is, In IOS XR External BGP (eBGP) neighbors must have an inbound and outbound policy configured. If no policy is configured, no routes are accepted from the neighbor, nor are any routes advertised to it. This added security measure ensures that routes cannot accidentally be accepted or advertised in the case of a configuration omission error.
These neighbors will default to sending and/or receiving no routes and are marked with '!' in the output above. Use the "show bgp neighbor 10.2.2.2 | beg policy" command for details.
RP/0/0/CPU0:PE2#sh bgp neighbor 10.2.2.2 | in policy
Wed May 8 21:30:41.733 UTC
eBGP neighbor with no inbound or outbound policy; defaults to 'drop'
Instead of a route-map like IOS, IOS XR uses a Route Policy Language (RPL) – that is more powerful and easier than IOS. Let’s configure a very simple one RPL to pass everything and apply that to the EBGP neighbor:
RP/0/0/CPU0:PE2(config-bgp-nbr-af)#route-policy pass_all in
RP/0/0/CPU0:PE2(config-bgp-nbr-af)#route-policy pass_all out
Wed May 8 21:34:05.039 UTC
From below output you can see PE2 learned prefixes from CE1:
RP/0/0/CPU0:PE1#sh bgp | beg Net
Wed May 8 21:39:13.638 UTC
Network Next Hop Metric LocPrf Weight Path
* i172.16.1.1/32 10.2.2.2 0 100 0 2 i
*> 192.168.1.1/32 0.0.0.0 0 32768 i
*>i192.168.1.2/32 10.1.1.2 0 100 0 i
Processed 3 prefixes, 3 paths
PE2 learn prefix 172.16.1.1/32 by CE1 will advertise to PE1 with next-hop IP address of CE1 i.e.10.2.2.2. As we are not using any underline IGP, PE1 will not have 10.2.2.0/30 reachability, hence PE2 will not put this prefix in its routing table so we need to configure “next-hop-self” command on PE2 for all advertise prefixes to PE1.