路由器配置——靜態路由


一、實驗要求:配置靜態路由實現全網互通。

二、拓撲圖:

 

三、具體步驟配置:

 (1)R1路由器配置:

Router>enable  --進入特權模式
Router#config terminal  --進入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1  --修改路由器名為R1
R1(config)#interface S0/0/0  --進入端口
R1(config-if)#ip address 192.168.13.1 255.255.255.0  --設置ip地址
R1(config-if)#clock rate 64000  --設置時鍾速率
This command applies only to DCE interfaces  
R1(config-if)#no shutdown  --激活端口

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
R1(config-if)#interface s0/0/1  --進入端口
R1(config-if)#ip address 192.168.23.1 255.255.255.0  --設置ip地址
R1(config-if)#clock rate 64000  --設置時鍾速率
R1(config-if)#no shutdown  --激活端口

%LINK-5-CHANGED: Interface Serial0/0/1, changed state to down
R1(config-if)#interface f0/0  --進入端口
R1(config-if)#ip address 192.168.1.254 255.255.255.0  --設置ip地址
R1(config-if)#no shutdown  --激活端口

R1(config-if)#exit  --返回上一級
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.13.2  --配置靜態路由
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.23.2
R1(config)#ip route 192.168.12.0 255.255.255.0 192.168.13.2
R1(config)#end  --返回特權模式

(2)R2路由器配置:

Router>enable   --進入特權模式
Router#config terminal  --進入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2  --修改主機名為R2
R2(config)#interface s0/0/0  --進入端口
R2(config-if)#ip address 192.168.13.2 255.255.255.0  --設置ip地址
R2(config-if)#no shutdown  --激活端口

R2(config-if)#interface f0/0  --進入端口
R2(config-if)#ip address 192.168.2.254 255.255.255.0  --設置ip地址
R2(config-if)#no shutdown  --激活端口

R2(config-if)#interface f0/1  --進入端口
R2(config-if)#ip address 192.168.12.2 255.255.255.0  --設置ip地址
R2(config-if)#no shutdown  --激活端口

R2(config-if)#exit  --返回上一級
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.13.1  --配置靜態路由
R2(config)#ip route 192.168.3.0 255.255.255.0 192.168.12.1
R2(config)#ip route 192.168.23.0 255.255.255.0 192.168.13.1
R2(config)#end  --返回特權模式

(3)R2路由器配置

Router>enable  --進入特權模式
Router#config terminal  --進入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3  --修改主機名為R3

R3(config)#interface s0/0/0  --進入端口
R3(config-if)#ip address 192.168.23.2 255.255.255.0  --設置ip地址
R3(config-if)#no shutdown  --激活端口

R3(config-if)#interface f0/0  --進入端口
R3(config-if)#ip address 192.168.3.254 255.255.255.0  --設置ip地址
R3(config-if)#no shutdown  --激活端口

R3(config-if)#interface f0/1  --進入端口
R3(config-if)#ip address 192.168.12.1 255.255.255.0  --設置ip地址
R3(config-if)#no shutdown  --激活端口

R3(config-if)#exit  --返回上一級
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.23.1  --設置靜態路由
R3(config)#ip route 192.168.23.0 255.255.255.0 192.168.12.2
R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.12.2

R3(config)#end  --返回特權模式

四、驗證:

測試每台主機是否互通

(1)PC1PC2

(2)PC2PC3

 

(3)PC3PC1

(4)全網互通成功

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM