BGP Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

PDF

Enable BGP routing

Want to summarize with AI?

Log in

Overview

Provides instructions for enabling BGP routing, guiding users through the necessary steps to activate and verify BGP functionality within network devices.

Enable BGP routing and establish BGP neighbor relationships to control route exchange in your network.

Configure BGP on your router to participate in inter-domain routing. You must define route policies and associate address families with each neighbor to control which routes are exchanged. This is essential for both internal BGP (iBGP) and eBGP peering.

Before you begin

  • Ensure your BGP router has a router identifier, such as a configured loopback address.

  • Configure at least one address family within the BGP router configuration, and explicitly configure the same address family under each BGP neighbor configuration.

  • For an external BGP (eBGP) neighbor:

    • Configure both inbound and outbound route policies on the neighbor using theroute-policy command, or

    • Allow route exchange for all eBGP neighbors by using the bgp unsafe-ebgp-policy command.

  • If peering with eBGP neighbors that are not directly connected:

    • Note that, by default, BGP checks for direct connectivity and does not establish a connection if peers are not directly connected.

    • Use the ignore-connected-check command to enable peering between loopback interfaces of non-directly connected routers. Set the TTL value to 1 when using this command.

    • Configure the egp-multihop command for eBGP peers separated by intermediate routers, setting the TTL value to at least the number of hops between peers (for example, use TTL 3 for two intermediate hops).

Procedure

1.

Define a route policy to control routing behavior.

Example:

Router# configure
Router(config)# route-policy drop-as-1234
Router(config-rpl)# if as-path passes-through '1234' then 
Router(config-rpl)# apply check-communities 
Router(config-rpl)# else
Router(config-rpl)# pass 
Router(config-rpl)# endif
Router(config-rpl)# end-policy
2.

Enter BGP configuration mode. Configure the router ID, and specify the address family to define the type of routes BGP will handle, such as IPv4 or IPv6 unicast.

Example:

Router# configure
Router(config)# router bgp 120
Router(config-bgp)# bgp router-id 192.168.70.24
Router(config-bgp)# address-family ipv4 unicast
Router(config-bgp-af)# exit
3.

Configure a BGP neighbor with an IP address, assign a remote AS number, and associate an address family. Optionally, configure route policies to control which routes are exchanged.

Example:


Router(config-bgp)# neighbor 172.168.40.24
Router(config-bgp-nbr)# remote-as 2002
Router(config-bgp-nbr)# address-family ipv4 unicast
Routing(config-bgp-nbr-af)# route-policy drop-as-1234 in
Routing(config-bgp-nbr-af)# commit

BGP routing is enabled. The router can now establish BGP neighbor relationships and exchange routing information as configured.

Example

Sample configuration to enable BGP:

route-policy pass-all 
  pass
end-policy

route-policy set_next_hop_agg_v4 
  set next-hop 10.0.0.1
end-policy

route-policy set_next_hop_static_v4 
  if (destination in static) then
    set next-hop 10.1.0.1 
  else
    drop 
  endif
end-policy

route-policy set_next_hop_agg_v6 
  set next-hop 2001:DB8::121
end-policy

route-policy set_next_hop_static_v6 
  if (destination in static) then
    set next-hop 2001:DB8::201 else
  drop 
  endif
end-policy

router bgp 65000
bgp fast-external-fallover disable 
bgp confederation peers 65001 65002
bgp confederation identifier 1 
bgp router-id 10.1.1.1
address-family ipv4 unicast 
  aggregate-address 10.2.0.0/24 route-policy 
set_next_hop_agg_v4 
  aggregate-address 10.3.0.0/24
  redistribute static route-policy 
set_next_hop_static_v4
  address-family ipv6 unicast
  aggregate-address 2001:DB8:2::/32 route-policy 
set_next_hop_agg_v6 
  aggregate-address 2001:DB8:3::/32 
  redistribute static route-policy 
set_next_hop_static_v6
  neighbor 10.0.101.60
    remote-as 65000
    address-family ipv4 unicast
  neighbor 10.0.101.61
    remote-as 65000
    address-family ipv4 unicast
  neighbor 10.0.101.62
    remote-as 3
    address-family ipv4 unicast 
      route-policy pass-all in 
      route-policy pass-all out
  neighbor 10.0.101.64
    remote-as 5
    update-source Loopback0 
    address-family ipv4 unicast
      route-policy pass-all in 
      route-policy pass-all out

What to do next

Verify BGP neighbor relationships and route exchange using the show bgp summary command.