cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
38204
Views
5
Helpful
4
Comments
ashirkar
Level 7
Level 7

 

Introduction:

In this document we will see basic BGP configuration on IOS XR. We will configure IPv4 IBGP and EBGP neighbors.

Configuration Example:

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.

 

BGP_IOS_XR_BASE.jpg

 

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).

PE1:

RP/0/0/CPU0:PE1(config)#router bgp 1

RP/0/0/CPU0:PE1(config-bgp)#bgp router-id 10.1.1.1

RP/0/0/CPU0:PE1(config-bgp)#address-family ipv4 unicast

RP/0/0/CPU0:PE1(config-bgp-af)#exit

RP/0/0/CPU0:PE1(config-bgp)#nei 10.1.1.2

RP/0/0/CPU0:PE1(config-bgp-nbr)#remote-as 1

RP/0/0/CPU0:PE1(config-bgp-nbr)#address-family ipv4 unicast

RP/0/0/CPU0:PE1(config-bgp-nbr-af)#commit

Wed May 8 19:53:51.101 UTC

RP/0/0/CPU0:PE1(config-bgp-nbr-af)#end

RP/0/0/CPU0:PE1#

 

PE2:

RP/0/0/CPU0:PE2(config)#router bgp 1

RP/0/0/CPU0:PE2(config-bgp)#bgp router-id 10.1.1.2

RP/0/0/CPU0:PE2(config-bgp)#address-family ipv4 unicast

RP/0/0/CPU0:PE2(config-bgp-af)#exit

RP/0/0/CPU0:PE2(config-bgp)#neighbor 10.1.1.1

RP/0/0/CPU0:PE2(config-bgp-nbr)#remote-as 1

RP/0/0/CPU0:PE2(config-bgp-nbr)#address-family ipv4 unicast

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#commit

Wed May 8 19:53:29.583 UTC

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#end

 

Now to verify the BGP configuration on IOS XR you have to use "sh run router bgp" command.

RP/0/0/CPU0:PE1#sh run router bgp

Wed May 8 19:59:09.089 UTC

router bgp 1

address-family ipv4 unicast

!

neighbor 10.1.1.2

remote-as 1

address-family ipv4 unicast

!

!

!

 

RP/0/0/CPU0:PE1#

 

RP/0/0/CPU0:PE2#sh run router bgp

Wed May 8 20:00:06.285 UTC

router bgp 1

address-family ipv4 unicast

!

neighbor 10.1.1.1

remote-as 1

address-family ipv4 unicast

!

!

!

 

RP/0/0/CPU0:PE2#

 

Verifying BGP neighborship on PE1:

RP/0/0/CPU0:PE1#sh bgp ipv4 unicast summary | beg Nei

Wed May 8 20:30:28.280 UTC

Neighbor       Spk   AS MsgRcvd MsgSent   TblVer InQ OutQ Up/Down St/PfxRcd

10.1.1.2         0     1       4     40       3   0   0 00:01:23         0

 

Now let’s advertise loopback address of PEs in BGP. In IOS XR you have to configure "Network" command under address-family as shown below.

RP/0/0/CPU0:PE1(config-if)#router bgp 1

RP/0/0/CPU0:PE1(config-bgp)#address-family ipv4 unicast

RP/0/0/CPU0:PE1(config-bgp-af)#net 192.168.1.1/32

RP/0/0/CPU0:PE1(config-bgp-af)#commit

Wed May 8 20:11:18.169 UTC

RP/0/0/CPU0:PE1(config-bgp-af)#end

RP/0/0/CPU0:PE1#

 

RP/0/0/CPU0:PE2(config)#router bgp 1

RP/0/0/CPU0:PE2(config-bgp)#address-family ipv4 unicast

RP/0/0/CPU0:PE2(config-bgp-af)#network 192.168.1.2/32

RP/0/0/CPU0:PE2(config-bgp-af)#commit

Wed May 8 20:32:54.981 UTC

RP/0/0/CPU0:PE2(config-bgp-af)#end

RP/0/0/CPU0:PE2#

 

Verify Advertise prefixes on PE1 and PE2:

RP/0/0/CPU0:PE1#sh bgp | beg Net

Wed May 8 20:33:30.668 UTC

   Network           Next Hop           Metric LocPrf Weight Path

*> 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 2 prefixes, 2 paths

RP/0/0/CPU0:PE1#

 

RP/0/0/CPU0:PE2#sh bgp | beg Net

Wed May 8 20:35:59.838 UTC

             i - internal, r RIB-failure, S stale, N Nexthop-discard

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network           Next Hop           Metric LocPrf Weight Path

*>i192.168.1.1/32     10.1.1.1               0   100     0   i

*> 192.168.1.2/32     0.0.0.0                0         32768 i

 

Processed 2 prefixes, 2 paths

RP/0/0/CPU0:PE2#

 

Verify routing table of PE1 and loopback reachability:

 

RP/0/0/CPU0:PE1#sh route bgp

Wed May 8 20:36:42.565 UTC

 

B   192.168.1.2/32 [200/0] via 10.1.1.2, 00:03:35

RP/0/0/CPU0:PE1#

 

 

RP/0/0/CPU0:PE1#ping 192.168.1.2 so 192.168.1.1

Wed May 8 20:37:13.562 UTC

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 9/13/19 ms

RP/0/0/CPU0:PE1#

 

Now we will configure EBGP neighborship between PE2 and CE1, commands are same as configure before.

PE2:

RP/0/0/CPU0:PE2(config)#router bgp 1

RP/0/0/CPU0:PE2(config-bgp)#nei 10.2.2.2

RP/0/0/CPU0:PE2(config-bgp-nbr)#remote-as 2

RP/0/0/CPU0:PE2(config-bgp-nbr)#address-family ipv4 unicast

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#commit

Wed May 8 20:56:06.685 UTC

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#end

RP/0/0/CPU0:PE2#

 

CE1 configuration:

conf t

router bgp 2

nei 10.2.2.1 remote-as 1

net 172.16.1.1 mask 255.255.255.255

end

 

Now let's verify EBGP neighborship:

RP/0/0/CPU0:PE2#sh bgp sum | beg Nei

Wed May 8 21:04:50.129 UTC

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'

RP/0/0/CPU0:PE2#

 

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#conf t

Wed May 8 21:31:45.759 UTC

RP/0/0/CPU0:PE2(config)#route-policy pass_all

RP/0/0/CPU0:PE2(config-rpl)#pass

RP/0/0/CPU0:PE2(config-rpl)#exit

RP/0/0/CPU0:PE2(config)#router bgp 1

RP/0/0/CPU0:PE2(config-bgp)#nei 10.2.2.2

RP/0/0/CPU0:PE2(config-bgp-nbr)#address-family ipv4 unicast

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

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#commit

Wed May 8 21:34:05.039 UTC

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#end

RP/0/0/CPU0:PE2#

 

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

RP/0/0/CPU0:PE1#

 

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.

 

RP/0/0/CPU0:PE2(config)#router bgp 1

RP/0/0/CPU0:PE2(config-bgp)#nei 10.1.1.1

RP/0/0/CPU0:PE2(config-bgp-nbr)#address-family ipv4 unicast

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#next-hop-self

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#commit

Wed May 8 21:40:23.983 UTC

RP/0/0/CPU0:PE2(config-bgp-nbr-af)#end

RP/0/0/CPU0:PE2#

 

Now let’s verify end to end reachability between PE1 and CE1:

RP/0/0/CPU0:PE1#sh bgp | beg Net

Wed May 8 21:40:25.033 UTC

   Network           Next Hop           Metric LocPrf Weight Path

*>i172.16.1.1/32     10.1.1.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

RP/0/0/CPU0:PE1#ping 172.16.1.1 so 192.168.1.1

Wed May 8 21:40:29.292 UTC

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 19/21/29 ms

RP/0/0/CPU0:PE1#

 

Classic IOS and IOS XR command comparison:

Classic  IOSIOS XR                        

Conf t

router bgp 65000

no bgp default ipv4-unicast

nei 192.168.1.1 remote-as 65000...(IBGP peer)

nei 192.168.1.1 update-source lo0

nei 10.1.1.1 remote-as 65001...(EBGP peer)

nei 10.1.1.1 ebgp-multihop

address-family ipv4 unicast

nei 192.168.1.1 activate

nei 10.1.1.1 activate

conf t

router bgp  65000

address-family ipv4 unicast..(Activate addres-family)

nei 192.168.1.1

remote-as 65000

update-so lo0

address-family ipv4 unicast

exit

nei 10.1.1.1

remote-as 65001

ebgp-multihop 

address-family ipv4 unicast

commit

 

Related Information:

Implementing BGP on Cisco ASR 9000 Series Router

Comments
tomislavcer
Level 1
Level 1

Hy, is there some IOS XR equivalent of following :

vrf data

rd 10000:100

route-target both 10000:100

bgp next-hop loopback100

where loopback 100 is used for MPLS TE traffic routing (per VRF MPLS TE). 

In IOS XR there is no possibility to migrate configuration in similar way, so I would like to know is there some by-the-book proposed solution for that ?

thank you

pganesha
Cisco Employee
Cisco Employee

thanks!

pablojml87
Level 1
Level 1

Hello Ashirkar,

 

Thanks for your post, I wonder if you could help me, I'm trying to configure BGP in GNS3 with the demo IOS-XR, this is my config:

 

R1

interface Loopback0
 ipv4 address 10.7.1.1 255.255.255.0
 ipv6 address 2001:db8:10:7:1::1/128


interface GigabitEthernet0/0/0/0
 ipv4 address 192.168.178.70 255.255.255.0
 ipv6 address 2001:db8:192:168:178::70/64

route-policy PASS
pass
exit

router bgp 65001
address-family ipv4 unicast
network 10.7.1.0/24

 neighbor 10.8.1.1
  remote-as 65001
  update-source Loopback0
  address-family ipv4 unicast
   route-policy PASS in
   route-policy PASS out
  !
  address-family ipv6 unicast
  !
 !
 neighbor 2001:db8:10:8:1::1
  remote-as 65001
  update-source Loopback0
  address-family ipv6 unicast
   route-policy PASS in
   route-policy PASS out



***************************************************************
R2
interface Loopback0
 ipv4 address 10.8.1.1 255.255.255.0
 ipv6 address 2001:db8:10:8:1::1/128


interface GigabitEthernet0/0/0/0
 ipv4 address 192.168.178.80 255.255.255.0
 ipv6 address 2001:db8:192:168:178::80/64

route-policy PASS
pass
exit

router bgp 65001
 address-family ipv4 unicast
  network 10.8.1.0/24
 !
 address-family ipv6 unicast
 !
 neighbor 10.7.1.1
  remote-as 65001
  update-source Loopback0
  address-family ipv4 unicast
   route-policy PASS in
   route-policy PASS out
  !
 !
 neighbor 2001:db8:10:7:1::1
  remote-as 65001
  update-source Loopback0
  address-family ipv6 unicast
   route-policy PASS in
   route-policy PASS out

 

**********************************

It is showing idle on "sh bgp sum", I also ran "debug bgp all" and nothing shows up, also "debug icmp ipv4" and nothing shows up either when pinging.

 

Ping works, however when I shutdown an interface the other one remains down, but ping drops.

 

At this stage I believe it's something with my GNS3, however I'd like to know if the above config would work.

 

********************************

Edit: My bad, my routers were not able to reach the loopbacks, I enabled OSPF between the two and BGP worked.

 

However, BGP did not seem to work when creating static routes. Any ideas why?

jigarrg
Level 1
Level 1

Hi,

 

I had a same problem. In my case I had IOS and IOS XR connected directly. I was going for hours where I had OSPF neighborship formed but it was not forming BGP connection. After a while rubbing my head off. I entered command disable-connected-check on IOS and ignore-connected-check on IOS XR and boom it formed the BGP connection. I hope this helps. 

 

ebgp-multihop - Allow EBGP neighbors not on directly connected networks

ignore-connected-check - Bypass the directly connected nexthop check for single-hop eBGP peering.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: