教你配置簡單的靜態路由
歡迎來到。這篇是小編特地為大家整理的,希望對大家有所幫助!
為了更有說服力和便於理解我用CPTCisco Packet Tracer演示了一下。
拓撲圖如下圖所示:
分別有四個網段,10.0.0.0/8、112.237.228.0/24、192.168.10.0/24、211.86.104.0/24。
靜態路由設定如下:
ip route 192.168.10.0 255.255.255.0 112.237.228.1 ip route 211.86.104.0 255.255.255.0 112.237.228.1 ip route 10.0.0.0 255.0.0.0 112.237.228.244 ip route 211.86.104.0 255.255.255.0 192.168.10.1 ip route 112.237.228.0 255.255.255.0 192.168.10.2 ip route 10.0.0.0 255.0.0.0 192.168.10.2
配置如下:
1.PC0的IP配置:
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 10.0.0.3
Subnet Mask.....................: 255.0.0.0
Default Gateway.................: 10.0.0.1
PC>
2.PC1的IP配置:
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 211.86.104.52
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 211.86.104.254
PC>
3.R1的配置:
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Routerconfig#hostname R1 R1config#interface FastEthernet0/1 R1config-if#ip address 10.0.0.1 255.0.0.0 R1config-if#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up R1config-if#end R1# %SYS-5-CONFIG_I: Configured from console by console R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1config#int f0/0 R1config-if#ip addr 112.237.228.244 255.255.255.0 R1config-if#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up R1config-if#end R1# %SYS-5-CONFIG_I: Configured from console by console R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1config#ip route 192.168.10.0 255.255.255.0 112.237.228.1 R1config#ip route 211.86.104.0 255.255.255.0 112.237.228.1 R1config#end R1# %SYS-5-CONFIG_I: Configured from console by console R1#
4.R2的配置:
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Routerconfig#hostname R2 R2config# R2config#interface FastEthernet0/1 R2config-if#ip address 112.237.228.1 255.255.255.0 R2config-if#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up R2config-if# R2config-if#exit R2config#interface FastEthernet0/0 R2config-if#ip address 192.168.10.2 255.255.255.0 R2config-if#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up R2config-if#end R2#conf t Enter configuration commands, one per line. End with CNTL/Z. R2config#ip route 10.0.0.0 255.0.0.0 112.237.228.244 R2config#ip route 211.86.104.0 255.255.255.0 192.168.10.1 R2config#end R2# %SYS-5-CONFIG_I: Configured from console by console R2#
5.R3的配置:
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Routerconfig#hostname R3 R3config# R3config#interface FastEthernet0/1 R3config-if#ip address 192.168.10.1 255.255.255.0 R3config-if#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up R3config-if# R3config-if#exit R3config#interface FastEthernet0/0 R3config-if#ip address 211.86.104.254 255.255.255.0 R3config-if#no shutdown R3config-if# %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up R3>enable R3#conf t Enter configuration commands, one per line. End with CNTL/Z. R3config#ip route 112.237.228.0 255.255.255.0 192.168.10.2 R3config#ip route 10.0.0.0 255.0.0.0 192.168.10.2 R3config#end R3# %SYS-5-CONFIG_I: Configured from console by console R3#
6.使用tracert進行測試:
測試從PC0能否路由到PC1。
結果表明測試成功。
測試從PC1能否路由到PC0。
結果表明測試成功。
寬頻路由器設定