簡單介紹靜態路由

共青歡發表於2021-01-04

靜態路由(tatic routing),一種路由的方式,路由項(routing entry)由手動配置,而非動態決定。與動態路由不同,靜態路由是固定的,不會改變,即使網路狀況已經改變或是重新被組態。一般來說,靜態路由是由網路管理員逐項加入路由表

優點

使用靜態路由的另一個好處是網路安全保密性高。動態路由因為需要路由器之間頻繁地交換各自的路由表,而對路由表的分析可以揭示網路的拓撲結構網路地址等資訊。因此,網路出於安全方面的考慮也可以採用靜態路由。不佔用網路頻寬,因為靜態路由不會產生更新流量。

缺點

大型和複雜的網路環境通常不宜採用靜態路由。一方面,網路管理員難以全面地瞭解整個網路的拓撲結構;另一方面,當網路的拓撲結構和鏈路狀態發生變化時,路由器中的靜態路由資訊需要大範圍地調整,這一工作的難度和複雜程度非常高。當網路發生變化或網路發生故障時,不能重選路由,很可能使路由失敗。

SW1

The device is running!

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan bat 10 to 40                             
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1	
[Huawei-Ethernet0/0/1]port link-type access              
[Huawei-Ethernet0/0/1]port default vlan 10            
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 20
[Huawei-Ethernet0/0/2]int g0/0/1	
[Huawei-GigabitEthernet0/0/1]port link-type trunk       
[Huawei-GigabitEthernet0/0/1]port trunk all vlan all  

SW2

The device is running!

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan bat 10 to 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 30
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 40
[Huawei-Ethernet0/0/2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk all vlan all

R1

The device is running!

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[Huawei-GigabitEthernet0/0/0]int g0/0/0.1	            
[Huawei-GigabitEthernet0/0/0.1]vlan-type d 10 d         
[Huawei-GigabitEthernet0/0/0.1]ip add 192.168.10.1 24   
[Huawei-GigabitEthernet0/0/0.1]int g0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]vlan-type d 20 d
[Huawei-GigabitEthernet0/0/0.2]ip add 192.168.20.1 24
[Huawei-GigabitEthernet0/0/0.2]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.1.2 24
[Huawei-GigabitEthernet0/0/1]q	
[Huawei]ip route-static 192.168.30.0 24 10.1.1.3       
[Huawei]ip route-static 192.168.40.0 24 10.1.1.3

R2

The device is running!

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[Huawei-GigabitEthernet0/0/0]int g0/0/0.1
[Huawei-GigabitEthernet0/0/0.1]vlan-type d 30 d
[Huawei-GigabitEthernet0/0/0.1]ip add 192.168.30.1 24
[Huawei-GigabitEthernet0/0/0.1]int g0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]vlan-type d 40 d
[Huawei-GigabitEthernet0/0/0.2]ip add 192.168.40.1 24
[Huawei-GigabitEthernet0/0/0.2]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.1.3 24
[Huawei-GigabitEthernet0/0/1]q	
[Huawei]ip route-static 192.168.10.0 24 10.1.1.2
[Huawei]ip route-static 192.168.20.0 24 10.1.1.2