配置IP路由汇总
实验环境
网络拓扑如下图所示,A总公司与分公司通过光纤连接。A总公司分为生产区和办公区两部分,其中生产区有车间1、车间2、库房等部门,办公区有销售部、综合部等部门。A总公司各部门所有主机数分别为:车间1有30台主机、车间2有40台主机、仓库有10台主机、销售部有60台主机、综合部有20台主机。A分公司也分为两个区:生产区和办公区,其具体情况和总公司相似。
在实验配置时,使用路由Loopback监控模拟各部门主机,具体规定如下。
A总公司使用R2路由器Loopback0模拟车间1主机、Loopback1模拟车间2主机、Loopback2库房主机、R3路由器Loopback0模拟销售部主机、Loopback1模拟综合部主机。
A分公司使用R4路由器Loopback0模拟生产区主机、Loopback1模拟办公区主机
需求描述
A公司已经对IP地址进行了规划,从IP地址规划情况来看,可以在R1上配置汇总的静态路由减少配置。
具体配置
R1上的配置
Router>en 进入特权模式
Router#conf t 进入全局模式
Router(config)#ho r1 更改设备名称为R1
r1(config)#no ip do lo 关闭域名解析
r1(config)#lin 0 进入控制台
r1(config-line)#no exec-t 关闭超时
r1(config-line)#logg s 关闭日志同步
r1(config-line)#int f0/0 进入F0/0接口
r1(config-if)#ip add 192.168.0.9 255.255.255.252 配置IP和掩码
r1(config-if)#no shut 开启接口
r1(config-if)#int f1/0 进入F1/0接口
r1(config-if)#ip add 192.168.0.1 255.255.255.252 配置IP和掩码
r1(config-if)#no shut 开启接口
r1(config-if)#int f2/0 进入F2/0接口
r1(config-if)#ip add 192.168.0.5 255.255.255.252 配置IP和掩码
r1(config-if)#no shut 开启接口
r1(config-if)#exit 返回全局模式
r1(config)#ip route 192.168.4.0 255.255.255.0 192.168.0.2 配置去往车间1、车间2和仓库的汇总路由
r1(config)#ip route 192.168.6.0 255.255.255.0 192.168.0.6 配置去入销售部和综合部的汇总路由
r1(config)#ip route 192.168.128.0 255.255.252.0 192.168.0.10 配置去往生产区和办公区的汇总路由
r1(config)#
R2上的配置
Router>en 进入特权模式
Router#conf t 进入全局模式
Router(config)#ho r2 更改设备名称为R2
r2(config)#no ip do lo 关闭域名解析
r2(config)#lin 0 进入控制台
r2(config-line)#no exec-t 关闭超时
r2(config-line)#logg s 关闭日志同步
r2(config-line)#int f0/0 进入F0/0接口
r2(config-if)#ip add 192.168.0.2 255.255.255.252 配置IP和掩码
r2(config-if)#no shut 开启接口
r2(config-if)#int lo0 进入回环口0 模拟车间1
r2(config-if)#ip add 192.168.4.1 255.255.255.192 配置IP和掩码
r2(config-if)#int lo1 进入回环口1 模拟车间2
r2(config-if)#ip add 192.168.4.65 255.255.255.192 配置IP和掩码
r2(config-if)#int lo2 进入回环口2 模拟仓库
r2(config-if)#ip add 192.168.4.129 255.255.255.224 配置IP和掩码
r2(config-if)#exit 返回全局模式
r2(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.1 配置默认路由
r2(config)#end 返回特权模式
R3上的配置
Router>en 进入特权模式
Router#conf t 进入全局模式
Router(config)#ho r3 更改设备名称为R3
r3(config)#no ip do lo 关闭域名解析
r3(config)#lin 0 进入控制台
r3(config-line)#no exec-t 关闭超时
r3(config-line)#logg s 关闭日志同步
r3(config-line)#int f0/0 进入F0/0接口
r3(config-if)#ip add 192.168.0.6 255.255.255.252 配置IP和掩码
r3(config-if)#no shut 开启接口
r3(config-if)#int lo0 进入回环口0 模拟销售部
r3(config-if)#ip add 192.168.6.1 255.255.255.128 配置IP和掩码
r3(config-if)#int lo1 进入回环口1 模拟综合部
r3(config-if)#ip add 192.168.6.129 255.255.255.224 配置IP和掩码码
r3(config-if)#exit 返回全局模式
r3(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.5 配置默认路由
r3(config)#end 返回特权模式
R4上的配置
Router>en 进入特权模式
Router#conf t 进入全局模式
Router(config)#ho r4 更改设备名称
r4(config)#no ip do lo 关闭域名解析
r4(config)#lin 0 进入控制台
r4(config-line)#no exec-t 关闭超时
r4(config-line)#logg s 关闭日志同步
r4(config-line)#int f0/0 进入F0/0接口
r4(config-if)#ip add 192.168.0.10 255.255.255.252 配置IP和掩码
r4(config-if)#no shut 开启接口
r4(config-if)#int lo0 进入回环0口 模拟生产区
r4(config-if)#ip add 192.168.128.1 255.255.255.0 配置IP和掩码
r4(config-if)#int lo1 进入回环1口 模拟办公区
r4(config-if)#ip add 192.168.130.1 255.255.255.0 配置IP和掩码
r4(config-if)#exit 返回全局模式
r4(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.9 配置默认路由
r4(config)#
下面为在R2和R3上进行PING的测试结果,全部能通,证明汇总路由的正确。
r2#ping 192.168.6.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.6.1, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 68/82/92 ms
r2#ping 192.168.6.129
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.6.129, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/80/136 ms
r2#ping 192.168.128.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.128.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 60/71/84 ms
r2#ping 192.168.130.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.130.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/80/120 ms
r2#
r3#ping 192.168.128.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.128.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/76/104 ms
r3#ping 192.168.130.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.130.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/77/148 ms
r3#