OpenBSD QinQ

From WTFwiki
Jump to navigation Jump to search

I had a need to test QinQ/Q-in-Q/VLAN tag stacking/nesting/whatever-its-called-today, and my lab runs
OpenBSD 4.8-current as of this article; so thats what needed to do the testing. I came up with the
following scenario, using 2 soekris net5501s, 2 straight through, and 3 crossover cables.
It involves the use of multiple routing domains, bridging, and mostly VLANs.

The straight through cables cable vr0 on each soekris to the LAN for management.
Each crossover connects vr1 to vr1, vr2 to vr2, vr3 to vr3.

Once that's done, note that the following is a *script* and can simply be run as such in my lab, but
of course, your results may vary.

#!/bin/sh
#
# 2010-08-25 -- jontow@zenbsd.net
#
# This brings up a q-in-q lab, requires the remote end to simply return
# packets, easily accomplished like this on the remote machine:
#
# # ifconfig bridge0 create
# # ifconfig bridge0 add vr2 add vr3 up
#
# Make sure the local vr3 is cabled to the remote vr3, and
# the same for vr2 with crossovers.
#

################################################################################
#
# Outer tag, vr2
#
ifconfig vlan100 create
ifconfig vlan100 vlan 100 vlandev vr2 up

# Inner tag 200, vr2
ifconfig vlan200 create
ifconfig vlan200 vlan 200 vlandev vlan100 up
ifconfig vlan200 rdomain 2
ifconfig vlan200 inet 10.200.200.1/24

# Inner tag 201, vr2
ifconfig vlan201 create
ifconfig vlan201 vlan 201 vlandev vlan100 up
ifconfig vlan201 rdomain 2
ifconfig vlan201 inet 10.200.201.1/24

################################################################################
#
# Outer tag, vr3
#

ifconfig vlan9100 create
ifconfig vlan9100 vlan 100 vlandev vr3 up


# Inner tag 200, vr3
ifconfig vlan9200 create
ifconfig vlan9200 vlan 200 vlandev vlan9100 up
ifconfig vlan9200 rdomain 3
ifconfig vlan9200 inet 10.200.200.2/24

# Inner tag 201, vr3
ifconfig vlan9201 create
ifconfig vlan9201 vlan 201 vlandev vlan9100 up
ifconfig vlan9201 rdomain 3
ifconfig vlan9201 inet 10.200.201.2/24

################################################################################
#
# Test scenario..
#

echo "Test:"
echo ""
echo "from-v200-vr2# ping -V2 10.200.200.2"
echo "from-v201-vr2# ping -V2 10.200.201.2"
echo "from-v200-vr3# ping -V3 10.200.200.1"
echo "from-v201-vr3# ping -V3 10.200.201.1"
echo ""
exit