1.网络拓扑图
2.参数表
设备 | 端口 | ip | 掩码 | 网关 |
router0 | se2/0 | 172.16.1.1 | 255.255.255.0 | |
fa0/0 | 192.168.1.1 | 255.255.255.0 | ||
router1 | se2/0 | 172.16.1.2 | 255.255.255.0 | |
fa0/0 | 192.168.2.1 | 255.255.255.0 | ||
pc0 | 192.168.1.2 | 255.255.255.0 | 192.168.1.1 | |
pc1 | 192.168.1.3 | 255.255.255.0 | 192.168.1.1 | |
pc2 | 192.168.2.2 | 255.255.255.0 | 192.168.2.1 | |
pc3 | 192.168.2.3 | 255.255.255.0 | 192.168.2.1 |
3.路由器router0(左边路由器)的配置代码
Router>en
Router>enable
Router#conf t
Router(config)#hostname r1 //将路由器的主机名设置为 r1
//配置fa0/0接口
r1(config)#int fa0/0
r1(config-if)#ip address 192.168.1.1 255.255.255.0 //设置接口fa0/0的ip和掩码
r1(config-if)#no shutdown //启用接口
r1(config-if)#exit
//配置se2/0接口
r1(config)#int se2/0
r1(config-if)#ip address 176.16.1.1 255.255.255.0 //设置接口se2/0的ip和掩码
r1(config-if)#clock rate 64000 //时钟速率
r1(config-if)#no shutdown //启用接口
r1(config-if)#exit //退出se2/0接口配置模式
r1(config)#router rip //进入路由器的 RIP 协议配置模式
//将网络192.168.1.0添加到 RIP 路由协议中进行路由信息交换
r1(config-router)#network 192.168.1.0
//将网络176.16.1.0添加到 RIP 路由协议中进行路由信息交换
r1(config-router)#network 176.16.1.0
r1(config-router)#exit //退出 RIP 协议配置模式
r1(config)#
4.同理,路由器router1(右边)的配置代码
Router>enable
Router#conf t
Router(config)#int fa0/0
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int se2/0
Router(config-if)#ip address 176.16.1.2 255.255.255.0
Router(config-if)#clock rate 64000
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 192.168.2.0
Router(config-router)#network 176.16.1.0
Router(config-router)#exit
Router(config)#
【测试连通性】pc0与pc2,pc3的连通性