用于主逻辑系统的路由和接口
逻辑系统允许您配置接口、路由实例和路由协议。主逻辑系统管理员可显示或清除所有逻辑系统的路由协议参数,而用户逻辑系统的管理员可以为其自己的逻辑系统显示或清除这些协议参数。有关更多信息,请参阅以下主题:
了解逻辑系统接口和路由实例
设备上的逻辑接口由主管理员在用户逻辑系统之间分配。用户逻辑系统管理员配置接口的属性(包括 IP 地址)并将其分配给路由实例和区域。
路由实例是路由表、接口和路由协议参数的集合。单个路由实例可以存在多个路由表,例如,单个路由实例中可以存在单播 IPv4、单播 IPv6 和组播 IPv4 路由表。路由协议参数和选项控制路由表中的信息。
接口和路由实例可以在主逻辑系统和用户逻辑系统中配置。在逻辑系统中配置接口或路由实例与在未为逻辑系统配置的设备上配置接口或路由实例相同。在逻辑系统中创建的任何路由实例仅适用于该逻辑系统。
默认路由实例,主路由实例是指逻辑系统中的主要 inet.0 路由表。主路由实例保留,不能指定为路由实例。默认情况下,路由安装在主路由实例中,除非指定了路由实例。通过在逻辑系统中的 [编辑协议] 和 [编辑路由选项] 层次结构级别包含语句,为主路由实例配置全局路由选项和协议。
您只能在用户逻辑系统中配置虚拟路由器路由实例类型。设备上只能配置一个虚拟专用 LAN 服务 (VPLS) 路由实例类型,并且必须在互连逻辑系统中。
用户逻辑系统管理员可以在用户逻辑系统中配置和查看接口或路由实例的所有属性。主管理员也可以看到用户逻辑系统中某个接口或路由实例的所有属性。
组播是一种“一个源,多个目标”的流量分配方法,这意味着需要从特定来源接收信息的目标接收流量流。主逻辑系统管理员和用户逻辑系统管理员可以配置一个逻辑系统来支持组播应用程序。逻辑系统中可以使用相同的组播配置来将设备配置为组播网络中的节点。
另请参阅
示例:为主和互连逻辑系统配置接口、路由实例和静态路由,为用户逻辑系统配置逻辑隧道接口(仅限主管理员)
本主题介绍主要和互连逻辑系统的接口、静态路由和路由实例配置。它还介绍了用户逻辑系统的逻辑隧道接口配置。
要求
示例使用运行 Junos 操作系统 (Junos OS) 和逻辑系统的 SRX5600 设备。
开始之前:
阅读 SRX 系列逻辑系统主管理员配置任务概述 ,了解此过程在整体主管理员配置过程中的适用方式和位置。
概述
此场景显示如何为设备上的逻辑系统(包括互连逻辑系统)配置接口。
对于互连逻辑系统,该示例配置逻辑隧道接口 lt-0/0/0.0、lt-0/0/0.2、lt-0/0/0.4 和 lt-0/0/0.6。该示例配置名为 vr-ic 的路由实例,并将接口分配给该实例。
由于互连逻辑系统充当虚拟交换机,因此配置为虚拟专用 LAN 服务 (VPLS) 路由实例类型。互连逻辑系统的 lt-0/0/0 接口配置以太网-vpls 作为封装类型。主和用户逻辑系统中相应的对等方 lt-0/0/0 接口配置为封装类型。
lt-0/0/0.0 连接到根逻辑系统上的 lt-0/0/0.1。
lt-0/0/0.2 连接到 ls-product-design 逻辑系统上的 lt-0/0/0.3。
lt-0/0/0.4 连接到 ls-marketing-dept 逻辑系统上的 lt-0/0/0.5。
lt-0/0/0.6 连接到 ls-accounting-dept 逻辑系统上的 lt-0/0/0.7。
对于称为 root-logical-system 的主逻辑系统,该示例配置 ge-0/0/4.0 并将其分配给 vr1-root 路由实例。示例将 lt-0/0/0.1 配置为连接到互连逻辑系统上的 lt-0/0/0.0,并将其分配给 vr1-root 路由实例。此示例将静态路由配置为允许与其他逻辑系统通信,并将其分配给 vr1-root 路由实例。
对于 ls-product-design 逻辑系统,示例将 lt-0/0/0.3 配置为连接到互连逻辑系统上的 lt-0/0/0.2。
对于 ls-marketing-dept 逻辑系统,该示例将配置 lt-0/0/0.5 连接到互连逻辑系统上的 lt-0/0/0.4。
对于 ls-accounting-dept 逻辑系统,该示例配置 lt-0/0/0.7 以连接到互连逻辑系统上的 lt-0/0/0.6。
图 1 显示了此部署的拓扑,包括用于所有逻辑系统的虚拟路由器及其接口。
拓扑

配置
本主题介绍如何为逻辑系统配置接口。
为互连逻辑系统配置逻辑隧道接口和路由实例
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入 commit
。
set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 0 encapsulation ethernet-vpls set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 0 peer-unit 1 set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 2 encapsulation ethernet-vpls set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 2 peer-unit 3 set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 4 encapsulation ethernet-vpls set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 4 peer-unit 5 set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 6 encapsulation ethernet-vpls set logical-systems interconnect-logical-system interfaces lt-0/0/0 unit 6 peer-unit 7 set logical-systems interconnect-logical-system routing-instances vr-ic instance-type vpls set logical-systems interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.0 set logical-systems interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.2 set logical-systems interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.4 set logical-systems interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.6
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关如何操作的说明,请参阅 Junos OS CLI 用户指南 中的在配置模式下使用 CLI 编辑器 。
要配置互连系统 lt-0/0/0 接口和路由实例:
配置 lt-0/0/0 接口。
[edit logical-systems] user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 0 encapsulation ethernet-vpls user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 0 peer-unit 1 user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 2 encapsulation ethernet-vpls user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 2 peer-unit 3 user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 4 encapsulation ethernet-vpls user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 4 peer-unit 5 user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 6 encapsulation ethernet-vpls user@host# set interconnect-logical-system interfaces lt-0/0/0 unit 6 peer-unit 7
为互连逻辑系统配置路由实例,并将其 lt-0/0/0 接口添加到其中。
[edit logical-systems] user@host# set interconnect-logical-system routing-instances vr-ic instance-type vpls user@host# set interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.0 user@host# set interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.2 user@host# set interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.4 user@host# set interconnect-logical-system routing-instances vr-ic interface lt-0/0/0.6
结果
在配置模式下,输入命令以确认 show logical-systems interconnect-logical-system
您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
完成设备配置后,请从配置模式进入 commit
。
user@host# show logical-systems interconnect-logical-system interfaces { lt-0/0/0 { unit 0 { encapsulation ethernet-vpls; peer-unit 1; } unit 2 { encapsulation ethernet-vpls; peer-unit 3; } unit 4 { encapsulation ethernet-vpls; peer-unit 5; } unit 6 { encapsulation ethernet-vpls; peer-unit 7; } } } routing-instances { vr-ic { instance-type vpls; interface lt-0/0/0.0; interface lt-0/0/0.2; interface lt-0/0/0.4; interface lt-0/0/0.6; } }
为主逻辑系统配置接口、路由实例和静态路由
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入 commit
。
set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 600 set interfaces ge-0/0/4 unit 0 family inet address 50.1.1.1/24 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/6 vlan-tagging set interfaces ge-0/0/7 vlan-tagging set interfaces lt-0/0/0 unit 1 encapsulation ethernet set interfaces lt-0/0/0 unit 1 peer-unit 0 set interfaces lt-0/0/0 unit 1 family inet address 10.0.1.1/24 set routing-instances vr1-root instance-type virtual-router set routing-instances vr1-root interface ge-0/0/4.0 set routing-instances vr1-root interface lt-0/0/0.1 set routing-instances vr1-root routing-options static route 12.1.1.0/24 next-hop 10.0.1.2 set routing-instances vr1-root routing-options static route 13.1.1.0/24 next-hop 10.0.1.3 set routing-instances vr1-root routing-options static route 14.1.1.0/24 next-hop 10.0.1.4
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关操作说明,请参阅 在配置模式下使用 CLI 编辑器。
要配置主逻辑系统接口:
配置主(根)逻辑接口和 lt-0/0/0.1 接口。
[edit interfaces] user@host# set ge-0/0/4 vlan-tagging user@host# set ge-0/0/4 unit 0 vlan-id 600 user@host# set ge-0/0/4 unit 0 family inet address 50.1.1.1/24 user@host# set lt-0/0/0 unit 1 encapsulation ethernet user@host# set lt-0/0/0 unit 1 peer-unit 0 user@host# set lt-0/0/0 unit 1 family inet address 10.0.1.1/24
配置其他逻辑系统的接口以支持 VLAN 标记。
[edit interfaces] user@host# set ge-0/0/5 vlan-tagging user@host# set ge-0/0/6 vlan-tagging user@host# set ge-0/0/7 vlan-tagging
为主逻辑系统配置路由实例,为其分配接口,并为其配置静态路由。
[edit routing-instances] user@host# set vr1-root instance-type virtual-router user@host# set vr1-root interface ge-0/0/4.0 user@host# set vr1-root interface lt-0/0/0.1 user@host# set vr1-root routing-options static route 12.1.1.0/24 next-hop 10.0.1.2 user@host# set vr1-root routing-options static route 13.1.1.0/24 next-hop 10.0.1.3 user@host# set vr1-root routing-options static route 14.1.1.0/24 next-hop 10.0.1.4
结果
在配置模式下,输入和 show routing-instances
命令以确认show interfaces
您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
[edit] user@host# show interfaces ge-0/0/4 { vlan-tagging; unit 0 { vlan-id 600; family inet { address 50.1.1.1/24; } } } ge-0/0/5 { vlan-tagging; } ge-0/0/6 { vlan-tagging; } ge-0/0/7 { vlan-tagging; } lt-0/0/0 { unit 1 { encapsulation ethernet; peer-unit 0; family inet { address 10.0.1.1/24; } } }
[edit] user@host# show routing-instances vr1-root { instance-type virtual-router; interface ge-0/0/4.0; interface lt-0/0/0.1; routing-options { static { route 14.1.1.0/24 next-hop 10.0.1.4; route 12.1.1.0/24 next-hop 10.0.1.2; route 13.1.1.0/24 next-hop 10.0.1.3; } } }
完成设备配置后,请从配置模式进入 commit
。
为用户逻辑系统配置逻辑隧道接口
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入 commit
。
set logical-systems ls-product-design interfaces lt-0/0/0 unit 3 encapsulation ethernet set logical-systems ls-product-design interfaces lt-0/0/0 unit 3 peer-unit 2 set logical-systems ls-product-design interfaces lt-0/0/0 unit 3 family inet address 10.0.1.2/24 set logical-systems ls-marketing-dept interfaces lt-0/0/0 unit 5 encapsulation ethernet set logical-systems ls-marketing-dept interfaces lt-0/0/0 unit 5 peer-unit 4 set logical-systems ls-marketing-dept interfaces lt-0/0/0 unit 5 family inet address 10.0.1.3/24 set logical-systems ls-accounting-dept interfaces lt-0/0/0 unit 7 encapsulation ethernet set logical-systems ls-accounting-dept interfaces lt-0/0/0 unit 7 peer-unit 6 set logical-systems ls-accounting-dept interfaces lt-0/0/0 unit 7 family inet address 10.0.1.4/24
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关操作说明,请参阅 在配置模式下使用 CLI 编辑器。
为第一个用户逻辑系统配置 lt-0/0/0 接口:
[edit logical-systems] user@host# set ls-product-design interfaces lt-0/0/0 unit 3 encapsulation ethernet user@host# set ls-product-design interfaces lt-0/0/0 unit 3 peer-unit 2 user@host# set ls-product-design interfaces lt-0/0/0 unit 3 family inet address 10.0.1.2/24
为第二个用户逻辑系统配置 lt-0/0/0 接口。
[edit logical-systems] user@host# set ls-marketing-dept interfaces lt-0/0/0 unit 5 encapsulation ethernet user@host# set ls-marketing-dept interfaces lt-0/0/0 unit 5 peer-unit 4 user@host# set ls-marketing-dept interfaces lt-0/0/0 unit 5 family inet address 10.0.1.3/24 face
为第三个用户逻辑系统配置 lt-0/0/0 接口。
[edit logical-systems] user@host# set ls-accounting-dept interfaces lt-0/0/0 unit 7 encapsulation ethernet user@host# set ls-accounting-dept interfaces lt-0/0/0 unit 7 peer-unit 6 user@host# set ls-accounting-dept interfaces lt-0/0/0 unit 7 family inet address 10.0.1.4/24
结果
在配置模式下,输入 、 show logical-systems ls-marketing-dept interfaces lt-0/0/0
和show logical-systems ls-accounting-dept interfaces lt-0/0/0
命令, show logical-systems ls-product-design interfaces lt-0/0/0
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
user@host# show logical-systems ls-product-design interfaces lt-0/0/0
lt-0/0/0 { unit 3 { encapsulation ethernet; peer-unit 2; family inet { address 10.0.1.2/24; } } } user@host# show logical-systems ls-marketing-dept interfaces lt-0/0/0 lt-0/0/0 { unit 5 { encapsulation ethernet; peer-unit 4; family inet { address 10.0.1.3/24; } } } } user@host# show logical-systems ls-accounting-dept interfaces lt-0/0/0 lt-0/0/0 { unit 7 { encapsulation ethernet; peer-unit 6; family inet { address 10.0.1.4/24; } } }
完成设备配置后,请从配置模式进入 commit
。
示例:为主逻辑系统配置 OSPF 路由协议
此示例说明如何为主逻辑系统配置 OSPF。
要求
开始之前:
以主管理员身份登录到主逻辑系统。请参阅 示例:为逻辑系统配置 root 密码。
为主逻辑系统配置逻辑接口 ge-0/0/4.0 和 lt-0/0/0.1,并将其分配给 vr1-root 路由实例。请参阅 示例:为主和互连逻辑系统配置接口、路由实例和静态路由,以及为用户逻辑系统配置逻辑隧道接口(仅限主管理员)。
概述
在此示例中,您可以为称为根逻辑系统的主逻辑系统(称为根逻辑系统)配置 OSPF,如 示例:创建用户逻辑系统、其管理员、用户和互连逻辑系统所示。
此示例在主逻辑系统中的 ge-0/0/4.0 和 lt-0/0/0.1 接口上启用 OSPF 路由。您可以配置以下路由策略,以将路由从 Junos OS 路由表导出到 vr1-root 路由实例中的 OSPF:
ospf-redist-direct - 从直接连接的接口学习的路由。
ospf-redist-static - 静态路由。
ospf-to-ospf — 从 OSPF 学习的路由。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
set policy-options policy-statement ospf-redist-direct from protocol direct set policy-options policy-statement ospf-redist-direct then accept set policy-options policy-statement ospf-redist-static from protocol static set policy-options policy-statement ospf-redist-static then accept set policy-options policy-statement ospf-to-ospf from protocol ospf set policy-options policy-statement ospf-to-ospf then accept set routing-instances vr1-root protocols ospf export ospf-redist-direct set routing-instances vr1-root protocols ospf export ospf-redist-static set routing-instances vr1-root protocols ospf export ospf-to-ospf set routing-instances vr1-root protocols ospf area 0.0.0.1 interface ge-0/0/4.0 set routing-instances vr1-root protocols ospf area 0.0.0.1 interface lt-0/0/0.1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关如何操作的说明,请参阅 Junos OS CLI 用户指南 中的在配置模式下使用 CLI 编辑器 。
要为主逻辑系统配置 OSPF:
以主管理员身份登录主逻辑系统并进入配置模式。
admin@host> configure admin@host#
创建接受路由的路由策略。
[edit policy-options] admin@host# set policy-statement ospf-redist-direct from protocol direct admin@host# set policy-statement ospf-redist-direct then accept admin@host# set policy-statement ospf-redist-static from protocol static admin@host# set policy-statement ospf-redist-static then accept admin@host# set policy-statement ospf-to-ospf from protocol ospf admin@host# set policy-statement ospf-to-ospf then accept
将路由策略应用于从 Junos OS 路由表导出到 OSPF 的路由。
[edit routing-instances] admin@host# set vr1-root protocols ospf export ospf-redist-direct admin@host# set vr1-root protocols ospf export ospf-redist-static admin@host# set vr1-root protocols ospf export ospf-to-ospf
在逻辑接口上启用 OSPF。
[edit routing-instances] admin@host# set vr1-root protocols ospf area 0.0.0.1 interface ge-0/0/4.0 admin@host# set vr1-root protocols ospf area 0.0.0.1 interface lt-0/0/0.1
结果
在配置模式下,输入和 show routing-instances
命令以确认show policy-options
您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
为简洁起想,此命令 show
输出仅包含与此示例相关的配置。系统上的任何其他配置都已替换为椭圆 (...)。
[edit] admin@host# show policy-options policy-statement ospf-redist-direct { from protocol direct; then accept; } policy-statement ospf-redist-static { from protocol static; then accept; } policy-statement ospf-to-ospf { from protocol ospf; then accept; } [edit] admin@host# show routing-instances vr1-root { ... protocols { ospf { export [ ospf-redist-direct ospf-to-ospf ospf-redist-static ]; area 0.0.0.1 { interface lt-0/0/0.1; interface ge-0/0/4.0; } } } }
完成设备配置后,请从配置模式进入 commit
。
验证
确认配置工作正常。
验证 OSPF 接口
目的
验证支持 OSPF 的接口。
行动
从 CLI 中输入 show ospf interface instance vr1-root
命令。
admin@host> show ospf interface instance vr1-root Interface State Area DR ID BDR ID Nbrs lt-0/0/0.1 DR 0.0.0.0 10.0.1.1 0.0.0.0 0 ge-0/0/4.0 DR 0.0.0.1 10.0.1.1 0.0.0.0 0
验证 OSPF 邻接方
目的
验证 OSPF 邻接方。
行动
从 CLI 中输入 show ospf neighbor instance vr1-root
命令。
admin@host> show ospf neighbor instance vr1-root Address Interface State ID Pri Dead 10.0.1.2 plt0.3 Full 0.0.0.0 128 39
验证 OSPF 路由
目的
验证 OSPF 路由。
行动
从 CLI 中输入 show ospf route instance vr1-root
命令。
admin@host> show ospf route instance vr1-root Topology default Route Table: Prefix Path Route NH Metric NextHop Nexthop Type Type Type Interface Address/LSP 10.0.1.0/24 Intra Network IP 1 lt-0/0/0.1 12.12.1.0/24 Intra Network IP 1 ge-0/0/4.0