華爲浮動路由

理論知識網絡

一、浮動路由默認是優先級是60,越小越優先,若是是第二條路由
優先級是比默認的要大,通常配置60以上ide

二、VRRP :(公有協議)
在多個路由器之間運行,
能夠虛擬出一個或者多個網關IP地址(虛擬路由器);
從而實現內網不一樣網段之間的互通;oop

三、VRRP的工做過程:
運行VRRP的「多個」路由器之間經過 VRRP 報文的交互,從而選擇
出一個最牛的路由器,做爲 Master 路由器 ,之後就用來這個設備來轉發數據包;
Master 路由器,僅僅只有一個;其餘的路由器稱之爲 backup 路由器;
同時,Master 和 Backup 路由器,會產生一個虛擬的路由器,也就是一個
主:配虛擬IP地址、優先級(默認100、鏈路down減10)通常120、監聽上層口和下層口
備:配虛擬IP地址、優先級(默認100、鏈路down減10)通常11五、不須要監聽上層口和下層口測試

拓撲圖以下this

華爲浮動路由

配置LSW1blog

<SW1>sys
[Huawei]sysname SW1
[SW1]vlan batch 10 20 100
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/2]un sh
[SW1-GigabitEthernet0/0/2]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 100
[SW1-GigabitEthernet0/0/1]un sh
[SW1-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 100
#接口

[SW1]int vlanif10
[SW1-Vlanif10]ip add 192.168.10.10 24
[SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
##建立虛擬IP
[SW1-Vlanif10]vrrp vrid 1 priority 120
##設定優先級爲120
[SW1-Vlanif10]vrrp vrid 1 track interface g0/0/1
[SW1-Vlanif10]vrrp vrid 1 track interface g0/0/2
##監聽自身的兩個接口狀態
[SW1-Vlanif10]dis this
#
interface Vlanif10
ip address 192.168.10.10 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.1
vrrp vrid 1 priority 120
vrrp vrid 1 track interface GigabitEthernet0/0/1
vrrp vrid 1 track interface GigabitEthernet0/0/2
#ip

[SW1-Vlanif10]int vlanif 20
[SW1-Vlanif20]ip add 192.168.20.10 24
[SW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[SW1-Vlanif20]vrrp vrid 2 priority 115路由

##配置優先級爲115it

[SW1]int vlanif 100
[SW1-Vlanif100]ip add 11.0.0.2 30
[SW1-Vlanif100]q
[SW1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1

##配置默認路由

配置LSW2

<Huawei>sys
[Huawei]sysname SW2
[SW2]vlan batch 10 20 100
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/2]un sh
[SW2-GigabitEthernet0/0/2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 100
[SW2-GigabitEthernet0/0/1]un sh
[SW2-GigabitEthernet0/0/1]int vlanif 10
[SW2-Vlanif10]ip add 192.168.10.20 24
[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[SW2-Vlanif10]vrrp vrid 1 priority 115
[SW2-Vlanif10]int vlanif 20
[SW2-Vlanif20]ip add 192.168.20.20 24
[SW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[SW2-Vlanif20]vrrp vrid 2 priority 120
[SW2-Vlanif20]vrrp vrid 2 track interface g0/0/1
[SW2-Vlanif20]vrrp vrid 2 track interface g0/0/2
[SW2]int vlanif 100
[SW2-Vlanif100]ip add 12.0.0.2 30
[SW2-Vlanif100]q
[SW2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

配置R1

**<Huawei>sys
[Huawei]sysname R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30
[R1-GigabitEthernet0/0/1]un sh
[R1-GigabitEthernet0/0/0]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]q
[R1]ip route-static 192.168.10.0 24 11.0.0.2
[R1]ip route-static 192.168.10.0 24 12.0.0.2 preference 70
[R1]ip route-static 192.168.20.0 24 12.0.0.2
[R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70**

配置LSW3

<Huawei>sys
[Huawei]sysname sw3
[SW3]vlan batch 10 20
[SW3]int e0/0/1
[SW3-Ethernet0/0/1]port link-type access
[SW3-Ethernet0/0/1]port default vlan 10
[SW3-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[SW3-Ethernet0/0/1]int e0/0/2
[SW3-Ethernet0/0/2]port link-type access
[SW3-Ethernet0/0/2]port default vlan 20
[SW3-Ethernet0/0/2]un sh
Info: Interface Ethernet0/0/2 is not shutdown.
[SW3-Ethernet0/0/2]int g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/1]un sh
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/2]un sh

測試網絡互通性

**PC1>ping 1.1.1.1

Ping 1.1.1.1: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: bytes=32 seq=1 ttl=254 time=93 ms
From 1.1.1.1: bytes=32 seq=2 ttl=254 time=47 ms
From 1.1.1.1: bytes=32 seq=3 ttl=254 time=47 ms
From 1.1.1.1: bytes=32 seq=4 ttl=254 time=62 ms
From 1.1.1.1: bytes=32 seq=5 ttl=254 time=63 ms

--- 1.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/62/93 ms

PC2>ping 1.1.1.1

Ping 1.1.1.1: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: bytes=32 seq=1 ttl=254 time=109 ms
From 1.1.1.1: bytes=32 seq=2 ttl=254 time=63 ms
From 1.1.1.1: bytes=32 seq=3 ttl=254 time=62 ms
From 1.1.1.1: bytes=32 seq=4 ttl=254 time=63 ms
From 1.1.1.1: bytes=32 seq=5 ttl=254 time=47 ms

1.1.1.1 ping statistics
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/68/109 ms

模擬線網主鏈路故障,另外一條鏈路替代運行

[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]shutdown

華爲浮動路由

相關文章
相關標籤/搜索