組網圖形html
靜態路由簡介oop
組網需求ui
配置思路spa
操做步驟htm
# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置與SwitchA相似,再也不贅述。blog
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 100 400 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type access [SwitchA-GigabitEthernet0/0/1] port default vlan 10 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type trunk [SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 100 [SwitchA-GigabitEthernet0/0/2] quit [SwitchA] interface gigabitethernet 0/0/3 [SwitchA-GigabitEthernet0/0/3] port link-type trunk [SwitchA-GigabitEthernet0/0/3] port trunk allow-pass vlan 400 [SwitchA-GigabitEthernet0/0/3] quit
# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置與SwitchA相似,再也不贅述。接口
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 10.1.1.1 24 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 192.168.12.1 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 400 [SwitchA-Vlanif400] ip address 192.168.14.1 24 [SwitchA-Vlanif400] quit
# 配置SwitchA,配置兩條等價的靜態路由,下一跳分別指向SwitchB和SwitchD,這樣就能實現去程的流量的負載分擔。ip
[SwitchA] ip route-static 10.1.2.0 24 192.168.12.2 [SwitchA] ip route-static 10.1.2.0 24 192.168.14.2
# 配置SwitchB。路由
[SwitchB] ip route-static 10.1.2.0 24 192.168.23.2
# 配置SwitchD。get
[SwitchD] ip route-static 10.1.2.0 24 192.168.34.1
# 配置SwitchC,配置兩條等價的靜態路由,下一跳分別指向SwitchB和SwitchD,這樣就能實現回程流量的負載分擔。
[SwitchC] ip route-static 10.1.1.0 24 192.168.23.1 [SwitchC] ip route-static 10.1.1.0 24 192.168.34.2
# 配置SwitchB。
[SwitchB] ip route-static 10.1.1.0 24 192.168.12.1
# 配置SwitchD。
[SwitchD] ip route-static 10.1.1.0 24 192.168.14.1
配置主機PC1的IP地址爲10.1.1.2/24,默認網關爲10.1.1.1;配置主機PC2的IP地址爲10.1.2.2,默認網關爲10.1.2.1。
#查看SwitchA的IP路由表。
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 Vlanif10 10.1.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 10.1.2.0/24 Static 60 0 RD 192.168.12.2 Vlanif100 Static 60 0 RD 192.168.14.2 Vlanif400 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.12.0/24 Direct 0 0 D 192.168.12.1 Vlanif100 192.168.12.1/32 Direct 0 0 D 127.0.0.1 Vlanif100 192.168.14.0/24 Direct 0 0 D 192.168.14.1 Vlanif400 192.168.14.1/32 Direct 0 0 D 127.0.0.1 Vlanif400
從SwitchA的IP路由表中能夠看出,到達10.1.2.0/24這個網段有兩條等價路由,這種狀況下數據流將會平均分配到兩條不一樣的鏈路上,即實現流量的負載分擔。