本次实验有三台PC机和两台路由器,网络拓扑图如下所示。PC1不能ping通router1,但PC0能ping通router1。通过密码远程登录Router1。
Router0的基本配置命令:
Router>enable 进入特权模式
Router#config t 进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa1/0 进入端口配置模式
Router(config-if)#ip address 192.168.1.1 255.255.255.0 配置fa1/0的ip
Router(config-if)#no shutdown 启用
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
Router(config-if)#exit 退出端口配置模式
Router(config)#int fa0/0 进入端口配置模式
Router(config-if)#ip address 192.168.2.1 255.255.255.0 配置fa0/0的ip
Router(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
Router(config-if)#exit 退出端口配置模式
Router(config)#int s2/0 进入端口配置模式
Router(config-if)#ip address 192.168.3.1
% Incomplete command.
Router(config-if)#ip address 192.168.3.1 255.255.255.0 配置ser2/0的ip
Router(config-if)#no shutdown 启用
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
Router(config-if)#exit 退出端口配置模式
Router(config)#router rip 配置动态路由
Router(config-router)#ver
Router(config-router)#version 2 版本号
Router(config-router)#network 192.168.1.0 相连网段
Router(config-router)#network 192.168.2.0 相连网段
Router(config-router)#network 192.168.3.0 相连网段
Router(config-router)#exit 退出路由配置模式
Router(config)#int s2/0 进入端口配置模式
Router(config-if)#clock rate 64000 时钟
Router(config-if)#exit
Router(config)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
Router(config)#
%SYS-5-CONFIG_I: Configured from console by console
Router#
Router1的基本配置命令:
Router>enable 进入特权模式
Router#config t 进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0 进入端口配置模式
Router(config-if)#ip address 192.168.4.1 255.255.255.0 配置fa0/0的ip
Router(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
Router(config-if)#exit 退出端口配置模式
Router(config)#int s2/0 进入端口配置模式
Router(config-if)#ip address 192.168.3.2 255.255.255.0 配置ser2/0的ip
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial2/0, changed state to down
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
Router(config-if)#exit
Router(config)#router rip 配置动态路由
Router(config-router)#ver
Router(config-router)#version 2 版本号
Router(config-router)#network 192.168.3.0 相连网段
Router(config-router)#network 192.168.4.0 相连网段
Router(config-router)#exit 退出路由配置模式
Router(config)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
(1)未设置ping的控制条件时,PC机之间能够相互ping通。截图如下:
PC0 ping PC2 能够ping通
PC2 ping PC0 能够ping通
PC2 ping PC1 能够ping通
(2)在router1上配置ping控制条件,禁止PC1访问。
Router(config)#access-list 1 deny host 192.168.2.2 拒绝192.168.2.2访问
Router(config)#access-list 1 permit any 允许其他的都能访问
Router(config)#int s2/0 进入端口配置模式
Router(config-if)#ip access-group 1 in 将规则1应用于过滤从串口接收上来的报文
Router(config-if)#exit 退出端口配置模式
Router(config)#
PC0 ping PC2 能够ping通
PC1 ping router0的s2/0 能够ping通
PC1 ping router1的s2/0 超时
PC2 ping PC0 能够ping通
(3)在Router1上远程登录的设置
Router(config)#line vty 0 4 进入虚拟线程模式,在这个模式可对telnet功能进行配置
Router(config-line)#password 123 设置密码123
Router(config-line)#login 启用口令检查
Router(config-line)#exit 退出虚拟线程模式
PC0 telnet Router1: PC2 telnet Router1:
PC1 telnet Router1:
在本次实验中,路由器我采用的动态路由配置,使用的是rip协议。又由于router0有3个端口,所以所用的路由是Router-PT路由器,两个路由之间使用的接口是串口。在配置串口IP地址时,我发现第一个串口在配置好后,如果立即no shutdown,不但不能启用该串口,还会使串口的状态变为down。在配置好动态路由后,我用PC0 ping PC2,结果无法ping通,然后,我在其中的一个路由的串口上配置了一个时钟,再重新ping的时候,就能够ping通了。还有,在做这次实验的时候,我发现,路由的端口我们不能随便取名,要根据选用的路由给的端口名称来配置端口IP,这不知道是规定是这样的还是由于软件的版本不同。