实验拓扑
图 1-1
注:如无特别说明,描述中的 R1 或 SW1 对应拓扑中设备名称末尾数字为 1 的设备,R2 或 SW2 对应拓扑中设备名称末尾数字为 2 的设备,以此类推;另外,同一网段中,IP 地址的主机位为其设备编号,如 R3 的 g0/0 接口若在
192.168.1.0/24
网段,则其 IP 地址为192.168.1.3/24
,以此类推
实验需求
-
按照图示配置 IP 地址
-
配置 RIP 实现全网路由互通
-
要求全网路由器不能出现明细路由(直连网段除外),不影响网络正常访问
-
业务网段不允许出现协议报文
-
R1 和 R2 之间需要开启接口身份验证来保证协议安全性,密钥为
runtime
实验解法
-
配置 IP 地址
R1
[R1]sys [R1]int g0/1 [R1]ip add 172.16.0.1 24 [R1]int g0/2 [R1]ip add 172.16.1.1 24 [R1]int g0/0 [R1]ip add 192.168.1.1 24
R2
[R1]sys [R2]int g0/0 [R2]ip add 192.168.1.2 24 [R2]int g0/1 [R2]ip add 192.168.2.2 24
R3
[R3]sys [R3]int g0/0 [R3]ip add 192.168.2.3 24 [R3]int g0/1 [R3]ip add 172.16.2.3 24 [R3]int g0/2 [R3]ip add 172.16.3.3 24
PC4
PC5
PC6
PC7
2,配置 RIP 实现全网路由互通
分析:实现全网互通,意味着每台路由器都要宣告本地的所有直连网段。RIP 只能做主类宣告,以 R1 为例,连接的两个业务网段属于同一个 B 类主类网段划分出的子网,所以只用宣告一次;而且为了不造成路由环路,需要开启 RIP v2 版本,以支持 VLSM;R3 同理
步骤 1:在 R1,R2,R3 上分别配置 RIP v2,关闭自动聚合,并宣告所有直连网段
[R1]rip 1 [R1-rip-1]version 2 [R1-rip-1]undo summary [R1-rip-1]network 172.16.0.0 [R1-rip-1]network 192.168.1.0
[R2]rip 1 [R2-rip-1]version 2 [R2-rip-1]undo summary [R2-rip-1]network 192.168.1.0 [R2-rip-1]network 192.168.2.0
[R3]rip 1 [R3-rip-1]version 2 [R3-rip-1]undo summary [R3-rip-1]network 172.16.0.0 [R3-rip-1]network 192.168.2.0
步骤 2:在路由器上查看路由表,发现已经学习到了全网明细路由
[R1]dis ip rou
[R2]dis ip rou
[R3]dis ip rou
3,要求全网路由器不能出现明细路由(直连网段除外),不影响网络正常访问
分析:上一步中的 RIP 已经配置完成,但路由器学习到的都是各网段的明细路由。在网络结构庞大的拓扑中,明细路由太多会导致路由器查表效率降低,所以需要配置路由聚合来减少路由数量
RIP 的聚合方式分为自动聚合和手动聚合。自动聚合是聚合为主类网段,在本拓扑中会造成路由环路,所以只能使用手动聚合
R1 连接的 2 个业务网段的路由可以聚合为一条 172.16.0.0/23
,R3连接的 2 个业务网段的路由可以聚合为一条 172.16.2.0/23
,在各自的路由传递的出接口上配置手动聚合
步骤 1:在 R1 的 g0/0 接口配置手动路由聚合
[R1]int g0/0
[R1-GigabitEthernet0/0]rip summary-address 172.16.0.0 23
步骤 2:在 R3 的 g0/0 接口配置手动路由聚合
[R3]int g0/0
[R3-GigabitEthernet0/0]rip summary-address 172.16.2.0 23
步骤 3:在 R2 上查看路由表,发现学习到的是 R1 和 R3 发布的聚合路由
注意:基于 RIP 的工作原理,旧的明细路由需要一定时间延迟才会从路由表中彻底删除
[R2]display ip routing-table
-
业务网段不允许出现协议报文
分析:基于 network
命令的两层含义,R1 和 R3 对直连的业务网段进行宣告后,会往该网段发送 RIP 的协议报文。这些协议报文是完全没有意义的,还会消耗网络带宽,所以需要配置静默接口
步骤 1:把 R1 连接业务网段的 g0/1 和 g0/2 接口配置为静默接口
[R1]rip 1
[R1-rip-1]silent-interface g0/1
[R1-rip-1]silent-interface g0/2
步骤 2:把 R3 连接业务网段的 g0/1 和 g0/2 接口配置为静默接口
[R3]rip 1
[R3-rip-1]silent-interface g0/1
[R3-rip-1]silent-interface g0/2
4,R1 和 R2 之间需要开启接口身份验证来保证协议安全性,密钥为 runtime
步骤 1:在 R1 的 g0/0 接口配置接口验证,密钥 runtime
[R1]int g0/0
[R1-GigabitEthernet0/0]rip authentication-mode simple plain runtime
步骤 2:在 R2 的 g0/0 接口配置接口验证,密钥必须和 R1 一致
[R2]int g0/0
[R2-GigabitEthernet0/0]rip authentication-mode simple plain runtime
说明:通过重置 RIP 进程观察是否能够学习到路由来判断接口验证是否通过
-
save保存后,重启R1与R2.重置需要在用户视图下,过一会。会重新获取rip路由表即为成功
[R1]qu
<R1>save
<R1>The current configuration will be written to the device. Are you sure? [Y/N]:y
<R1>(To leave the existing filename unchanged, press the enter key):回车键
<R1>reboot
<R1>This command will reboot the device. Continue? [Y/N]:y
[R2]qu
<R2>save
<R2>The current configuration will be written to the device. Are you sure? [Y/N]:y
<R2>(To leave the existing filename unchanged, press the enter key):回车键
<R2>reboot
<R2>This command will reboot the device. Continue? [Y/N]:y
[R1]dis ip rou
[R2]dis ip rou
说明:这里页可以通过互相j进行ping 电脑来进行测试,全网段都是通 的
[PC5]ping 172.16.1.5 Ping 172.16.1.5 (172.16.1.5): 56 data bytes, press CTRL_C to break 56 bytes from 172.16.1.5: icmp_seq=0 ttl=255 time=0.495 ms 56 bytes from 172.16.1.5: icmp_seq=1 ttl=255 time=0.756 ms 56 bytes from 172.16.1.5: icmp_seq=2 ttl=255 time=0.568 ms 56 bytes from 172.16.1.5: icmp_seq=3 ttl=255 time=0.682 ms 56 bytes from 172.16.1.5: icmp_seq=4 ttl=255 time=0.707 ms [PC5]ping 172.16.2.6 Ping 172.16.2.6 (172.16.2.6): 56 data bytes, press CTRL_C to break 56 bytes from 172.16.2.6: icmp_seq=0 ttl=253 time=1.610 ms 56 bytes from 172.16.2.6: icmp_seq=1 ttl=253 time=1.588 ms 56 bytes from 172.16.2.6: icmp_seq=2 ttl=253 time=1.409 ms 56 bytes from 172.16.2.6: icmp_seq=3 ttl=253 time=1.668 ms 56 bytes from 172.16.2.6: icmp_seq=4 ttl=253 time=1.078 ms [PC5]ping 172.16.3.7 Ping 172.16.3.7 (172.16.3.7): 56 data bytes, press CTRL_C to break 56 bytes from 172.16.3.7: icmp_seq=0 ttl=253 time=1.522 ms 56 bytes from 172.16.3.7: icmp_seq=1 ttl=253 time=1.529 ms 56 bytes from 172.16.3.7: icmp_seq=2 ttl=253 time=1.365 ms 56 bytes from 172.16.3.7: icmp_seq=3 ttl=253 time=1.345 ms 56 bytes from 172.16.3.7: icmp_seq=4 ttl=253 time=2.223 ms