Вы находитесь на странице: 1из 6

BGP Basic Configuration On IOS XR - IBGP And EBGP

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.

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.

Lets 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 lets 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. Lets 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 lets 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#

Вам также может понравиться