基本 RIP 配置
RIP 配置概述
要实现 RIP 网络中的所有 RIP 主机之间的基本连接,您可以在预计传输和接收 RIP 流量的每个接口上启用 RIP,如下步骤所述。
要配置 RIP 网络:
- 配置网络接口。请参阅 安全设备的 Junos OS 接口配置指南。
- 定义 RIP 组,这是接口的逻辑分组,并将接口添加到这些组。然后,配置路由策略以导出直接连接的路由以及通过 RIP 路由交换了解的路由。请参阅 示例:配置基本 RIP 网络。
- (可选)配置指标以控制通过 RIP 网络的流量。请参阅 示例:使用传入指标控制 RIP 网络中的流量 和 示例:使用传出指标控制 RIP 网络中流量。
- (可选)配置身份验证以确保只有可信路由器参与自治系统的路由。请参阅启用纯文本密码身份验证和启用 MD5 身份验证(CLI 过程)。
另请参阅
了解基本 RIP 路由
RIP 是一种内部网关协议 (IGP),可在单个自治系统 (AS) 内路由数据包。默认情况下,RIP 不会播发通过设备接口直接连接的子网。要通过 RIP 网络的流量,必须创建路由策略以导出这些路由。仅播发直接路由只会将路由传播到支持 RIP 的相邻路由器。要在整个 RIP 网络中传播所有路由,必须配置路由策略,以导出通过 RIP 学习的路由。
另请参阅
示例:配置基本 RIP 网络
此示例说明如何配置基本 RIP 网络。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
概述
在此示例中,您将配置基本 RIP 网络,创建称为 rip-group 的 RIP 组,并将直接连接的接口添加到 RIP 组。然后,配置路由策略以使用策略语句 播发路由-through-rip 播发直接路由。
默认情况下,Junos OS 不会播发 RIP 路由,甚至不会播发通过 RIP 学习的路由。要播发 RIP 路由,必须配置并应用用于播发 RIP 学习和直接路由的导出路由策略。
在 Junos OS 中,无需配置 RIP 版本。默认使用 RIP 版本 2。
要在设备上使用 RIP,必须在网络中的所有 RIP 接口上配置 RIP。 图 1 显示了此示例中使用的拓扑。
CLI 快速配置 显示了 图 1 中所有设备的配置。第 #d48e72__d48e193 节介绍了设备 R1 上的步骤。
拓扑
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入提交。
设备 R1
set interfaces fe-1/2/0 unit 1 family inet address 10.0.0.1/30 set interfaces lo0 unit 1 family inet address 172.16.0.1/32 set interfaces lo0 unit 1 family inet address 192.168.1.1/32 set protocols rip group rip-group export advertise-routes-through-rip set protocols rip group rip-group neighbor fe-1/2/0.1 set policy-options policy-statement advertise-routes-through-rip term 1 from protocol direct set policy-options policy-statement advertise-routes-through-rip term 1 from protocol rip set policy-options policy-statement advertise-routes-through-rip term 1 then accept
设备 R2
set interfaces fe-1/2/0 unit 2 family inet address 10.0.0.2/30 set interfaces fe-1/2/1 unit 5 family inet address 10.0.0.5/30 set interfaces lo0 unit 2 family inet address 192.168.2.2/32 set interfaces lo0 unit 2 family inet address 172.16.2.2/32 set protocols rip group rip-group export advertise-routes-through-rip set protocols rip group rip-group neighbor fe-1/2/0.2 set protocols rip group rip-group neighbor fe-1/2/1.5 set policy-options policy-statement advertise-routes-through-rip term 1 from protocol direct set policy-options policy-statement advertise-routes-through-rip term 1 from protocol rip set policy-options policy-statement advertise-routes-through-rip term 1 then accept
设备 R3
set interfaces fe-1/2/0 unit 6 family inet address 10.0.0.6/30 set interfaces lo0 unit 3 family inet address 192.168.3.3/32 set interfaces lo0 unit 3 family inet address 172.16.3.3/32 set protocols rip group rip-group export advertise-routes-through-rip set protocols rip group rip-group neighbor fe-1/2/0.6 set policy-options policy-statement advertise-routes-through-rip term 1 from protocol direct set policy-options policy-statement advertise-routes-through-rip term 1 from protocol rip set policy-options policy-statement advertise-routes-through-rip term 1 then accept
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置基本 RIP 网络:
配置网络接口。
此示例显示了多个用于模拟附加网络的环路接口地址。
[edit interfaces] user@R1# set fe-1/2/0 unit 1 family inet address 10.0.0.1/30 user@R1# set lo0 unit 1 family inet address 172.16.0.1/32 user@R1# set lo0 unit 1 family inet address 192.168.1.1/32
创建 RIP 组并添加接口。
要在 Junos OS 中配置 RIP,必须配置一个包含启用了 RIP 的接口的组。无需在环路接口上启用 RIP。
[edit protocols rip group rip-group] user@R1# set neighbor fe-1/2/0.1
创建路由策略以播发直接路由和 RIP 学习路由。
[edit policy-options policy-statement advertise-routes-through-rip term 1] user@R1# set from protocol direct user@R1# set from protocol rip user@R1# set then accept
应用路由策略。
在 Junos OS 中,只能在组级别应用 RIP 导出策略。
[edit protocols rip group rip-group] user@R1# set export advertise-routes-through-rip
结果
在配置模式下,输入 、 show protocols
和show policy-options
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
user@R1# show interfaces
fe-1/2/0 {
unit 1 {
family inet {
address 10.0.0.1/30;
}
}
}
lo0 {
unit 1 {
family inet {
address 172.16.0.1/32;
address 192.168.1.1/32;
}
}
}
user@R1# show protocols
rip {
group rip-group {
export advertise-routes-through-rip;
neighbor fe-1/2/0.1;
}
}
user@R1# show policy-options
policy-statement advertise-routes-through-rip {
term 1 {
from protocol [ direct rip ];
then accept;
}
}
完成设备配置后,请在配置模式下输入 提交 。
验证
确认配置工作正常。
检查路由表
目的
验证路由表是否填充了预期的路由。。
行动
在操作模式下,输入 show route protocol rip
命令。
user@R1> show route protocol rip inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.4/30 *[RIP/100] 00:59:15, metric 2, tag 0 > to 10.0.0.2 via fe-1/2/0.1 172.16.2.2/32 *[RIP/100] 02:52:48, metric 2, tag 0 > to 10.0.0.2 via fe-1/2/0.1 172.16.3.3/32 *[RIP/100] 00:45:05, metric 3, tag 0 > to 10.0.0.2 via fe-1/2/0.1 192.168.2.2/32 *[RIP/100] 02:52:48, metric 2, tag 0 > to 10.0.0.2 via fe-1/2/0.1 192.168.3.3/32 *[RIP/100] 00:45:05, metric 3, tag 0 > to 10.0.0.2 via fe-1/2/0.1 224.0.0.9/32 *[RIP/100] 00:45:09, metric 1 MultiRecv
意义
输出显示,已从设备 R2 和设备 R3 获知路由。
如果要删除设备 R2 上的路由策略中的从 协议撕裂 条件,则设备 R3 的远程路由不会在设备 R1 上学习。
查看设备 R1 向设备 R2 传播的路由
目的
验证设备 R1 是否正在发送预期的路由。
行动
在操作模式下,输入 show route advertising-protocol rip
命令。
user@R1> show route advertising-protocol rip 10.0.0.1 inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 172.16.0.1/32 *[Direct/0] 05:18:26 > via lo0.1 192.168.1.1/32 *[Direct/0] 05:18:25 > via lo0.1
意义
设备 R1 正在向其直连网络发送路由。
查看设备 R1 从设备 R2 接收的路由
目的
验证设备 R1 是否接收预期的路由。
行动
在操作模式下,输入 show route receive-protocol rip
命令。
user@R1> show route receive-protocol rip 10.0.0.2 inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.4/30 *[RIP/100] 02:31:22, metric 2, tag 0 > to 10.0.0.2 via fe-1/2/0.1 172.16.2.2/32 *[RIP/100] 04:24:55, metric 2, tag 0 > to 10.0.0.2 via fe-1/2/0.1 172.16.3.3/32 *[RIP/100] 02:17:12, metric 3, tag 0 > to 10.0.0.2 via fe-1/2/0.1 192.168.2.2/32 *[RIP/100] 04:24:55, metric 2, tag 0 > to 10.0.0.2 via fe-1/2/0.1 192.168.3.3/32 *[RIP/100] 02:17:12, metric 3, tag 0 > to 10.0.0.2 via fe-1/2/0.1
意义
设备 R1 从设备 R2 接收所有设备 R2 直连网络。设备 R1 还从设备 R2 接收设备 R3 的所有直连网络,设备 R2 从设备 R3 到 RIP 学习这些网络。
验证支持 RIP 的接口
目的
验证所有支持 RIP 的接口都可用且处于活动状态。
行动
在操作模式下,输入 show rip neighbor
命令。
user@R1> show rip neighbor Local Source Destination Send Receive In Neighbor State Address Address Mode Mode Met -------- ----- ------- ----------- ---- ------- --- fe-1/2/0.1 Up 10.0.0.1 224.0.0.9 mcast both 1
意义
输出显示设备 R1 上启用 RIP 的接口可正常运行。
通常,对于此命令,输出显示设备上配置的 RIP 邻接方列表。验证以下信息:
每个配置的接口都存在。接口按字母顺序列出。
每个配置的接口都已启动。接口的状态列在 “本地状态 ”列中。 “Up” 状态表示链路正在传递 RIP 流量。 Dn 状态表示链路未传递 RIP 流量。在点对点链路中,此状态通常表示端点未为 RIP 配置,或者链路不可用。
验证 RIP 消息交换
目的
验证是否在所有支持 RIP 的接口上发送和接收 RIP 消息。
行动
在操作模式下,输入 show rip statistics
命令。
user@R1> show rip statistics RIPv2 info: port 520; holddown 120s. rts learned rts held down rqsts dropped resps dropped 5 0 0 0 fe-1/2/0.1: 5 routes learned; 2 routes advertised; timeout 180s; update interval 30s Counter Total Last 5 min Last minute ------- ----------- ----------- ----------- Updates Sent 2669 10 2 Triggered Updates Sent 2 0 0 Responses Sent 0 0 0 Bad Messages 0 0 0 RIPv1 Updates Received 0 0 0 RIPv1 Bad Route Entries 0 0 0 RIPv1 Updates Ignored 0 0 0 RIPv2 Updates Received 2675 11 2 RIPv2 Bad Route Entries 0 0 0 RIPv2 Updates Ignored 0 0 0 Authentication Failures 0 0 0 RIP Requests Received 0 0 0 RIP Requests Ignored 0 0 0 none 0 0 0
意义
输出显示学习的 RIP 路由数量。它还显示了在支持 RIP 的接口上发送和接收的 RIP 更新数量。验证以下信息:
学习的 RIP 路由数与学习的预期路由数量匹配。通过传出接口通过直接连接学习的子网不会列为 RIP 路由。
每个支持 RIP 的接口上都会发送 RIP 更新。如果未发送任何更新,则可能无法将路由策略配置为导出路由。
每个支持 RIP 的接口上都会收到 RIP 更新。如果未收到任何更新,则可能无法将路由策略配置为导出连接到该子网的主机上的路由。缺少更新也可能表示身份验证错误。
验证 RIP 网络中所有主机的可访问性
目的
traceroute
对网络中的每个环路地址使用命令验证 RIP 网络中的所有主机是否可以从每台瞻博网络设备访问。
行动
在操作模式下,输入 traceroute
命令。
user@R1> traceroute 192.168.3.3 traceroute to 192.168.3.3 (192.168.3.3), 30 hops max, 40 byte packets 1 10.0.0.2 (10.0.0.2) 1.094 ms 1.028 ms 0.957 ms 2 192.168.3.3 (192.168.3.3) 1.344 ms 2.245 ms 2.125 ms
意义
输出中的每个编号行都表示主机路径中的一个路由跃点。三次增量表示设备与每个追踪路由数据包的跃点之间的往返时间 (RTT)。
要确保 RIP 网络正常运行,请验证以下信息:
列表中最后一跃点是您想要联系的主机。
主机的预期跃点数与 traceroute 输出中的跃点数匹配。输出中出现比预期更多的跃点表示某个网段可能无法到达。它还可能表明,一个或多个主机上的传入或传出指标设置意外。