Using BGP Preferred-Value attribute to control traffic flow in Multi-Homed Network on Huawei
- May 18, 2024
- Posted by: Lyfey Technologies
- Categories: Huawei, Networking
Configuration Steps
Step 1: Configure IP Addresses on interfaces on all routers.
************************R1
sys
#
sysname R1
#
interface GigabitEthernet0/0/0
ip address 20.20.20.0 255.255.255.254
#
interface GigabitEthernet0/0/1
ip address 10.10.10.0 255.255.255.254
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
************************R2
sys
#
sysname R2
#
interface GigabitEthernet0/0/0
ip address 20.20.20.1 255.255.255.254
#
interface GigabitEthernet0/0/1
ip address 20.20.20.2 255.255.255.254
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
************************R3
sys
#
sysname R3
#
interface GigabitEthernet0/0/0
ip address 20.20.20.3 255.255.255.254
#
interface GigabitEthernet0/0/1
ip address 20.20.20.4 255.255.255.254
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
************************R4
sys
#
sysname R4
#
interface GigabitEthernet0/0/0
ip address 20.20.20.5 255.255.255.254
#
interface GigabitEthernet0/0/1
ip address 10.10.10.3 255.255.255.254
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
************************R4
sys
#
sysname R5
#
interface GigabitEthernet0/0/0
ip address 10.10.10.1 255.255.255.254
#
interface GigabitEthernet0/0/1
ip address 10.10.10.2 255.255.255.254
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
#
Step 2: Configure EBGP peering relationship between different ASes as follows.
******************************R1
#
bgp 100
router-id 1.1.1.1
peer 10.10.10.1 as-number 400
peer 20.20.20.1 as-number 200
#
ipv4-family unicast
peer 10.10.10.1 enable
peer 20.20.20.1 enable
#
******************************R2
#
bgp 200
router-id 2.2.2.2
peer 20.20.20.0 as-number 100
peer 20.20.20.3 as-number 300
#
ipv4-family unicast
peer 20.20.20.0 enable
peer 20.20.20.3 enable
#
******************************R3
#
bgp 300
router-id 3.3.3.3
peer 20.20.20.2 as-number 200
peer 20.20.20.5 as-number 500
#
ipv4-family unicast
peer 20.20.20.2 enable
peer 20.20.20.5 enable
#
******************************R4
#
bgp 500
router-id 4.4.4.4
peer 10.10.10.2 as-number 400
peer 20.20.20.4 as-number 300
#
ipv4-family unicast
peer 10.10.10.2 enable
peer 20.20.20.4 enable
#
******************************R5
#
bgp 400
router-id 5.5.5.5
peer 10.10.10.0 as-number 100
peer 10.10.10.3 as-number 500
#
ipv4-family unicast
peer 10.10.10.0 enable
peer 10.10.10.3 enable
#
Step 3: Verify the BGP peering status on all routers.
Step 4:Advertise the network 30.30.30.30/32 on R4 and verify the traffic flow from R1 to the network on R4.
R1 learns two routes to Loopback 30 of R4 through BGP. THe pref-val for both routes is set to default(0) and the route from R5 is preffered due to shorter AS-PATH. We can modify the pref-val of routes learned from R2 to force R1 to select R2 as the next hop.
Step 5: Configure Pref-Val of 100 for routes learned from R2 for the network 30.30.30.30/32.
We configure an IP-Prefix to match network 30.30.30.30/32 and a route policy to change the pref-val to 100 when R1 is importing the route from R2. The same route will be learned from R5 but with default Pref-val.
*****************************R1
#
ip ip-prefix ADD_PREF_VAL index 10 permit 30.30.30.30 32
#
route-policy ADD_PREF_VAL permit node 10
if-match ip-prefix ADD_PREF_VAL
apply preferred-value 100
#
bgp 100
peer 20.20.20.1 route-policy ADD_PREF_VAL import
#
Step 6: Verify that the pref-val of 30.30.30.30/32 has changed to 100 on R1 and R1 prefers to selects the route learned from R2 as the best route to reach 30.30.30.30/32
Latest Posts
- VRRP Implementation on Huawei Routers.
- DHCP server, DHCP relay and DHCP snooping Implementation on Huawei.
- Dual Link HSB (Direct forwarding) Implementation on Huawei WACs.
- VRRP HSB (Direct forwarding) Implementation on Huawei WACs.
- VXLAN (intra-subnet communication) Implementation on Huawei switches.