After a QinQ tunnel is configured, an enterprise can set up its own VLANs based on the QinQ tunnel. Branch offices of the same enterprise in different locations can communicate with each other through the VLANs. Offices of different enterprises cannot communicate.
On the network shown in Figure 1, enterprise 1 has three offices and enterprise 2 has two offices. Offices of enterprise 1 and enterprise 2 are connected to PE1 and PE2 on the carrier network. Enterprise 1 and enterprise 2 each have a VLAN.
You can configure QinQ tunnels on PE1 and PE2 so that offices of the same enterprise (enterprise 1 or enterprise 2) can interwork but offices of different enterprises (enterprise 1 and enterprise 2) cannot interwork.
The configuration roadmap is as follows:
Configure a QinQ tunnel so that packets exchanged between VLAN users become double-tagged QinQ packets after passing through the QinQ tunnel.
Configure interfaces on which the QinQ tunnel is not enabled. These interfaces allow packets carrying the specified outer VLAN tags to pass through so that users from different VLANs of the same enterprise can communicate.
# Configure PE1.
<HUAWEI> system-view [~HUAWEI] sysname PE1 [*HUAWEI] commit [~PE1] vlan batch 10 20
# Configure PE2.
<HUAWEI> system-view [~HUAWEI] sysname PE2 [*HUAWEI] commit [~PE2] vlan batch 10 20
# Configure PE1.
[*PE1] interface gigabitethernet 0/1/1 [*PE1-GigabitEthernet0/1/1] portswitch [*PE1-GigabitEthernet0/1/1] port link-type dot1q-tunnel [*PE1-GigabitEthernet0/1/1] port default vlan 10 [*PE1-GigabitEthernet0/1/1] undo shutdown [*PE1-GigabitEthernet0/1/1] quit [*PE1] interface gigabitethernet 0/1/9 [*PE1-GigabitEthernet0/1/9] portswitch [*PE1-GigabitEthernet0/1/9] port link-type dot1q-tunnel [*PE1-GigabitEthernet0/1/9] port default vlan 20 [*PE1-GigabitEthernet0/1/9] undo shutdown [*PE1-GigabitEthernet0/1/9] quit [*PE1] interface gigabitethernet 0/1/17 [*PE1-GigabitEthernet0/1/17] portswitch [*PE1-GigabitEthernet0/1/17] port link-type dot1q-tunnel [*PE1-GigabitEthernet0/1/17] port default vlan 10 [*PE1-GigabitEthernet0/1/17] undo shutdown [*PE1-GigabitEthernet0/1/17] quit [*PE1] commit
# Configure PE2.
[*PE2] interface gigabitethernet 0/1/1 [*PE2-GigabitEthernet0/1/1] portswitch [*PE2-GigabitEthernet0/1/1] port link-type dot1q-tunnel [*PE2-GigabitEthernet0/1/1] port default vlan 20 [*PE2-GigabitEthernet0/1/1] undo shutdown [*PE2-GigabitEthernet0/1/1] quit [*PE2] interface gigabitethernet 0/1/9 [*PE2-GigabitEthernet0/1/9] portswitch [*PE2-GigabitEthernet0/1/9] port link-type dot1q-tunnel [*PE2-GigabitEthernet0/1/9] port default vlan 10 [*PE2-GigabitEthernet0/1/9] undo shutdown [*PE2-GigabitEthernet0/1/9] quit [*PE2] commit
# Allow the packets from VLAN 10 and VLAN 20 to pass through GE 0/1/25 on PE1.
[~PE1] interface gigabitethernet 0/1/25 [*PE1-GigabitEthernet0/1/25] portswitch [*PE1-GigabitEthernet0/1/25] port link-type trunk [*PE1-GigabitEthernet0/1/25] port trunk allow-pass vlan 10 20 [*PE1-GigabitEthernet0/1/25] undo shutdown [*PE1-GigabitEthernet0/1/25] quit [*PE1] commit
# Allow the packets from VLAN 10 and VLAN 20 to pass through GE 0/1/17 on PE2.
[~PE2] interface gigabitethernet 0/1/17 [*PE2-GigabitEthernet0/1/17] portswitch [*PE2-GigabitEthernet0/1/17] port link-type trunk [*PE2-GigabitEthernet0/1/17] port trunk allow-pass vlan 10 20 [*PE2-GigabitEthernet0/1/17] undo shutdown [*PE2-GigabitEthernet0/1/17] quit [*PE2] commit
Hosts in different offices on the same VLAN of enterprise 1 can ping each other.
Hosts in different offices on the same VLAN of enterprise 2 can ping each other.
Host of enterprise 1 cannot ping hosts of enterprise 2.
# sysname PE1 # vlan batch 10 20 # interface GigabitEthernet0/1/1 undo shutdown portswitch port link-type dot1q-tunnel port default vlan 10 # interface GigabitEthernet0/1/9 undo shutdown portswitch port link-type dot1q-tunnel port default vlan 20 # interface GigabitEthernet0/1/17 undo shutdown portswitch port link-type dot1q-tunnel port default vlan 10 # interface GigabitEthernet0/1/25 undo shutdown portswitch port link-type trunk port trunk allow-pass vlan 10 20 # return
# sysname PE2 # vlan batch 10 20 # interface GigabitEthernet0/1/1 undo shutdown portswitch port link-type dot1q-tunnel port default vlan 20 # interface GigabitEthernet0/1/9 undo shutdown portswitch port link-type dot1q-tunnel port default vlan 10 # interface GigabitEthernet0/1/17 undo shutdown portswitch port link-type trunk port trunk allow-pass vlan 10 20 # return