BGP Configuration
Overview
Border Gateway Protocol (BGP) makes core routing decisions on the Internet using a table of IP networks or “prefixes” which designate network reachability among autonomous systems (AS). BGP is a path vector protocol or a variant of a distance-vector routing protocol. BGP does not involve traditional Interior Gateway Protocol (IGP) metrics, but routing decisions are made based on path, network policies, and/or rule sets. For this reason, it is more appropriately termed a reachability protocol rather than routing protocol.
Note: Enabling dynamic capability on the specific BGP peer will prevent BGP session to reset.
Topology
BGP topology for VRF
Configuration
R1
#con t | Enter configuration mode. |
(config)#ip vrf vrf1 | Create vrf1 |
(config-vrf)#rd 800:1 | Specify the route distinguisher in the VRF |
(config-vrf)#route-target import 800:1 | Specify the import route target |
(config-vrf)#route-target export 800:1 | Specify the export route target |
(config-vrf)#exit | Exit VRF mode |
(config)#router bgp 200 | Enter the bgp configuration mode |
(config-router)#address-family ipv4 vrf vrf1 | Enter address family mode for vrf1 |
(config-router-af)#neighbor 2.2.2.2 remote-as 100 | Specify the BGP neighbor and remote-AS. |
(counter-router-af)#neighbor 2.2.2.2 activate | Activate neighbor in the address family |
(config-router-af)#exit | Exit address family mode. |
(config-router)#ex | Exit router mode |
(config)#interface eth1 | Enter interface mode |
(config-if)#ip vrf forwarding vrf1 | Associate the interface to vrf1 |
(config-if)#ip address 2.2.2.1/24 | Configure the IP address 2.2.2.1 to eth1 |
(config-if)#commit | Commit the candidate configuration to the running configuration |
(config-if)#exit | Exit interface mode |
R2
#configure terminal | Enter configure mode. |
(config)#ip vrf vrf1 | Create vrf1 |
(config-vrf)#rd 800:1 | Specify the route distinguisher in the VRF |
(config-vrf)#route-target import 800:1 | Specify the import route target |
(config-vrf)#route-target export 800:1 | Specify the export route target |
(config-vrf)#exit | Exit vrf mode |
(config)#router bgp 100 | Enter router mode. |
(config-router)#address-family ipv4 vrf vrf1 | Enter address family mode for vrf1 |
(config-router-af)#neighbor 2.2.2.1 remote-as 200 | Specify the BGP neighbor and remote-as. |
(counter-router-af)# neighbor 2.2.2.1 activate | Specify the BGP neighbor and remote-AS. |
(config-router-af)#exit | Exit address family mode. |
(config-router)#ex | Exit router mode |
(config)#interface eth1 | Enter interface mode |
(config-if)#ip vrf forwarding vrf1 | Associate the interface to vrf1 |
(config-if)#ip address 2.2.2.2/24 | Configure the IP address 2.2.2.1 to eth1 |
(config-if)#commit | Commit the candidate configuration to the running configuration |
(config-if)#exit | Exit interface mode |
Validation
Verify the routing table in R1:
R1#show ip bgp neighbors
BGP neighbor is 2.2.2.2, vrf vrf1, remote AS 100, local AS 200, external link
BGP version 4, local router ID 2.2.2.1, remote router ID 2.2.2.2
BGP state = Established, up for 00:00:07
Last read 00:00:07, hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
Route refresh: advertised and received (old and new)
Received 4 messages, 1 notifications, 0 in queue
Sent 5 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
Connections established 2; dropped 1
Local host: 2.2.2.1, Local port: 49722
Foreign host: 2.2.2.2, Foreign port: 179
Nexthop: 2.2.2.1
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
Last Reset: 00:00:12, due to BGP Notification received
Notification Error Message: (Cease/Other Configuration Change.)
Verify the routing table in R2:
R2#show ip bgp neighbors
BGP neighbor is 2.2.2.1, vrf vrf1, remote AS 200, local AS 100, external link
BGP version 4, local router ID 2.2.2.2, remote router ID 2.2.2.1
BGP state = Established, up for 00:02:36
Last read 00:00:08, hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
Route refresh: advertised and received (old and new)
Received 10 messages, 0 notifications, 0 in queue
Sent 9 messages, 1 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
Connections established 2; dropped 1
Local host: 2.2.2.2, Local port: 179
Foreign host: 2.2.2.1, Foreign port: 49722
Nexthop: 2.2.2.2
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
Last Reset: 00:02:41, due to Configuration Change (Cease Notification sent)
Notification Error Message: (Cease/Other Configuration Change.)
R1
R1#show ip route vrf vrf1
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
IP Route Table for VRF "vrf1"
C 2.2.2.0/24 is directly connected, eth1, 00:04:03
Gateway of last resort is not set
R2
R2#show ip route vrf vrf1
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
IP Route Table for VRF "vrf1"
C 2.2.2.0/24 is directly connected, eth1, 00:14:44
Gateway of last resort is not set
Verify BGP Adjacency
Use the following show commands to verify the BGP adjacency:
show ip bgp neighbor