靜態路由 默認路由 浮動路由配置

靜態路由配置:

Step1:必打命令

<Huawei>undo terminal monitor
<Huawei>system-view
[Huawei]sysname R1
[R1]user-interface console 0
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]quit

R2 R3同理

Step2:配置IP地址與環回地址,直連網段間測試連通性

R1:

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.1.1.1 24
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]int loop 0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]quit

R2:

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.1.1.2 24
[R2-GigabitEthernet0/0/0]undo shutdown
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 10.1.2.2 24
[R2-GigabitEthernet0/0/1]undo shutdown
[R2-GigabitEthernet0/0/1]quit

R3:

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 10.1.2.3 24
[R3-GigabitEthernet0/0/0]undo shutdown
[R3-GigabitEthernet0/0/0]int loop 0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]quit

同網段間ping通後開始下一步

Step3:配置靜態路由協議

R1:

[R1]ip route-static 3.3.3.3 32 10.1.1.2
[R1]ip route-static 10.1.2.0 24 10.1.1.2

R2:

[R2]ip route-static 1.1.1.1 32 10.1.1.1
[R2]ip route-static 3.3.3.3 32 10.1.2.3

R3:

[R3]ip route-static 1.1.1.1 32 10.1.2.2
[R3]ip route-static 10.1.1.0 24 10.1.2.2

PC間開始ping用命令ping -a 本機地址 目的地址

 

在R1輸入

ping -a 1.1.1.1 3.3.3.3

在R3輸入:

ping -a 3.3.3.3 1.1.1.1

結束

 

默認路由則是將靜態路由的Step3修改爲由默認路由開始

R1:

[R1]ip route-static 0.0.0.0 0 10.1.1.2

R3:

[R3]ip route-static 0.0.0.0 0 10.1.2.2

R2不變

默認路由只能在末梢網絡使用

其他步驟不變

 

浮動是指配置兩條靜態路由,默認選擇鏈路質量優(帶寬大的)作爲作爲主路徑,當路徑出現故障時,由帶寬較小的備份路由頂替,保持網絡的不中斷

所以我們以默認路由實驗爲基礎做下一步。

Step1:斷開帶寬大的接口

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]shutdown
[R1-GigabitEthernet0/0/0]quit

Step2:給備份路由兩個端口設置IP地址

R1:

[R1]int e0/0/0
[R1-Ethernet0/0/0]ip address 10.1.3.1 24
[R1-Ethernet0/0/0]quit

R2:

[R2]int e0/0/0
[R2-Ethernet0/0/0]ip address 10.1.3.2 24
[R2-Ethernet0/0/0]quit

Step3:配置備份路由的靜態路由

R1:

[R1]ip route-static 0.0.0.0 0 10.1.3.2 preference 61

R2:

[R2]ip route-static 1.1.1.1 32 10.1.3.1 preference 61

後綴preference 61是優先級,要比主路徑的優先級低

結束