主逻辑系统的路由和接口
逻辑系统允许您配置接口、路由实例和路由协议。主逻辑系统管理员可以显示或清除所有逻辑系统的路由协议参数,而用户逻辑系统的管理员可以显示或清除其自身逻辑系统的协议参数。有关更多信息,请参阅以下主题:
了解逻辑系统接口和路由实例
设备上的逻辑接口由主管理员在用户逻辑系统之间分配。用户逻辑系统管理员可配置接口的属性,包括 IP 地址,并将其分配给路由实例和区域。
路由实例是路由表、接口和路由协议参数的集合。单个路由实例可以有多个路由表,例如,单个路由实例中可以存在单播 IPv4、单播 IPv6 和组播 IPv4 路由表。路由协议参数和选项控制路由表中的信息。
接口和路由实例可以在主逻辑系统和用户逻辑系统中配置。在逻辑系统中配置接口或路由实例与在未为逻辑系统配置的设备上配置接口或路由实例相同。在逻辑系统中创建的任何路由实例仅适用于该逻辑系统。
默认路由实例 primary 是指逻辑系统中的主 inet.0 路由表。主路由实例是保留的,不能指定为路由实例。默认情况下,路由安装在主路由实例中,除非指定了路由实例。通过在逻辑系统中的 [edit protocols] 和 [edit routing-options] 层次结构级别包含语句,为主路由实例配置全局路由选项和协议。
您只能在用户逻辑系统中配置虚拟路由器路由实例类型。设备上只能配置一种虚拟专用 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 接口配置为 ethernet-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 根路由实例。此示例配置静态路由以允许与其他逻辑系统通信,并将其分配给 vr1 根路由实例。
对于 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 interfaces show routing-instances命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明进行更正。
[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-product-design interfaces lt-0/0/0、 show logical-systems ls-marketing-dept interfaces lt-0/0/0 和 show logical-systems ls-accounting-dept 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-logical-system 的主逻辑系统配置 OSPF,如 示例:创建用户逻辑系统、其管理员、用户和互连逻辑系统中所示。
此示例在主逻辑系统的 ge-0/0/4.0 和 lt-0/0/0.1 接口上启用 OSPF 路由。您可以配置以下路由策略,以便将路由从 Junos OS 路由表导出到 vr1 根路由实例中的 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 policy-optionsshow routing-instances命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明进行更正。
为简洁起见,此 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