逻辑系统上静态路由
示例:在同一路由器中的逻辑系统之间配置静态路由
此示例展示如何在逻辑系统之间配置静态路由。逻辑系统在单个物理路由器中配置,并且通过逻辑隧道接口连接。
要求
您必须使用逻辑隧道 (lt) 接口连接逻辑系统。请参阅 示例:使用 MX 系列路由器和 EX 系列交换机上的逻辑隧道接口连接 相同设备中的逻辑系统。
概述
静态路由是设备中的硬编码路径,用于指定路由如何使用特定路径进入特定子网。连接到存根网络的路由器通常配置为使用静态路由。存 根 网络是一个不了解其他网络的网络。存根网络通过单个路径发送非本地流量,其中网络仅留意到非本地目标的默认路由。此示例使用到 10.10.10.0/30 网络的静态路由配置逻辑系统 LS1,将下一跃点地址定义为 192.168.10.2。您也可配置逻辑系统 LS1 以及到 192.168.10.0/30 网络的静态路由,并定义 10.10.10.10.1 的下一跃点地址。
配置
CLI快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以匹配网络配置,然后将命令复制并粘贴到 层次结构级别的 CLI 中 [edit]
。
set logical-systems LS1 interfaces lt-1/2/0 unit 0 description LS1->LS2 set logical-systems LS1 interfaces lt-1/2/0 unit 0 encapsulation ethernet set logical-systems LS1 interfaces lt-1/2/0 unit 0 peer-unit 1 set logical-systems LS1 interfaces lt-1/2/0 unit 0 family inet address 192.168.10.1/30 set logical-systems LS2 interfaces lt-1/2/0 unit 1 description LS2->LS1 set logical-systems LS2 interfaces lt-1/2/0 unit 1 encapsulation ethernet set logical-systems LS2 interfaces lt-1/2/0 unit 1 peer-unit 0 set logical-systems LS2 interfaces lt-1/2/0 unit 1 family inet address 192.168.10.2/30 set logical-systems LS2 interfaces lt-1/2/0 unit 9 description LS2->LS3 set logical-systems LS2 interfaces lt-1/2/0 unit 9 encapsulation ethernet set logical-systems LS2 interfaces lt-1/2/0 unit 9 peer-unit 10 set logical-systems LS2 interfaces lt-1/2/0 unit 9 family inet address 10.10.10.1/30 set logical-systems LS3 interfaces lt-1/2/0 unit 10 description LS3->LS2 set logical-systems LS3 interfaces lt-1/2/0 unit 10 encapsulation ethernet set logical-systems LS3 interfaces lt-1/2/0 unit 10 peer-unit 9 set logical-systems LS3 interfaces lt-1/2/0 unit 10 family inet address 10.10.10.2/30 set logical-systems LS1 routing-options static route 10.10.10.0/30 next-hop 192.168.10.2 set logical-systems LS3 routing-options static route 192.168.10.0/30 next-hop 10.10.10.1
程序
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航指南CLI,请参阅 CLI 用户指南 中的 在配置模式下CLI 编辑器。
要配置逻辑系统之间的静态路由,
运行
show interfaces terse
命令以验证路由器是否具有逻辑隧道 (lt) 接口。user@host> show interfaces terse Interface Admin Link Proto Local Remote so-0/0/0 up down so-0/0/1 up down so-0/0/2 up down so-0/0/3 up down gr-1/2/0 up up ip-1/2/0 up up lt-1/2/0 up up ...
配置逻辑系统 LS1 上连接到逻辑系统 LS2 的逻辑隧道接口。
[edit] user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 description LS1->LS2 user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 encapsulation ethernet user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 peer-unit 1 user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 family inet address 192.168.10.1/30
配置逻辑系统 LS2 上连接到逻辑系统 LS1 的逻辑隧道接口。
[edit] user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 description LS2->LS1 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 encapsulation ethernet user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 peer-unit 0 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 family inet address 192.168.10.2/30
配置逻辑系统 LS2 上连接到逻辑系统 LS3 的逻辑隧道接口。
[edit] user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 9 description LS2->LS3 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 9 encapsulation ethernet user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 9 peer-unit 10 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 9 family inet address 10.10.10.1/30
配置逻辑系统 LS3 上连接到逻辑系统 LS2 的逻辑隧道接口。
[edit] user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 10 description LS3->LS2 user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 10 encapsulation ethernet user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 10 peer-unit 9 user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 10 family inet address 10.10.10.2/30
配置逻辑系统 LS1 上连接到 10.10.10.0/30 网络的静态路由。
[edit] user@host# set logical-systems LS1 routing-options static route 10.10.10.0/30 next-hop 192.168.10.2
配置连接到 192.168.10.0/30 网络的逻辑系统 LS3 上的静态路由。
[edit] user@host# set logical-systems LS3 routing-options static route 192.168.10.0/30 next-hop 10.10.10.1
如果完成设备配置,请提交配置。
[edit] user@host# commit
结果
发出 命令以确认您的 show logical-systems
配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@host# show logical-systems LS1 { interfaces { lt-1/2/0 { unit 0 { description LS1->LS2; encapsulation ethernet; peer-unit 1; family inet { address 192.168.10.1/30; } } } } routing-options { static { route 10.10.10.0/30 next-hop 192.168.10.2; } } } LS2 { interfaces { lt-1/2/0 { unit 1 { description LS2->LS1; encapsulation ethernet; peer-unit 0; family inet { address 192.168.10.2/30; } } unit 9 { description LS2->LS3; encapsulation ethernet; peer-unit 10; family inet { address 10.10.10.1/30; } } } } } LS3 { interfaces { lt-1/2/0 { unit 10 { description LS3->LS2; encapsulation ethernet; peer-unit 9; family inet { address 10.10.10.2/30; } } } } routing-options { static { route 192.168.10.0/30 next-hop 10.10.10.1; } } }
验证
确认配置工作正常。
验证逻辑系统是否启动
目的
确保接口配置正确。
行动
user@host> show interfaces terse Interface Admin Link Proto Local Remote ... lt-1/2/0 up up lt-1/2/0.0 up up inet 192.168.10.1/30 lt-1/2/0.1 up up inet 192.168.10.2/30 lt-1/2/0.9 up up inet 10.10.10.1/30 lt-1/2/0.10 up up inet 10.10.10.2/30 ...
验证逻辑系统间的连接
目的
确保静态路由显示在逻辑系统 LS1 和 LS3 的路由表中。此外,请确保逻辑系统可以彼此 ping。
行动
user@host> show route logical-system LS1 inet.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.10.0/30 *[Static/5] 18:43:25 > to 192.168.10.2 via lt-1/2/0.0 192.168.10.0/30 *[Direct/0] 18:43:25 > via lt-1/2/0.0 192.168.10.1/32 *[Local/0] 18:43:25 Local via lt-1/2/0.0
user@host> show route logical-system LS3 inet.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.10.0/30 *[Direct/0] 23:11:21 > via lt-1/2/0.10 10.10.10.2/32 *[Local/0] 23:11:21 Local via lt-1/2/0.10 192.168.10.0/30 *[Static/5] 00:23:31 > to 10.10.10.1 via lt-1/2/0.10
从 LS1,Ping LS3
user@host> set cli logical-system LS1
user@host:LS1> ping 10.10.10.2 PING 10.10.10.2 (10.10.10.2): 56 data bytes 64 bytes from 10.10.10.2: icmp_seq=0 ttl=63 time=1.263 ms 64 bytes from 10.10.10.2: icmp_seq=1 ttl=63 time=1.086 ms 64 bytes from 10.10.10.2: icmp_seq=2 ttl=63 time=1.077 ms
从 LS3,Ping LS1
user@host> set cli logical-system LS3
user@host:LS3> ping 192.168.10.1 PING 192.168.10.1 (192.168.10.1): 56 data bytes 64 bytes from 192.168.10.1: icmp_seq=0 ttl=63 time=10.781 ms 64 bytes from 192.168.10.1: icmp_seq=1 ttl=63 time=1.167 ms 64 bytes from 192.168.10.1: icmp_seq=2 ttl=63 time=1.152 ms