作者:邹峰立,微博:zrunker,邮箱:zrunker@yahoo.com,微信公众号:书客创作,个人平台:www.ibooker.cc。

首先来看一下本次要实验的课程目标:
如下:要实现两台PC机(电脑)的通信、

有两个路由器,R1和R2,两台PC机,他们的IP分别是(IP地址是任意取值):
PC1:192.168.1.10、PC2:192.168.3.10、
R1的f0/0端口IP地址为:192.168.1.1、R1的f0/1端口IP地址为:192.168.2.1、
R1的f0/0端口IP地址为:192.168.3.1、R1的f0/1端口IP地址为:192.168.2.2、
那么要实现PC1与PC2通信要实现下面几个步骤:
首先配置PC机的IP:
PC1:

PC2:

下面是对路由器的配置:
R1进行配置:分三步进行设置
Router>
Router>enable 进入全局模式
Router#configure terminal 进入特权模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1 重命名R1
R1(config)#int f0/0 进入端口f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0 配置ip地址
R1(config-if)#no shutdown 设置端口为打开
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
// 下面是对f0/1端口进行配置
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
R1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
**// 最后是对ip route进行配置**
**// 格式:ip route 目的网段 目的网段子网掩码 下一跳地址**
R1(config-if)#exit
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#
同理R2路由器的配置也是一样的道理:
Router>en
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#int f0/0
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%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)#exit
R2(config)#interface f0/1
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config-if)#exit
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#
进行到这儿就已经完成了本次案例的配置工作。

温馨提示:按TAB键可以自动扩充命令。

网友评论