天天看點

網絡技術應用中,如何配置靜态路由,來實作網絡的連通

作者:網絡系統技藝者

作為一名網工,配置靜态路由是確定網絡連通性的重要環節之一。靜态路由是一種網絡路由的配置方式,通過手動指定路由表中的路由條目,将資料包從源位址傳輸到目标位址。與動态路由相比,靜态路由的配置相對簡單,且對網絡資源的消耗較低,是以在某些場景下更為适用。

通過配置靜态路由,網工可以實作網絡中各個子網之間的連通性。通過仔細規劃和配置路由器之間的路由條目,可以確定資料包在網絡中的正确傳輸。這種配置方式尤其适用于小型網絡環境,其中路由變化不頻繁且較為穩定。然而,靜态路由也需要網工對網絡拓撲和路由規則有深入的了解,以確定路由表的準确性和有效性。

在配置靜态路由時,網工需要考慮網絡的拓撲結構、網絡裝置的性能和帶寬等因素。合理的路由規劃可以提高網絡的可靠性和性能,確定資料包能夠按照最佳路徑進行傳輸。此外,網工還需要注意及時更新路由表,以應對網絡拓撲的變化或故障的發生,以保持網絡的連通性。

實驗需求:

某高職院校,教學樓所在區為A區,行政部門和财務部門在B區,現要求通過靜态路由來實作網絡區間的網絡互通,即PC1 與PC3互通,PC2與PC3互通

網絡拓撲

網絡技術應用中,如何配置靜态路由,來實作網絡的連通

配置思路:

1、分别為三個路由器各個接口配置ip位址

2、在AR1上配置靜态路由,指向A區的192.168.3.0/24

3、在AR2配置靜态路由,指向A區的192.168.3.0/24

4、在AR3配置靜态路由,指向B區的 192.168.1.0/24

5、在AR2上配置靜态路由,指向B區的 192.168.1.0/24

6、在AR1和AR2上配置去往環回口所在網段的靜态路由。

實驗步驟:

1、在AR1上配置對應接口的ip 位址

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]undo inf	
[Huawei]undo info-center en
Info: Information center is disabled.
[Huawei]
[Huawei]
[Huawei]int	
[Huawei]interface gi	
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[Huawei-GigabitEthernet0/0/0]int	
[Huawei-GigabitEthernet0/0/0]int gi 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 11.1.1.1 24
[Huawei-GigabitEthernet0/0/1]int gi 0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 192.168.2.254 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]q
<Huawei>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<Huawei>
<Huawei>           

2、在AR2上配置對應接口的ip位址

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]undo inf	
[Huawei]undo info-center en
Info: Information center is disabled.
[Huawei]
[Huawei]int	
[Huawei]interface gi	
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 11.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int gi 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 23.1.1.1 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]q
<Huawei>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<Huawei>
<Huawei>           
網絡技術應用中,如何配置靜态路由,來實作網絡的連通

3、在AR3路由器接口(環回接口)配置對應的IP位址

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]undo inf en
Info: Information center is disabled.
[Huawei]
[Huawei]int gi 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int gi 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.3.254
                                                  ^
Error:Incomplete command found at '^' position.
[Huawei-GigabitEthernet0/0/1]ip add 192.168.3.254 24
[Huawei-GigabitEthernet0/0/1]
[Huawei-GigabitEthernet0/0/1]int	
[Huawei-GigabitEthernet0/0/1]int lo0
[Huawei-LoopBack0]ip add 3.3.3.3 24
[Huawei-LoopBack0]q
[Huawei]int lo1
[Huawei-LoopBack1]ip add 4.4.4.4 24
[Huawei-LoopBack1]q
[Huawei]int lo2
[Huawei-LoopBack2]ip add 5.5.5.5 24
[Huawei-LoopBack2]q
[Huawei]q
<Huawei>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<Huawei>
<Huawei>           

4、現在我們要求行政部門的終端機PC1能夠通路教學樓A區的終端 PC3 ,此時對于B區的出口路由來說,應該有到PC3 的路由,我們來檢視一下AR1路由表

網絡技術應用中,如何配置靜态路由,來實作網絡的連通

從上面的路由表中,我們并沒有看到到 B區的路由網段,是以我們需要對其配置靜态路由

5、AR1 上配置靜态路由

[AR1]
[AR1]ip rout	
[AR1]ip route
[AR1]ip route-static 192.168.3.0 24 11.1.1.2
[AR1]
#配置回環口路由
[AR1]ip route-static
[AR1]ip route
[AR1]ip route-static 3.3.3.0 24 11.1.1.2
[AR1]rout	
[AR1]ip rout	
[AR1]ip route-static 4.4.4.0 24 11.1.1.2
[AR1]ip rout	
[AR1]ip route
[AR1]ip route-static 5.5.5.0 24 11.1.1.2
[AR1]
[AR1]           

AR2上配置靜态路由

[Huawei]
[Huawei]ip rout	
[Huawei]ip route
[Huawei]ip route-static 192.168.3.0 24 23.1.1.2
[Huawei]
[Huawei]ip route-static 192.168.1.0 24 11.1.1.1
[Huawei]
#配置回環口路由
[Huawei]ip rout	
[Huawei]ip route
[Huawei]ip route-static 3.3.3.0 24 23.1.1.2
[Huawei]ip rout	
[Huawei]ip route
[Huawei]ip route-static 4.4.4.0 24 23.1.1.2
[Huawei]ip rout	
[Huawei]ip route
[Huawei]ip route-static 5.5.5.0 24 23.1.1.2
[Huawei]
[Huawei]           

AR3 上配置靜态路由

[Huawei]ip rout	
[Huawei]ip route
[Huawei]ip route-static 192.168.1.0 24 23.1.1.1
[Huawei]           

6、測試 PC1與PC3之間的連通性

PC1配置

網絡技術應用中,如何配置靜态路由,來實作網絡的連通

PC2配置

網絡技術應用中,如何配置靜态路由,來實作網絡的連通

連通性測試

網絡技術應用中,如何配置靜态路由,來實作網絡的連通
網絡技術應用中,如何配置靜态路由,來實作網絡的連通
網絡技術應用中,如何配置靜态路由,來實作網絡的連通

測試環路通斷

網絡技術應用中,如何配置靜态路由,來實作網絡的連通

對于PC2這裡就不在贅述了,友友們可以自行配置下。

寫在最後:

自我設限,固步自封,唯有突破極限,才能發掘潛能。以上就是本期整理的《網絡技術應用中,作為網工如何配置靜态路由,來實作網絡的連通性》,自己經曆過的風雨,是以知道你也會堅強。你的【點贊】+【關注】,我會自動解讀為認可。

作者簡介:

我是“網絡系統技藝者”,系統運維工程師一枚,持續分享【網絡技術+系統運維技術】幹貨。碼字不易,如果您覺得文章還可以,就收藏吧,也許在以後某個時間能夠用得到。

繼續閱讀