示例:在 NFX150 设备上使用自定义网桥配置交叉连接
此示例说明如何在 NFX150 设备上使用自定义网桥配置交叉连接。
要求
此示例使用以下硬件和软件组件:
运行 Junos OS 18.1R1 版的 NFX150
概述
交叉连接功能支持在任意两个 VNF 接口之间切换流量。您可以在任意两个 VNF 接口之间双向切换所有流量或属于特定 VLAN 的流量。
此功能不支持单向流量。
交叉连接功能支持以下功能:
两个 VNF 接口之间的端口交叉连接,适用于所有网络流量。
VNF 接口之间基于 VLAN 的流量转发,支持以下功能:
提供基于 VLAN ID 切换流量的选项。
支持通过 POP 操作从中继到访问端口的网络流量。
支持通过 PUSH 操作从接入到中继端口的网络流量。
支持 VLAN 推送、弹出和交换操作。
配置
创建 VLAN
分步过程
为 LAN 端接口配置 VLAN。
user@host# set vlans vlan100 vlan-id 100
映射接口
分步过程
将 heth-0-0 物理端口映射到 FPC0 接口。
user@host# set vmhost virtualization-options interfaces ge-0/0/0 mapping interface heth-0-0
创建自定义网桥。
user@host# set vmhost vlans custom-br vlan-id none
将 FPC1 接口 ge-1/0/2 映射到自定义网桥。
user@host# set vmhost virtualization-options interfaces ge-1/0/2 mapping vlan custom-br
配置第 2 层数据路径
分步过程
配置 LAN 端前面板端口并将其添加到 LAN 端 VLAN。
user@host# set interfaces ge-0/0/0 unit 0 family ethernet-switching interface-mode trunk user@host# set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members vlan100
将面向内部的接口配置为中继端口,并将其添加到 LAN 端 VLAN。面向内部的接口通常是中继端口,因为它们必须支持来自多个前面板端口和 VLAN 的流量。
user@host# set interfaces sxe-0/0/0 unit 0 family ethernet-switching interface-mode trunk user@host# set interfaces sxe-0/0/0 unit 0 family ethernet-switching vlan members vlan100
配置第 3 层数据路径
分步过程
在 ge-1/0/0 上配置 VLAN 标记:
user@host# set interfaces ge-1/0/0 vlan-tagging user@host# set interfaces ge-1/0/0 unit 0 vlan-id 100 user@host# set interfaces ge-1/0/0 unit 0 family inet address 192.0.3.1/24
在 ge-1/0/2 上配置 VLAN 标记:
user@host# set interfaces ge-1/0/2 vlan-tagging user@host# set interfaces ge-1/0/2 unit 0 vlan-id 200 user@host# set interfaces ge-1/0/2 unit 0 family inet address 203.0.113.2/24
配置 VNF
分步过程
启动 VNF:
user@host# set virtual-network-functions vnf-name image /var/public/centos-updated1.img user@host# set virtual-network-functions vnf-name image image-type raw
指定 VNF 所需的 CPU 数量:
user@host# set virtual-network-functions vnf-name virtual-cpu count 1
将虚拟 CPU 固定到物理 CPU:
user@host# set virtual-network-functions vnf-name virtual-cpu 0 physical-cpu 2
在自定义 OVS 网桥上创建 VNF 接口:
user@host# set virtual-network-functions vnf-name interfaces eth2 mapping vlan members custom-br
使用 SR-IOV 虚拟功能将 VNF 接口连接到物理接口:
user@host# set virtual-network-functions vnf-name interfaces eth3 mapping interface heth-0-4 virtual-function vlan-id 300
指定 VNF 的内存分配:
user@host# set virtual-network-functions memory size 1048576
配置交叉连接
分步过程
配置交叉连接:
user@host# set vmhost cross-connect c1 virtual-interface ge-1/0/2 user@host# set vmhost cross-connect c1 virtual-network-function vnf-name interface eth2
验证配置
验证控制平面配置
目的
验证控制平面配置:
行动
要验证控制平面配置,请执行以下操作:
使用
show vmhost vlans
命令验证 VLAN 和 VLAN 成员资格是否正确。user@host> show vmhost vlans Routing instance VLAN name Tag Interfaces vmhost custom-br ge-1/0/2.0
验证 VNF 是否正常运行。查看 VNF 的状态以确保 VNF 已启动并正在运行。
user@host# show virtual-network-functions vnf-name ID Name State Liveliness -------------------------------------------------------------------------------- 2 vnf-name Running alive
Liveliness
VNF 的输出字段指示 VNF 的 IP 地址是否可从 Junos 访问。要查看 VNF 的更多详细信息:
user@host# show virtual-network-functions VNF detail Virtual Network Function Information ------------------------------------ Id: 2 Name: vnf-name State: Running Liveliness: Up IP Address: 192.0.2.101 VCPUs: 1 Maximum Memory: 1048576 KiB Used Memory: 1048576 KiB Used 1G Hugepages: 0 Used 2M Hugepages: 0 Error: None
验证数据平面配置
目的
验证数据平面配置。
行动
要验证数据平面配置,请执行以下操作:
验证物理端口的状态。
user@host> show interfaces heth-0-0 statistics Physical interface: heth-0-0, Enabled, Physical link is Up Link-level type: Ethernet, Media type: Copper, MTU: 9192, Speed: 1Gbps, Duplex: Full-duplex, Auto-negotiation: Enabled Device flags : Present Running Current address: 00:00:5e:00:53:8d, Hardware address: 00:00:5e:00:53:8d Input packets : 311143 Output packets: 674 MAC statistics: Input bytes: 19913152, Input packets: 311143, Output bytes: 48658, Output packets: 674 VF statistics: VF Number: 0, PCI Address: 0000:02:10:1, Mapped to: ge-0/0/0 Input bytes: 19909120, Input packets: 311080, Output bytes: 48658, Output packets: 674, Multicast packets: 311080 VF Number: 1, PCI Address: 0000:02:10:5, Mapped to: ge-0/0/0 Input bytes: 0, Input packets: 0, Output bytes: 0, Output packets: 0, Multicast packets: 0 VF Number: 2, PCI Address: 0000:02:11:1, Mapped to: ge-0/0/0 Input bytes: 0, Input packets: 0, Output bytes: 0, Output packets: 0, Multicast packets: 0 VF Number: 3, PCI Address: 0000:02:11:5, Mapped to: ge-0/0/0 Input bytes: 0, Input packets: 0, Output bytes: 0, Output packets: 0, Multicast packets: 0
验证第 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 (6d 00:28 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 : 311115 Output packets: 22 Protocol eth-switch, MTU: 9192 Flags: Trunk-Mode
user@host > show interfaces ge-1/0/2 statistics Physical interface: ge-1/0/2, Enabled, Physical link is Up Interface index: 158, SNMP ifIndex: 536 Link-level type: Ethernet, MTU: 1518, LAN-PHY mode, Link-mode: Full-duplex, 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, Auto-negotiation: Enabled, Remote fault: Online Device flags : Present Running Interface flags: SNMP-Traps Internal: 0x4000 CoS queues : 8 supported, 8 maximum usable queues Current address: 00:00:5e:00:53:5d, Hardware address: 00:00:5e:00:53:5d Last flapped : 2018-04-23 06:03:29 UTC (1d 00:04 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-1/0/2.0 (Index 342) (SNMP ifIndex 538) Flags: Up SNMP-Traps 0x4000 VLAN-Tag [ 0x8100.200 ] Encapsulation: ENET2 Input packets : 0 Output packets: 0 Security: Zone: untrust Allowed host-inbound traffic : dns dhcp tftp https Protocol inet, MTU: 1500 Max nh cache: 75000, New hold nh limit: 75000, Curr nh cnt: 0, Curr new hold cnt: 0, NH drop cnt: 0 Flags: Sendbcast-pkt-to-re Addresses, Flags: Is-Preferred Is-Primary Destination: 203.0.113/24, Local: 203.0.113.2, Broadcast: 203.0.113.255 Protocol multiservice, MTU: Unlimited Logical interface ge-1/0/2.32767 (Index 343) (SNMP ifIndex 545) Flags: Up SNMP-Traps 0x4004000 VLAN-Tag [ 0x0000.0 ] Encapsulation: ENET2 Input packets : 0 Output packets: 0 Security: Zone: Null Protocol multiservice, MTU: Unlimited Flags: None