One-to-one and many-to-one VLAN mapping configuration example
Network requirements
As shown in Figure 70:
Each household subscribes to PC, VoD, and VoIP services, and obtains the IP address through DHCP.
On the home gateways, VLANs 1, 2, and 3 are assigned to PC, VoD, and VoIP traffic, respectively.
To isolate traffic of the same service type from different households, configure one-to-one VLAN mapping on the wiring-closet switches. This feature assigns one VLAN to each type of traffic from each household.
To save VLAN resources, configure many-to-one VLAN mapping on the campus switch (Switch C). This feature transmits the same type of traffic from different households in one VLAN. Use VLANs 501, 502, and 503 for PC, VoD, and VoIP traffic, respectively.
Table 17: VLAN mapping for each service
Service | VLANs on home gateways | VLANs on wiring-closet switches (Switch A and Switch B) | VLANs on campus switch (Switch C) |
---|---|---|---|
PC | VLAN 1 | VLANs 101, 102, 103, 104 | VLAN 501 |
VoD | VLAN 2 | VLANs 201, 202, 203, 204 | VLAN 502 |
VoIP | VLAN 3 | VLANs 301, 302, 303, 304 | VLAN 503 |
Figure 70: Network diagram
Configuration procedure
Configure Switch A:
# Create the original VLANs.
<SwitchA> system-view [SwitchA] vlan 2 to 3
# Create the translated VLANs.
[SwitchA] vlan 101 to 102 [SwitchA] vlan 201 to 202 [SwitchA] vlan 301 to 302
# Configure the customer-side port Ten-GigabitEthernet 1/0/1 as a trunk port, and assign the port to all original VLANs and translated VLANs.
[SwitchA] interface ten-gigabitethernet 1/0/1 [SwitchA-Ten-GigabitEthernet1/0/1] port link-type trunk [SwitchA-Ten-GigabitEthernet1/0/1] port trunk permit vlan 1 2 3 101 201 301
# Configure one-to-one VLAN mappings on Ten-GigabitEthernet 1/0/1 to map VLANs 1, 2, and 3 to VLANs 101, 201, and 301, respectively.
[SwitchA-Ten-GigabitEthernet1/0/1] vlan mapping 1 translated-vlan 101 [SwitchA-Ten-GigabitEthernet1/0/1] vlan mapping 2 translated-vlan 201 [SwitchA-Ten-GigabitEthernet1/0/1] vlan mapping 3 translated-vlan 301 [SwitchA-Ten-GigabitEthernet1/0/1] quit
# Configure the customer-side port Ten-GigabitEthernet 1/0/2 as a trunk port, and assign the port to all original VLANs and translated VLANs.
[SwitchA] interface ten-gigabitethernet 1/0/2 [SwitchA-Ten-GigabitEthernet1/0/2] port link-type trunk [SwitchA-Ten-GigabitEthernet1/0/2] port trunk permit vlan 1 2 3 102 202 302
# Configure one-to-one VLAN mappings on Ten-GigabitEthernet 1/0/2 to map VLANs 1, 2, and 3 to VLANs 102, 202, and 302, respectively.
[SwitchA-Ten-GigabitEthernet1/0/2] vlan mapping 1 translated-vlan 102 [SwitchA-Ten-GigabitEthernet1/0/2] vlan mapping 2 translated-vlan 202 [SwitchA-Ten-GigabitEthernet1/0/2] vlan mapping 3 translated-vlan 302 [SwitchA-Ten-GigabitEthernet1/0/2] quit
# Configure the network-side port Ten-GigabitEthernet 1/0/3 as a trunk port, and assign the port to the translated VLANs.
[SwitchA] interface ten-gigabitethernet 1/0/3 [SwitchA-Ten-GigabitEthernet1/0/3] port link-type trunk [SwitchA-Ten-GigabitEthernet1/0/3] port trunk permit vlan 101 201 301 102 202 302 [SwitchA-Ten-GigabitEthernet1/0/3] quit
Configure Switch B in the same way Switch A is configured. (Details not shown.)
Configure Switch C:
# Enable DHCP snooping.
<SwitchC> system-view [SwitchC] dhcp snooping enable
# Create the original VLANs and translated VLANs, and enable ARP detection for these VLANs.
[SwitchC] vlan 101 [SwitchC-vlan101] arp detection enable [SwitchC-vlan101] vlan 201 [SwitchC-vlan201] arp detection enable [SwitchC-vlan201] vlan 301 [SwitchC-vlan301] arp detection enable [SwitchC-vlan301] vlan 102 [SwitchC-vlan102] arp detection enable [SwitchC-vlan102] vlan 202 [SwitchC-vlan202] arp detection enable [SwitchC-vlan202] vlan 302 [SwitchC-vlan302] arp detection enable [SwitchC-vlan302] vlan 103 [SwitchC-vlan103] arp detection enable [SwitchC-vlan103] vlan 203 [SwitchC-vlan203] arp detection enable [SwitchC-vlan203] vlan 303 [SwitchC-vlan303] arp detection enable [SwitchC-vlan303] vlan 104 [SwitchC-vlan104] arp detection enable [SwitchC-vlan104] vlan 204 [SwitchC-vlan204] arp detection enable [SwitchC-vlan204] vlan 304 [SwitchC-vlan304] arp detection enable [SwitchC-vlan304] vlan 501 [SwitchC-vlan501] arp detection enable [SwitchC-vlan501] vlan 502 [SwitchC-vlan502] arp detection enable [SwitchC-vlan502] vlan 503 [SwitchC-vlan503] arp detection enable [SwitchC-vlan503] quit
# Configure the customer-side port Ten-GigabitEthernet 1/0/1 as a trunk port, and assign the port to original VLANs and translated VLANs.
[SwitchC] interface ten-gigabitethernet 1/0/1 [SwitchC-Ten-GigabitEthernet1/0/1] port link-type trunk [SwitchC-Ten-GigabitEthernet1/0/1] port trunk permit vlan 101 102 201 202 301 302 501 to 503
# Configure many-to-one VLAN mappings on the customer-side port Ten-GigabitEthernet 1/0/1 to map VLANs for PC, VoD, and VoIP traffic to VLANs 501, 502, and 503, respectively.
[SwitchC-Ten-GigabitEthernet1/0/1] vlan mapping uni range 101 to 102 translated-vlan 501 [SwitchC-Ten-GigabitEthernet1/0/1] vlan mapping uni range 201 to 202 translated-vlan 502 [SwitchC-Ten-GigabitEthernet1/0/1] vlan mapping uni range 301 to 302 translated-vlan 503
# Enable DHCP snooping entry recording on Ten-GigabitEthernet 1/0/1.
[SwitchC-Ten-GigabitEthernet1/0/1] dhcp snooping binding record [SwitchC-Ten-GigabitEthernet1/0/1] quit
# Configure the customer-side port Ten-GigabitEthernet 1/0/2 as a trunk port, and assign the port to original VLANs and translated VLANs.
[SwitchC] interface ten-gigabitethernet 1/0/2 [SwitchC-Ten-GigabitEthernet1/0/2] port link-type trunk [SwitchC-Ten-GigabitEthernet1/0/2] port trunk permit vlan 103 104 203 204 303 304 501 to 503
# Configure many-to-one VLAN mappings on the customer-side port Ten-GigabitEthernet 1/0/2 to map VLANs for PC, VoD, and VoIP traffic to VLANs 501, 502, and 503, respectively.
[SwitchC-Ten-GigabitEthernet1/0/2] vlan mapping uni range 103 to 104 translated-vlan 501 [SwitchC-Ten-GigabitEthernet1/0/2] vlan mapping uni range 203 to 204 translated-vlan 502 [SwitchC-Ten-GigabitEthernet1/0/2] vlan mapping uni range 303 to 304 translated-vlan 503
# Enable DHCP snooping entry recording on Ten-GigabitEthernet 1/0/2.
[SwitchC-Ten-GigabitEthernet1/0/2] dhcp snooping binding record [SwitchC-Ten-GigabitEthernet1/0/2] quit
# Configure the network-side port Ten-GigabitEthernet 1/0/3 to use the original VLAN tags of the many-to-one mappings to replace the VLAN tags of the packets destined for the user network.
[SwitchC] interface ten-gigabitethernet 1/0/3 [SwitchC-Ten-GigabitEthernet1/0/3] vlan mapping nni
# Configure Ten-GigabitEthernet 1/0/3 as a trunk port, and assign the port to the translated VLANs.
[SwitchC-Ten-GigabitEthernet1/0/3] port link-type trunk [SwitchC-Ten-GigabitEthernet1/0/3] port trunk permit vlan 501 to 503
# Configure Ten-GigabitEthernet 1/0/3 as a DHCP snooping trusted and ARP trusted port.
[SwitchC-Ten-GigabitEthernet1/0/3] dhcp snooping trust [SwitchC-Ten-GigabitEthernet1/0/3] arp detection trust [SwitchC-Ten-GigabitEthernet1/0/3] quit
Configure Switch D:
# Create the translated VLANs.
<SwitchD> system-view [SwitchD] vlan 501 to 503
# Configure Ten-GigabitEthernet 1/0/1 as a trunk port, and assign the port to the translated VLANs 501 through 503.
[SwitchD] interface ten-gigabitethernet 1/0/1 [SwitchD-Ten-GigabitEthernet1/0/1] port link-type trunk [SwitchD-Ten-GigabitEthernet1/0/1] port trunk permit vlan 501 to 503 [SwitchD-Ten-GigabitEthernet1/0/1] quit
Verifying the configuration
# Verify VLAN mapping information on the wiring-closet switches, for example, Switch A.
[SwitchA] display vlan mapping Interface Ten-GigabitEthernet1/0/1: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 1 N/A 101 N/A 2 N/A 201 N/A 3 N/A 301 N/A Interface Ten-GigabitEthernet1/0/2: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 1 N/A 102 N/A 2 N/A 202 N/A 3 N/A 302 N/A
# Verify VLAN mapping information on Switch C.
[SwitchC] display vlan mapping Interface Ten-GigabitEthernet1/0/1: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 101-102 N/A 501 N/A 201-202 N/A 502 N/A 301-302 N/A 503 N/A Interface Ten-GigabitEthernet1/0/2: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 103-104 N/A 501 N/A 203-204 N/A 502 N/A 303-304 N/A 503 N/A