Lab 3-5 BGP Multi-Homing
Lab 3-5 BGP Multi-Homing
Learning Objectives
Topology
Scenario
You are a network administrator of a company. The company's network uses BGP to
connect to ISP1. The company uses a private AS number 64512 and connects to ISP1
through two routers, and ISP1 uses the AS number 100. The company initially used
default routes to connect to the Internet through ISP1. With the development of the
company, this Internet access mode cannot meet requirements. You need to import
some Internet routes into the AS of the company. After a certain period, the
company leases a line to connect to ISP2, whose AS number is 200. Finally, the
company builds a BGP multi-homing network.
Tasks
Configure IP addresses and masks for physical interfaces and loopback interfaces of
all the routers. Each Loopback0 uses the 32-bit mask.
<R1>system-view
[R1-Serial1/0/0]quit
[R1-Serial3/0/0]quit
[R1]interface loopback 0
[R1-LoopBack0]quit
<R2>system-view
[R2-Serial1/0/0]quit
[R2-Serial2/0/0]quit
[R2-GigabitEthernet0/0/0]quit
[R2]interface loopback 0
[R2-LoopBack0]quit
<R3>system-view
[R3-Serial2/0/0]quit
[R3-GigabitEthernet0/0/1]quit
[R3]interface loopback 0
[R3-LoopBack0]quit
<R4>system-view
[R4-Serial1/0/0]quit
[R4-GigabitEthernet0/0/1]quit
[R4]interface LoopBack 0
[R4-LoopBack0]quit
<R5>system-view
[R5-GigabitEthernet0/0/0]quit
[R5-GigabitEthernet0/0/1]quit
[R5]interface loopback 0
[R5-LoopBack0]quit
<R1>ping -c 1 10.0.14.4
1 packet(s) transmitted
1 packet(s) received
<R1>ping -c 1 10.0.12.2
1 packet(s) transmitted
1 packet(s) received
<R2>ping -c 1 10.0.25.5
1 packet(s) transmitted
1 packet(s) received
<R2>ping -c 1 10.0.23.3
1 packet(s) transmitted
1 packet(s) received
Run OSPF on the network segments connected to G0/0/1 and Loopback0 of R3.
[R3]router id 10.0.3.3
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]quit
Run OSPF on the network segments connected to G0/0/1 and Loopback0 of R4.
[R4]router id 10.0.4.4
[R4]ospf 1
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]quit
[R4-ospf-1]quit
Run OSPF on the network segments connected to G0/0/1 and Loopback0 of R5.
[R5]router id 10.0.5.5
[R5]ospf 1
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]quit
[R5-ospf-1]quit
Create VLAN 13 on S1 and configure a VLANIF address for interconnection with R3.
Create VLAN 14 on S1 and configure a VLANIF address for interconnection with R4.
Create VLAN 15 on S1 and configure a VLANIF address for interconnection with R5.
Set the link type of interconnected interfaces to access, and run OSPF on the network
segments connected to S1's VLANIF 13, VLANIF 14, VLANIF 15, and Loopback0.
[S1]vlan batch 13 to 15
[S1]interface vlan 13
[S1-Vlanif13]quit
[S1]interface vlan 14
[S1-Vlanif14]quit
[S1]interface vlan 15
[S1-Vlanif15]quit
[S1-GigabitEthernet0/0/3]quit
[S1-GigabitEthernet0/0/4]quit
[S1-GigabitEthernet0/0/5]quit
[S1]interface loopback 0
[S1-LoopBack0]quit
[S1]router id 10.0.1.11
[S1]ospf 1
[S1-ospf-1]area 0
[S1-ospf-1-area-0.0.0.0]quit
[S1-ospf-1]quit
Check whether the devices learn the network segment connected to Loopback0 of
other devices.
<R3>display ip routing-table
----------------------------------------------------------------------------
Destinations : 17 Routes : 17
<R4>display ip routing-table
----------------------------------------------------------------------------
Destinations : 17 Routes : 17
<R5>display ip routing-table
----------------------------------------------------------------------------
Destinations : 16 Routes : 16
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
Enable R2, R3, and R5 to establish EBGP peer relationships using physical interfaces
according to the topology. Do not run BGP on SI.
[R2]router id 10.0.2.2
[R2]bgp 100
[R2-bgp]quit
[R3]bgp 64512
[R3-bgp]quit
[R5]bgp 64512
[R5-bgp]quit
After the configurations are complete, check whether EBGP peer relationships are
established.
By default, BGP load balancing is disabled. Enable BGP load balancing on all the
routers and set the maximum number of equal-cost routes to 4 for load balancing.
[R1]router id 10.0.1.1
[R1]bgp 200
[R1-bgp]maximum load-balancing 4
[R1-bgp]quit
[R2]bgp 100
[R2-bgp]maximum load-balancing 4
[R2-bgp]quit
[R3]bgp 64512
[R3-bgp]maximum load-balancing 4
[R3-bgp]quit
[R4]bgp 64512
[R4-bgp]maximum load-balancing 4
[R4-bgp]quit
[R5]bgp 64512
[R5-bgp]maximum load-balancing 4
[R5-bgp]quit
[R2]interface LoopBack 1
[R2-LoopBack1]quit
[R2]interface LoopBack 2
[R2-LoopBack2]quit
[R2]bgp 100
[R2-bgp]quit
Check whether R3 and R5 learn the two routes to 10.1.2.2/24 and 10.2.2.2/24.
The link from R1 to ISP1 is the primary link, and the link from R5 to ISP1 is the
backup link. On R3 and R5, run the import-route command to import OSPF routes
into BGP.
[R3]bgp 64512
[R3-bgp]import-route ospf 1
[R3-bgp]quit
[R5]bgp 64512
[R5-bgp]import-route ospf 1
[R5-bgp]quit
On R3 and R5, configure forcible advertisement of default routes into Area 0 and set
the route type as Type 1 external route. Set the costs of default routes advertised by
R3 and R5 to 20 and 40 respectively.
[R3]ospf 1
[R3-ospf-1]quit
[R5]ospf 1
[R5-ospf-1]quit
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 14 Routes : 14
[S1]tracert 10.1.2.2
1 10.0.113.3 10 ms 1 ms 1 ms
2 10.0.23.2 40 ms 20 ms 20 ms
The preceding command output shows that S1 uses the default route learned from
R3. That is, S1 accesses 10.1.2.2 through the primary link.
Shut down S2/0/0 of R3 to simulate a failure of the link from the company to ISP1.
[R3]interface s2/0/0
[R3-Serial2/0/0]shutdown
[R3-Serial2/0/0]quit
After route convergence is complete, check the IP routing table of S1. Check
connectivity to 10.1.2.2.
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 13 Routes : 13
[S1]ping 10.1.2.2
5 packet(s) transmitted
0 packet(s) received
The preceding command output shows that the IP routing table of S1 does not
change and S1 still accesses the target network through R3.
When the uplink fails, S1 selects the default route advertised by R3 after comparing
the costs of the default routes advertised by R3 and R5. Therefore, the network
cannot operate normally.
[R3]interface s2/0/0
[R3-Serial2/0/0]undo shutdown
[R3-Serial2/0/0]quit
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]shutdown
[R3-GigabitEthernet0/0/1]quit
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 10 Routes : 10
[S1]ping 10.1.2.2
5 packet(s) transmitted
5 packet(s) received
S1 selects the default route learned from R5. That is, S1 accesses the target network
through the backup link.
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]undo shutdown
[R3-GigabitEthernet0/0/1]quit
Step 4 Connect to a single ISP using default routes and some filtered
routes.
Establish IBGP peer relationships between R3 and S1, between R4 and S1, and
between R5 and S1, and specify the next-hop-local parameter to ensure that S1 can
learn the route Update message sent from the ISP.
[R3]bgp 64512
[R3-bgp]quit
[R4]bgp 64512
[R4-bgp]quit
[R5]bgp 64512
[R5-bgp]quit
[S1]bgp 64512
[S1-bgp]quit
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 15 Routes : 15
[R3-acl-basic-2001]quit
[R3-route-policy]quit
[R3-route-policy]bgp 64512
[R3-bgp]quit
[R5-acl-basic-2001]quit
[R5-route-policy]quit
[R5-route-policy]quit
[R5]bgp 64512
[R5-bgp]quit
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 15 Routes : 15
The preceding command output shows that the next hop for the route 10.1.2.0/24 is
R5 and the next hop for the route 10.2.2.0/24 is R3.
[R3]interface s2/0/0
[R3-Serial2/0/0]shutdown
[R3-Serial2/0/0]quit
[S1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 14 Routes : 14
The IP routing table of S1 has only one BGP route 10.1.2.0/24 because a route-policy
is configured on R5 to filter the BGP route 10.2.2.0/24.
[S1]ping 10.1.2.2
5 packet(s) transmitted
5 packet(s) received
[R3]interface s2/0/0
[R3-Serial2/0/0]undo shutdown
[R3-Serial2/0/0]quit
The company applies for an Internet line to connect to ISP2. To select routes among
BGP routes, delete the default routes advertised by OSPF.
[R3]ospf
[R3-ospf-1]undo default-route-advertise
[R3-ospf-1]quit
[R5]ospf
[R5-ospf-1]undo default-route-advertise
[R5-ospf-1]quit
On R3 and R5, delete the command used to import OSPF routes into BGP.
[R3]bgp 64512
[R3-bgp]quit
[R5]bgp 64512
[R5-bgp]quit
Establish EBGP peer relationships between R1 and R2 and between R1 and R4 so that
ISP2 can also transmit the routes 10.1.2.0/24 and 10.2.2.0/24.
[R1]bgp 200
[R1-bgp]quit
[R2]bgp 100
[R2-bgp]quit
[R4]bgp 64512
[R4-bgp]quit
On S1, check the routes 10.1.2.0/24 and 10.2.2.0/24 and analyze current route
selection rules.
The company wants to access 10.2.2.0/24 through the new line connected to ISP2.
Configure a route-policy policy_r4 on R4 and change the Local_Pref attribute of the
route 10.2.2.0/24 to 150.
[R4-acl-basic-2001]quit
[R4-route-policy]quit
[R4-route-policy]quit
[R4]bgp 64512
[R4-bgp]quit
The preceding command output shows that S1 accesses 10.2.2.0/24 through the
route obtained from ISP2 connected to R4.
[R4]interface s1/0/0
[R4-Serial1/0/0]shutdown
[R4-Serial1/0/0]quit
The preceding command output shows that S1 obtains the routes 10.1.2.0/24 and
10.2.2.0/24 through ISP1 connected to R3.
[R4]interface s1/0/0
[R4-Serial1/0/0]undo shutdown
[R4-Serial1/0/0]quit
Check the BGP routing table of S1 to determine whether the failure is rectified.
----End
After S2/0/0 of R3 is shut down in step 3, and the primary link from the company to
ISP1 fails, the backup link between R5 and ISP1 still works normally. How to address
the connectivity problem?
This company is dual-homed to two ISPs. Analyze how to load balance incoming
traffic of the same network segment.
Device Configurations
<R1>display current-configuration
[V200R007C00SPC600]
sysname R1
router id 10.0.1.1
interface Serial1/0/0
link-protocol ppp
interface Serial3/0/0
link-protocol ppp
interface LoopBack0
bgp 200
ipv4-family unicast
undo synchronization
maximum load-balancing 4
return
<R2>display current-configuration
[V200R007C00SPC600]
sysname R2
router id 10.0.2.2
interface Serial1/0/0
link-protocol ppp
interface Serial2/0/0
link-protocol ppp
interface GigabitEthernet0/0/0
interface LoopBack0
interface LoopBack1
interface LoopBack2
bgp 100
ipv4-family unicast
undo synchronization
maximum load-balancing 4
return
<R3>display current-configuration
[V200R007C00SPC600]
sysname R3
router id 10.0.3.3
interface Serial2/0/0
link-protocol ppp
interface GigabitEthernet0/0/1
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
maximum load-balancing 4
ospf 1
area 0.0.0.0
return
<R4>display current-configuration
[V200R007C00SPC600]
sysname R4
router id 10.0.4.4
interface Serial1/0/0
link-protocol ppp
interface GigabitEthernet0/0/1
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
maximum load-balancing 4
ospf 1
area 0.0.0.0
Return
<R5>display current-configuration
[V200R007C00SPC600]
sysname R5
router id 10.0.5.5
interface GigabitEthernet0/0/0
interface GigabitEthernet0/0/1
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
maximum load-balancing 4
ospf 1
area 0.0.0.0
return
<S1>display current-configuration
sysname S1
router id 10.0.1.11
interface Vlanif13
interface Vlanif14
interface Vlanif15
interface GigabitEthernet0/0/3
interface GigabitEthernet0/0/4
interface GigabitEthernet0/0/5
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
ospf 1
area 0.0.0.0