OcNOS-SP : Layer 3 Guide : Layer 3 Unicast Configuration Guide : BGP : BGP Distance
BGP Distance
Administrative distance in BGP can be configured for a specific address family.
Topology
Figure 1-28: Administrative Distance for IPv4 BGP
R1
 
#configure terminal
Enter configure mode.
(config)#interface lo
Enter loopback interface mode.
(config-if)#ip address 150.1.1.1/24 secondary
Specify IP address for the interface.
(config-if)#exit
Exit loopback interface mode.
(config)#router bgp 100
Assign the ASN value (100) to the router.
(config-router)#neighbor 1.1.1.2 remote-as 100
Specify the neighbor's IP address and ASN value.
(config-router)#address-family ipv4 unicast
Enter address-family ipv4 unicast mode
(config-router-af)#neighbor 1.1.1.2 activate
Activate the neighbor in address family mode
(config-router-af)#network 150.1.1.0/24
Specify the network to be advertised by the BGP routing process.
(config-router-af)#exit-address-family
Exit address-family ipv4 unicast mode
(config-router)#commit
Commit the candidate configuration to the running configuration.
R2
 
#configure terminal
Enter configure mode.
(config)#router bgp 100
Assign the ASN value (100) to the router.
(config-router)#neighbor 2.2.2.2 remote-as 200
Specify the neighbor's IP address and ASN value.
(config-router)#neighbor 1.1.1.1 remote-as 100
Specify the neighbor's IP address and the ASN value of another neighbor.
(config-router)# address-family ipv4 unicast
Enter address-family ipv4 unicast mode
(config-router-af)#distance bgp 12 13 120
Configure the administrative distance for external, internal, and local routes received.
(config-router-af)#aggregate-address 150.1.0.0/16 summary-only
Configure a non-AS-set aggregate route on R2. The local distance is applied to this route.
(config-router-af)#neighbor 1.1.1.1 activate
Activate the neighbor in address family mode
(config-router-af)#neighbor 2.2.2.2 activate
Activate the neighbor in address family mode
(config-router-af)#exit-address-family
Exit address-family ipv4 unicast mode
(config-router)#commit
Commit the candidate configuration to the running configuration.
R3
 
#configure terminal
Enter configure mode.
(config)#interface lo
Enter loopback interface mode.
(config-if)#ip address 88.88.1.2/32 secondary
Specify IP address for the interface.
(config-if)#exit
Exit loopback interface mode.
(config)#router bgp 200
Assign the ASN value (200) to the router.
(config-router)#neighbor 2.2.2.1 remote-as 100
Specify the neighbor's IP address and ASN value.
(config-router)#address-family ipv4 unicast
Enter address-family ipv4 unicast mode
(config-router-af)#network 88.88.1.2/32
Specify the network to be advertised by the BGP routing process.
(config-router-af)#neighbor 2.2.2.1 activate
Activate the neighbor in address family mode
(config-router-af)#exit-address-family
Exitr address-family ipv4 unicast mode
(config-router)#commit
Commit the candidate configuration to the running configuration.
Validation
#show ip bgp summary
BGP router identifier 192.168.56.102, local AS number 100
BGP table version is 7
2 BGP AS-PATH entries
0 BGP community entries
 
Neighbor V AS MsgRcv MsgSen TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1 4 100 8 9 7 0 0 00:02:39 1
2.2.2.2 4 200 4 4 7 0 0 00:00:38 1
 
Total number of neighbors 2
 
Total number of Established sessions 2
#show ip bgp neighbors
BGP neighbor is 1.1.1.1, remote AS 100, local AS 100, internal link
BGP version 4, local router ID 192.168.52.3, remote router ID 150.1.1.1
BGP state = Established, up for 00:02:54
Last read 00:02:54, 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 8 messages, 0 notifications, 0 in queue
Sent 9 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 5 seconds
For address family: IPv4 Unicast
BGP table version 7, neighbor version 7
Index 2, Offset 0, Mask 0x4
Community attribute sent to this neighbor (both)
1 accepted prefixes
0 announced prefixes
 
Connections established 1; dropped 0
Local host: 1.1.1.2, Local port: 49238
Foreign host: 1.1.1.1, Foreign port: 179
Nexthop: 1.1.1.2
Nexthop global: fe80::a00:27ff:fea6:6e3
Nexthop local: ::
BGP connection: non shared network
 
BGP neighbor is 2.2.2.2, remote AS 200, local AS 100, external link
BGP version 4, remote router ID 88.88.1.2
local router ID 192.168.52.3
BGP state = Established, up for 00:00:53
Last read 00:00:53, 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 4 messages, 0 notifications, 0 in queue
Sent 4 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 7, neighbor version 7
Index 1, Offset 0, Mask 0x2
Community attribute sent to this neighbor (both)
1 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: 50072
Nexthop: 2.2.2.1
Nexthop global: fe80::a00:27ff:fe77:264e
Nexthop local: ::
BGP connection: non shared network
 
#show ip route database bgp
IP Route Table for VRF "default"
B *> 88.88.1.2/32 [12/0] via 2.2.2.2, eth2, 00:01:19
B *> 150.1.0.0/16 [120/0] is a summary, Null, 00:02:49
B *> 150.1.1.0/24 [200/0] via 1.1.1.1, eth1, 00:02:49
 
Gateway of last resort is not set
#show ip route database
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
> - selected route, * - FIB route, p - stale info
 
IP Route Table for VRF "default"
C *> 1.1.1.0/24 is directly connected, eth1, 00:13:39
C *> 2.2.2.0/24 is directly connected, eth3, 00:13:04
B *> 88.88.1.2/32 [12/0] via 2.2.2.2, eth3, 00:06:37
C *> 127.0.0.0/8 is directly connected, lo, 00:22:15
B *> 150.1.0.0/16 [120/0] is a summary, Null, 00:11:19
B *> 150.1.1.0/24 [200/0] via 1.1.1.1, eth1, 00:11:19
C *> 192.168.52.0/24 is directly connected, eth0, 00:22:13
 
Gateway of last resort is not set
 
#show ip route
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 "default"
C 1.1.1.0/24 is directly connected, eth1, 00:17:38
C 2.2.2.0/24 is directly connected, eth3, 00:17:03
B 88.88.1.2/32 [12/0] via 2.2.2.2, eth3, 00:10:36
C 127.0.0.0/8 is directly connected, lo, 00:26:14
B 150.1.0.0/16 [120/0] is a summary, Null, 00:15:18
B 150.1.1.0/24 [200/0] via 1.1.1.1, eth1, 00:15:18
C 192.168.52.0/24 is directly connected, eth0, 00:26:12
 
Gateway of last resort is not set
 
#show ip bgp
BGP table version is 4, local router ID is 192.168.52.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
l - labeled, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
Network Next Hop Metric LocPrf Weight Path
*> 88.88.1.2/32 2.2.2.2 0 100 0 200 i
*> 150.1.0.0 0.0.0.0 0 100 32768 i
s>i 150.1.1.0/24 1.1.1.1 0 100 0 i
 
Total number of prefixes 3
 
Last modified date: 10/16/2023