1.构建上图
2.添加端口(关闭电源后再从右下角拖进端口框)
3:s0/3/0 s0/3/1
2:s0/2/0 s0/2/1
1:s0/1/0 s0/1/1
0:s0/0/0 s0/0/1
(需要哪个添加哪个)
3.设置电脑IP
例PC1:(注意网关的设置)
4.路由器配置
R1
Router>enable //进入特权模式
Router#hostname R1 //版本为5.3主机名在特权模式修改,版本为7在全局模式修改
R1#conf t //进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#ip address 192.168.0.254 255.255.255.0 //设置接口的IP地址及掩码
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int s0/1/0
R1(config-if)#ip address 192.168.1.2 255.255.255.0
R1(config-if)#clock rate 56000
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to down
R1(config-if)#exit
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.1 //配置静态路由
R1(config)#ip route 172.16.0.0 255.255.255.0 192.168.1.1
R1(config)#ip route 172.16.1.0 255.255.255.0 192.168.1.1
R1(config)#exit
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#write
Building configuration...
[OK]
R2
Router>
Router>enable //进入特权模式
Router(config)#hostname R2
R2#configure terminal //进入全局配置模式
R2(config)#int f0/0
R2(config-if)#ip address 192.168.2.254 255.255.255.0 //设置接口的IP地址及掩码
R2(config-if)#no shutdown //打开接口
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int s0/1/0
R2(config-if)#ip address 192.168.1.1 255.255.255.0
R2(config-if)#clock rate 56000 //配置时钟速率(数据包发送频率),DCE串口必须配置这个,否则会导致路由之间ping不通
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to down
R2(config-if)#int s0/1/1
R2(config-if)#ip address 172.16.0.1 255.255.255.0
R2(config-if)#clock rate 56000
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1/1, changed state to down
R2(config-if)#exit
R2(config)#ip route 192.168.0.0 255.255.255.0 192.168.1.2 //配置静态/默认路由
R2(config)#ip route 172.16.1.0 255.255.255.0 172.16.0.2
R2(config)#exit
R2#write //保存配置
Building configuration...
[OK]
R3
Router>
Router>ena
Router(config)#hostname R3
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip address 172.16.1.254 255.255.255.0
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#int s0/1/0
R3(config-if)#ip address 172.16.0.2 255.255.255.0
R3(config-if)#clock rate 56000
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to up
R3(config-if)#exit
R3(config)#exit
R3#write
Building configuration...
[OK]
最后一步,测试连通
(1)打开Command Prompt
(输入 ping + 目的IP)
完成!