OcNOS DC : Layer 3 Guide : VRF Lite Command Reference : BGP Configuration
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: This chapter covers BGP configuration in non-default VR and non-default VRF.
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.
(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
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)#neighbour 2.2.2.1 remote-as 200
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
Validation
Verify the routing table in 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:14
Last read 00:00:14, hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
Route refresh: advertised and received (old and new)
Address family IPv4 Unicast: advertised and received
Received 2 messages, 0 notifications, 0 in queue
Sent 3 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
BGP table version 1, neighbor version 1
Index 1, Offset 0, Mask 0x2
Community attribute sent to this neighbor (standard)
0 accepted prefixes
0 announced prefixes
 
Connections established 1; dropped 0
Local host: 2.2.2.1, Local port: 179
Foreign host: 2.2.2.2, Foreign port: 36200
Nexthop: 2.2.2.1
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
 
Verify the routing table in R2
#show ip bgp neighbors
BBGP 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:08:09
Last read 00:00:09, hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
Route refresh: advertised and received (old and new)
Address family IPv4 Unicast: advertised and received
Received 18 messages, 0 notifications, 0 in queue
Sent 18 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
BGP table version 1, neighbor version 1
Index 1, Offset 0, Mask 0x2
Community attribute sent to this neighbor (standard)
0 accepted prefixes
0 announced prefixes
 
Connections established 1; dropped 0
Local host: 2.2.2.2, Local port: 36200
Foreign host: 2.2.2.1, Foreign port: 179
Nexthop: 2.2.2.2
Nexthop global: ::
Nexthop local: ::
BGP connection: non shared network
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:20:40
 
Gateway of last resort is not set
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:53
 
Gateway of last resort is not set