802.1Q Double-Tagging
This section describes the configuration of 802.1Q double-tagging support to the hypervisor per Virtual Function (VF). The Virtual Machine (VM) attached to the VF (via SR-IOV) can send traffic with or without C-VLAN. Once a VF is configured to VST encapsulation, the adapter's hardware will insert C-VLAN to any packet from the VF to the physical port. On the receive side, the adapter hardware will strip the C-VLAN from any packet coming from the wire to that VF.
Add the required C-VLAN tag (on the hypervisor) per port per VF. There are two ways to add the C-VLAN:
By using sysfs:
echo
'100:0:802.1q'
> /sys/class
/net/ens1f0/device/sriov/0
/vlanBy using the ip link command (available only when using the latest Kernel version):
ip link set dev ens1f0 vf
0
vlan100
Check the configuration using the ip link show command:
# ip link show ens1f0 ens1f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu
1500
qdisc mq state UP mode DEFAULT qlen1000
link/ether ec:0d:9a:44
:37
:84
brd ff:ff:ff:ff:ff:ff vf0
MAC00
:00
:00
:00
:00
:00
, vlan100
, spoof checking off, link-state auto, trust off vf1
MAC00
:00
:00
:00
:00
:00
, spoof checking off, link-state auto, trust off vf2
MAC00
:00
:00
:00
:00
:00
, spoof checking off, link-state auto, trust off vf3
MAC00
:00
:00
:00
:00
:00
, spoof checking off, link-state auto, trust off vf4
MAC00
:00
:00
:00
:00
:00
, spoof checking off, link-state auto, trust off
Create a VLAN interface on the VM and add an IP address.
# ip link add link ens5 ens5.
40
type vlan protocol802
.1q id40
# ip addr add42.134
.135.7
/16
brd42.134
.255.255
dev ens5.40
# ip link set dev ens5.40
upTo verify the setup, run ping between the two VMs and open Wireshark or tcpdump to capture the packet.