示例:通过 NFX250 下一代设备上的第三方 VNF 配置 LAN 到 WAN 路由的服务链
此示例说明如何通过 NFX250 NextGen 设备上的第三方 VNF 为 LAN 到 WAN 路由配置服务链。
要求
此示例使用运行 Junos OS 19.1R1 版的 NFX250 NextGen 设备。
概述
此示例说明如何配置设备的各个层,以使来自 LAN 网络的流量能够进入设备、流经 OVS 网桥和第三方 VNF、退出设备以及进入 WAN 网络。
配置
配置第 2 层数据路径(JCP LAN 接口)
分步过程
连接到 JCP。
user@host:~ # cli user@host> user@host> configure [edit] user@host#
为 LAN 端接口配置 VLAN。
user@host# set vlans vlan1 vlan-id 77
配置 LAN 端前面板端口并将其添加到 LAN 端 VLAN。LAN 端端口通常是接入端口,如果需要,可以是中继端口
user@host# set interfaces ge-0/0/0.0 family ethernet-switching vlan members vlan1
将面向内部的接口 sxe-0/0/0 配置为中继端口,并将其添加到 LAN 端 VLAN。面向内部的接口通常是中继端口,因为它们必须支持来自多个前面板端口和 VLAN 的流量。
user@host# set interfaces sxe-0/0/0.0 family ethernet-switching interface-mode trunk user@host# set interfaces sxe-0/0/0.0 family ethernet-switching vlan members vlan1
配置 VNF 接口以创建服务链
分步过程
使用 VLAN 配置 vmhost 实例,以连接到 OVS 网桥以进行服务链:
user@host# set vmhost vlans vlan1 vlan-id 77 user@host# set vmhost vlans glue-vlan1 vlan-id 123 user@host# set vmhost vlans vlan2 vlan-id 1177
实例化 VNF (vnf-name1),其中一个 virtio 接口映射到 VLAN vlan1,另一个 virtio 接口映射到 VLAN 胶水-vlan1:
user@host# set virtual-network-functions vnf-name1 interfaces eth2 mapping vlan members vlan1 user@host# set virtual-network-functions vnf-name1 interfaces eth3 mapping vlan members glue-vlan1
实例化第二个 VNF (vnf-name2),其中一个接口映射到 VLAN 胶水-vlan1,第二个接口映射到 VLAN vlan2:
user@host# set virtual-network-functions vnf-name2 interfaces eth2 mapping vlan members glue-vlan1 user@host# set virtual-network-functions vnf-name2 interfaces eth3 mapping vlan members vlan2
配置第 3 层数据路径
分步过程
将面向内部的 L3 数据平面接口配置为 VLAN 标记接口,并为其分配 IP 地址:
user@host# set interfaces ge-1/0/0 vlan-tagging user@host# set interfaces ge-1/0/0.0 vlan-id 1177 user@host# set interfaces ge-1/0/0.0 family inet address 33.33.33.1/30
将第 3 层接口映射到开放式交换机 (OVS) 并提交配置:
user@host# set vmhost virtualization-options interfaces ge-1/0/1 user@host# commit
将面向外部的 L3 数据平面接口配置为 VLAN 标记接口,并为其分配 IP 地址:
user@host# set interfaces ge-1/0/1 vlan-tagging user@host# set interfaces ge-1/0/1.0 vlan-id 1178 user@host# set interfaces ge-1/0/1.0 family inet address 203.0.113.2/30
配置第 2 层数据路径(JCP WAN 接口)
分步过程
为 WAN 端 JCP 接口配置 VLAN:
user@host# set vlans vlan3 vlan-id 1178
将 WAN 端面向内部的接口配置为中继端口,并将其添加到 WAN 端 VLAN:
user@host# set interfaces sxe-0/0/1.0 family ethernet-switching interface-mode trunk user@host# set interfaces sxe-0/0/1.0 family ethernet-switching vlan members vlan3
配置 WAN 端前面板端口并将其添加到 WAN 端 VLAN:
user@host# set interfaces xe-0/0/12.0 family ethernet-switching interface-mode access user@host# set interfaces xe-0/0/12.0 family ethernet-switching vlan members vlan3
提交配置:
user@host# commit
验证
验证接口的状态
目的
验证第 2 层和第 3 层接口的状态。
行动
验证第 2 层 (ge-0/0/x) 和第 3 层 (ge-1/0/x) 接口的状态。
user@host> show interfaces interface-name statistics
例如:
user@host> show interfaces ge-0/0/0 statistics Physical interface: ge-0/0/0, Enabled, Physical link is Up Interface index: 144, SNMP ifIndex: 518 Link-level type: Ethernet, MTU: 9192, LAN-PHY mode, Speed: 1000mbps, BPDU Error: None, Loop Detect PDU Error: None, Ethernet-Switching Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled Device flags : Present Running Interface flags: SNMP-Traps Internal: 0x4000 Link flags : None CoS queues : 8 supported, 8 maximum usable queues Current address: 00:00:5e:00:53:43, Hardware address: 00:00:5e:00:53:43 Last flapped : 2018-04-18 05:38:22 UTC (2d 10:07 ago) Statistics last cleared: Never Input rate : 0 bps (0 pps) Output rate : 0 bps (0 pps) Input errors: 0, Output errors: 0 Active alarms : None Active defects : None PCS statistics Seconds Bit errors 0 Errored blocks 0 Ethernet FEC statistics Errors FEC Corrected Errors 0 FEC Uncorrected Errors 0 FEC Corrected Errors Rate 0 FEC Uncorrected Errors Rate 0 PRBS Statistics : Disabled Interface transmit statistics: Disabled Logical interface ge-0/0/0.0 (Index 333) (SNMP ifIndex 524) Flags: Up SNMP-Traps 0x24024000 Encapsulation: Ethernet-Bridge Input packets : 147888 Output packets: 22 Protocol eth-switch, MTU: 9192 Flags: Is-Primary