Q-in-Q allows already tagged frames across a network by tunnelling them inside a single vlan. The process adds a second 802.1Q tag to each frame. As the packets traverse the network the network the infrastructure see’s the outside tag and forwards based on that vlan. Q-in-Q tunnels are usually implemented by service providers to encapsulate a customers multiple vlans into a single vlan.
Eg: as a simple example
Customer vlans 1,2,3,4,5
Service provider vlan 100
Customer switch trunk vlans 1-5 —-> (service provider dot1q-tunnel vlan 100) ——> vlans 1-5
This is enabled with:
switchport mode dot1q-tunnel
The tunnel interfaces should be setup at either end of the overall link.