VLAN tagging is supported with both native Linux sockets and with the optimized socket infrastructure provided with dsTest. In both cases VLAN configurations must be defined using Linux. dsTest will only utilize the configurations that are present when dsTest is started.
Creating a VLAN Interface
You can use the following steps, as root or with root permissions, to configure a VLAN that will exist until the server is rebooted.
1.Ensure that the 8021q module is loaded:
~]# modprobe 8021q
2.Verify that the module loaded using either of the following methods:
~]# lsmod | grep 8021q
8021q 32768 0
garp 16384 1 8021q
mrp 20480 1 8021q
[6158312.204733] 8021q: 802.1Q VLAN Support v1.8
[6158312.204742] 8021q: adding VLAN 0 to HW filter on device eth0
[6158312.204761] 8021q: adding VLAN 0 to HW filter on device eth0
3.Create a VLAN interface on a physical interface (eth0), specifying the tag to be used (8):
~]# ip link add link eth0 name eth0.8 type vlan id 8
4.Assign an IP address to the VLAN interface:
~]# ip addr add <interface address> brd <broadcast address> dev eth0.8
5.View the VLAN configuration:
~]# ip -d link show eth0.8
6.Bring up the VLAN interface:
~]# ip link set dev eth0.8 up
You can define persistent VLAN interfaces that are available when the server starts by modifying the ifcfg files as shown here.
Using a VLAN
dsTest uses VLAN interfaces as it does any physical interface. When a VLAN interface is used the VLAN tag will be added to outbound packets automatically.
When the emulated node is operating as a client (i.e., it initiates the connection) the VLAN interface will be used when the client's source address is configured on the VLAN interface or when the destination address is routed through the VLAN interface.
When the emulated node is operating as a server, dsTest will properly ARP for the addresses defined for a VLAN interface and for private, non-routable addresses that have an IP route through a VLAN interface.