Lab 3-4 BGP Attributes and Route Selection 2
Lab 3-4 BGP Attributes and Route Selection 2
Learning Objectives
Topology
Scenario
You are a network administrator of a company. The company's network uses BGP for
interconnection. Design AS numbers according to the topology. To ensure network
security, some departments of branches cannot communicate with each other. To
control routing information transmission, you need to use the Community attribute
to filter BGP routes.
Tasks
Configure IP addresses and masks for physical interfaces and Loopback0 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]
[R3]interface loopback 0
[R3-LoopBack0]quit
<R4>system-view
[R4-Serial1/0/0]quit
[R4]interface loopback 0
[R4-LoopBack0]quit
<R5>system-view
[R5-GigabitEthernet0/0/0]quit
[R5]interface loopback 0
[R5-LoopBack0]quit
<R1>ping -c 1 10.0.12.2
1 packet(s) transmitted
1 packet(s) received
<R1>ping -c 1 10.0.14.4
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
Establish an IBGP peer relationship between R1 and R2 and establish EBGP peer
relationships between other routers.
[R1]router id 10.0.1.1
[R1]bgp 64513
[R1-bgp]quit
[R2]router id 10.0.2.2
[R2]bgp 64513
[R2-bgp]quit
[R3]router id 10.0.3.3
[R3]bgp 64514
[R3-bgp]quit
[R4]router id 10.0.4.4
[R4]bgp 64512
[R4-bgp]quit
[R5]router id 10.0.5.5
[R5]bgp 64515
[R5-bgp]quit
After the configurations are complete, check whether BGP peer relationships are
established between routers.
The preceding command output shows that all BGP peer relationships are in
Established state.
[R5]interface loopback 1
[R5-LoopBack1]quit
[R5]interface loopback 2
[R5-LoopBack2]quit
[R5]interface loopback 3
[R5-LoopBack3]quit
[R5]bgp 64515
[R5-bgp]quit
[R2]bgp 64513
[R2-bgp]quit
On R5, create a route-policy comm_r5 to add the Community attribute 100 to the
route 10.1.5.0/24.
[R5-acl-basic-2000]quit
[R5-route-policy]quit
[R5]bgp 64515
[R5-bgp]quit
Configure all BGP peers to advertise the Community attribute between each other.
[R1]bgp 64513
[R1-bgp]quit
[R2]bgp 64513
[R2-bgp]quit
[R3]bgp 64514
[R3-bgp]quit
[R4]bgp 64512
[R4-bgp]quit
[R5]bgp 64515
[R5-bgp]quit
You only need to add two new nodes and if-match clauses to the route-policy
comm_r5 created on R5.
[R5]acl 2001
[R5-acl-basic-2001]quit
[R5-route-policy]quit
[R5-acl-basic-2002]quit
[R5-route-policy]quit
Check the BGP routing tables of R2, R1, and R4 to observe transmission of the routes
10.1.5.0/24, 10.2.5.0/24, and 10.3.5.0/24.
The preceding command output shows that R2 does not advertise the route
10.2.5.0/24 carrying the special Community attribute no-export outside its AS but
advertises it to R1 in the same AS. R2 does not advertise the route 10.3.5.0/24
carrying the special Community attribute no-advertise to any BGP peer.
Create Loopback1 and Loopack2 on R3, assign addresses 10.1.3.3/24 and 10.2.3.3/24
to the two loopback interfaces respectively, and run the network command to
advertise these addresses into BGP.
[R3]interface LoopBack 1
[R3-LoopBack1]quit
[R3]interface loopback 2
[R3-LoopBack2]quit
[R3]bgp 64514
[R3-bgp]quit
[R3-acl-basic-2001]quit
[R3-route-policy]quit
[R3-route-policy]quit
[R3]bgp 64514
[R3-bgp]quit
On R1, check whether the learned routes 10.1.5.0/24 and 10.2.3.0/24 carry the
Community attribute 100.
Create a community filter to filter the route with the Community attribute 100.
[R1-route-policy]if-match community-filter 1
[R1-route-policy]quit
[R1-route-policy]quit
On R1, summarize the route matching the route-policy match_comm and use the
route-policy add_comm to add the Community attribute.
[R1]bgp 64513
[R1-bgp]quit
----End
Consider how to retain specific routes of the two routes 10.1.3.0/24 and 10.2.3.0/24
and suppress only specific routes of the route 10.1.5.0/24 on R4.
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 64513
ipv4-family unicast
undo synchronization
if-match community-filter 1
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
bgp 64513
ipv4-family unicast
undo synchronization
return
<R3>display current-configuration
[V200R007C00SPC600]
sysname R3
router id 10.0.3.3
interface Serial2/0/0
link-protocol ppp
interface LoopBack0
interface LoopBack1
interface LoopBack2
bgp 64514
ipv4-family unicast
undo synchronization
return
<R4>display current-configuration
[V200R007C00SPC600]
sysname R4
router id 10.0.4.4
interface Serial1/0/0
link-protocol ppp
interface LoopBack0
bgp 64512
ipv4-family unicast
undo synchronization
Return
<R5>display current-configuration
[V200R007C00SPC600]
sysname R5
router id 10.0.5.5
interface GigabitEthernet0/0/0
interface LoopBack0
interface LoopBack1
interface LoopBack2
interface LoopBack3
bgp 64515
ipv4-family unicast
undo synchronization
return