Media BGP Lab¶
History
The Border Gateway Protocol (BGP) makes routing decisions based on paths (protocol is classified as a path vector) and is widely used in the backbone of the internet to redistribute information.
Info
This lab has been limited to the following devices: s1-Spine1, s1-Spine2, s1-Leaf1, s1-Leaf4, s1-Host1, and s1-Host2. Additional devices on this topology are out of scope for this lab.
Preparing The Lab¶
- Log into the LabAccess jumpserver:
- Type
labs
at the Main Menu prompt. This will bring up additional lab menu selections. - Type
media-labs
at this prompt to open the media lab section. - Type
media-bgp
at this prompt and wait for the process to run. - The script will configure the topology with the exception of s1-Leaf4. The main task is to configure this device so there is connectivity between the two hosts.
- Type
Verification¶
On s1-Spine2
, verify BGP operation (which should not be operating correctly) with the following commands:
Command
Expected Output
s1-spine2#show ip bgp summary
BGP summary information for VRF default
Router identifier 10.127.255.3, local AS number 2
Neighbor Status Codes: m - Under maintenance
Neighbor V AS MsgRcvd MsgSent InQ OutQ Up/Down State PfxRcd PfxAcc
10.127.23.2 4 1 7 6 0 0 00:02:03 Estab 2 2
10.127.34.4 4 2 0 0 0 0 00:02:10 Active
Command
Expected Output
s1-spine2#show ip bgp
BGP routing table information for VRF default
Router identifier 10.127.255.3, local AS number 2
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop
Network Next Hop Metric LocPref Weight Path
* > 10.127.255.1/32 10.127.23.2 0 100 0 1 i
* > 172.16.15.0/24 10.127.23.2 0 100 0 1 i
Command
Expected Output
s1-spine2#show ip route
VRF: default
Codes: C - connected, S - static, K - kernel,
O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
N2 - OSPF NSSA external type2, B I - iBGP, B E - eBGP,
R - RIP, I L1 - IS-IS level 1, I L2 - IS-IS level 2,
O3 - OSPFv3, A B - BGP Aggregate, A O - OSPF Summary,
NG - Nexthop Group Static Route, V - VXLAN Control Service,
DH - DHCP client installed default route, M - Martian,
DP - Dynamic Policy Route
Gateway of last resort:
S 0.0.0.0/0 [1/0] via 192.168.0.254, Management0
C 10.127.23.0/24 is directly connected, Ethernet1
C 10.127.34.0/24 is directly connected, Ethernet5
B E 10.127.255.1/32 [200/0] via 10.127.23.2, Ethernet1
C 10.127.255.3/32 is directly connected, Loopback0
B E 172.16.15.0/24 [200/0] via 10.127.23.2, Ethernet1
C 192.168.0.0/24 is directly connected, Management0
Note
All the route entries with a preceding “B” were learned via BGP on s1-Spine2
.
Lab Tasks¶
Configure Interfaces and BGP¶
-
Configure Loopback0 on
s1-Leaf4
. -
Under the Loopback0 interface, assign the correct IP address. This will be used to define the router-id in the next step. Loopbacks are used as the router-id addresses, as they are an always available interface that can be advertised reliably.
Commands
Example
s1-leaf4#configure
s1-leaf4(config)#interface loopback 0
s1-leaf4(config-if-Lo0)#ip address 10.127.255.4/32
-
Configure BGP on the
s1-Leaf4
switch using the following criteria:-
Configure BGP router process (also the autonomous system number, ASN) on
s1-Leaf4
.s1-Leaf4
will be configured to communicate to adjacent BGP speakers (s1-Spine2
in this case).Info
The router-id is configured so it can be consistent and not randomly chosen (normally the peering interface if not specified).
Commands
Example
s1-leaf4(config)#configure s1-leaf4(config)#router bgp 2 s1-leaf4(config-router-bgp)#router-id 10.127.255.4
Note
The process number for BGP corresponds to the autonomous-system number (ASN) the router is associated with and is globally significant. These values should not be chosen randomly and should be part of a larger design scheme for the environment.
-
BGP neighbours are explicitly defined so only the desired neighbors peer. A TCP connection is established between the two peers (using TCP port 179) in which the routing information can be securely transported between the peers.
Commands
Example
s1-leaf4(config)#configure s1-leaf4(config)#router bgp 2 s1-leaf4(config-router-bgp)#neighbor 10.127.34.3 remote-as 2
Info
The BGP session we are setting up on
s1-Leaf4
tos1-Spine2
is considered an iBGP (Internal BGP) connection because they are a part of the same autonomous-system (AS).Note
Although there are mechanisms to allow all incoming BGP sessions to be established, these are typically corner cases in which you will use that approach. It is best practice to specify your desired neighbor to establish a session, along with a peering password for an extra level of security.
-
By default, BGP will only re-advertise eBGP (external) prefixes it has leaned to its other iBGP / eBGP peers. We will need to tell BGP what to advertise by various methods. In this lab we want the router to advertise its connected (vlan) prefix
Commands
Example
-
Test¶
We can now verify our BGP configuration and peering with the following commands issued on s1-Leaf4
:
Command
Expected Output
s1-leaf4(config-router-bgp)#show ip bgp summary
BGP summary information for VRF default
Router identifier 10.127.255.4, local AS number 2
Neighbor Status Codes: m - Under maintenance
Neighbor V AS MsgRcvd MsgSent InQ OutQ Up/Down State PfxRcd PfxAcc
10.127.34.3 4 2 22 22 0 0 00:10:37 Estab 2 2
Command
Expected Output
s1-leaf4(config-router-bgp)#show ip bgp neighbors 10.127.34.3 advertised-routes
BGP routing table information for VRF default
Router identifier 10.127.255.4, local AS number 2
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop
Network Next Hop Metric LocPref Weight Path
* > 10.127.34.0/24 10.127.34.4 - 100 - i
* > 10.127.255.4/32 10.127.34.4 - 100 - i
* > 172.16.46.0/24 10.127.34.4 - 100 - i
* > 192.168.0.0/24 10.127.34.4 - 100 - i
Command
Expected Output
s1-leaf4(config-router-bgp)#show ip bgp neighbors 10.127.34.3 received-routes
BGP routing table information for VRF default
Router identifier 10.127.255.4, local AS number 2
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop
Network Next Hop Metric LocPref Weight Path
* > 10.127.255.1/32 10.127.34.3 - 100 - 1 i
* > 172.16.15.0/24 10.127.34.3 - 100 - 1 i
Command
Expected Output
s1-leaf4(config-router-bgp)#show ip bgp
BGP routing table information for VRF default
Router identifier 10.127.255.4, local AS number 2
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop
Network Next Hop Metric LocPref Weight Path
* > 10.127.34.0/24 - 1 0 - i
* > 10.127.255.1/32 10.127.34.3 0 100 0 1 i
* > 10.127.255.4/32 - 0 0 - i
* > 172.16.15.0/24 10.127.34.3 0 100 0 1 i
* > 172.16.46.0/24 - 1 0 - i
* > 192.168.0.0/24 - 1 0 - i
Command
Expected Output
s1-leaf4(config-router-bgp)#show ip route | Begin Gateway
Gateway of last resort:
S 0.0.0.0/0 [1/0] via 192.168.0.254, Management0
C 10.127.34.0/24 is directly connected, Ethernet3
B I 10.127.255.1/32 [200/0] via 10.127.34.3, Ethernet3
C 10.127.255.4/32 is directly connected, Loopback
B I 172.16.15.0/24 [200/0] via 10.127.34.3, Ethernet3
C 172.16.46.0/24 is directly connected, Ethernet4
C 192.168.0.0/24 is directly connected, Management0
Command
Expected Output
s1-leaf4(config-router-bgp)#show ip route bgp
VRF: default
Codes: C - connected, S - static, K - kernel,
O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
N2 - OSPF NSSA external type2, B I - iBGP, B E - eBGP,
R - RIP, I L1 - IS-IS level 1, I L2 - IS-IS level 2,
O3 - OSPFv3, A B - BGP Aggregate, A O - OSPF Summary,
NG - Nexthop Group Static Route, V - VXLAN Control Service,
DH - DHCP client installed default route, M - Martian,
DP - Dynamic Policy Route
B I 10.127.255.1/32 [200/0] via 10.127.34.3, Ethernet3
B I 172.16.15.0/24 [200/0] via 10.127.34.3, Ethernet3
Note
The routing table output should list all routing entries to ensure reachability between the 2 hosts.
To confirm connectivity, we can log into s1-Host2
and execute a ping command to s1-Host1
:
Command
Expected Output
s1-host2(config)# ping 172.16.15.5
PING 172.16.15.5 (172.16.15.5) 72(100) bytes of data.
80 bytes from 172.16.15.5: icmp_seq=1 ttl=60 time=436 ms
80 bytes from 172.16.15.5: icmp_seq=2 ttl=60 time=433 ms
80 bytes from 172.16.15.5: icmp_seq=3 ttl=60 time=429 ms
80 bytes from 172.16.15.5: icmp_seq=4 ttl=60 time=425 ms
80 bytes from 172.16.15.5: icmp_seq=5 ttl=60 time=422 ms
Success
If BGP has been configured correctly and the routing table on s1-Leaf4
is complete, then s1-Host1
should be reachable from s1-Host2
.
Test your knowledge
When s1-Leaf4
receives the incoming routes from s1-Spine2
, why can we not reach all the infrastructure IP addresses?
Tip
The following additional commands are useful to verify connectivity for validation and troubleshooting purposes:
- show ip route
- show ip route bgp
- show ip bgp summary
- show ip bgp
- show ip bgp neighbors
advertised-routes - show ip bgp neighbors
received-routes