- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
04-VLAN Termination on Subinterface Configuration Example | 73.04 KB |
VLAN Termination on Subinterface Configuration Example
Copyright © 2024 H3C Technologies Co., Ltd. All rights reserved.
No part of this manual may be reproduced or transmitted in any form or by any means without prior written consent of New H3C Technologies Co., Ltd.
Except for the trademarks of New H3C Technologies Co., Ltd., any trademarks that may be mentioned in this document are the property of their respective owners.
The information in this document is subject to change without notice.
Introduction
The following information provides VLAN termination on subinterface configuration examples.
Prerequisites
This document is not restricted to specific software or hardware versions. Procedures and information in the examples might be slightly different depending on the software or hardware version of the device.
The configuration examples were created and verified in a lab environment, and all the devices were started with the factory default configuration. When you are working on a live network, make sure you understand the potential impact of every command on your network.
The following information is provided based on the assumption that you have basic knowledge of VLAN termination.
Configuration example
Network configuration
As shown in Figure 1, Host A, Host B, and L2 Switch are connected. Host A is in VLAN 1, and Host B is in VLAN 2. On Device, the IP address of interface GigabitEthernet 1/0/1 is 192.168.1.1/24, and the IP address of subinterface GigabitEthernet 1/0/1.2 is 192.168.2.1/24. The link type of interface GigabitEthernet 1/0/1 on L2 Switch is trunk, and permits VLAN 2. Configure the network to enable Host A and Host B to access the Internet.
Analysis
Unambiguous Dot1q termination only allows an interface to receive VLAN packets with the specified outermost VLAN ID, and does not allow packets from other VLANs to pass through the interface. After receiving the packets, the interface will remove the outermost VLAN tag from the packets. When packets are sent, a VLAN tag with the specified VLAN ID is added to the packets.
Table 1 How ports of different link types handle frames
Port type |
Incoming frame |
Outgoing frame |
|
Untagged frame |
Tagged frame |
||
Access port |
Tags the frame with the PVID tag. |
· Receives the frame if its VLAN ID is the same as the PVID. · Drops the frame if its VLAN ID is different from the PVID. |
Removes the VLAN tag and sends the frame. |
Trunk port |
· If the PVID is permitted on the port, tags the frame with the PVID tag. · If not, drops the frame. |
· Receives the frame if its VLAN is permitted on the port. · Drops the frame if its VLAN is not permitted on the port. |
· Removes the tag and sends the frame if the frame carries the PVID tag and the port belongs to the PVID. · Sends the frame without removing the tag if its VLAN is carried on the port but is different from the PVID. |
Procedures
1. Configure Host A and Host B.
Assign IP address 192.168.1.2/24 and gateway address 192.168.1.1/24 to Host A. Assign IP address 192.168.2.2/24 and gateway address 192.168.2.1/24 to Host B.
2. Configure L2 Switch.
# Create VLAN 2. Assign GigabitEthernet 1/0/3 to VLAN 2.
<L2_Switch> system-view
[L2_Switch] vlan 2
[L2_Switch-vlan2] port gigabitethernet 1/0/3
[L2_Switch-vlan2] quit
# Set the link type of GigabitEthernet 1/0/1 to trunk and assign it to VLANs 1 and 2.
[L2_Switch] interface gigabitethernet 1/0/1
[L2_Switch-GigabitEthernet1/0/1] port link-type trunk
[L2_Switch-GigabitEthernet1/0/1] port trunk permit vlan 1 to 2
3. Configure Device.
# Create subinterface GigabitEthernet 1/0/1.2, configure its IP address as 192.168.2.1/24, and configure GigabitEthernet 1/0/1.2 to terminate packets of VLAN 2.
<Device> system-view
[Device] interface gigabitethernet 1/0/1.2
[Device-GigabitEthernet1/0/1.2] ip address 192.168.2.1 255.255.255.0
[Device-GigabitEthernet1/0/1.2] vlan-type dot1q vid 2
[Device-GigabitEthernet1/0/1.2] quit
# Assign IP address 192.168.1.1/24 to GigabitEthernet 1/0/1.
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] ip address 192.168.1.1 255.255.255.0
Verifying the configuration
Both Host A and Host B can access the Internet.
Configuration files
· L2 Switch:
#
vlan 1
#
vlan 2
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 2
#
interface GigabitEthernet1/0/2
port link-mode bridge
#
interface GigabitEthernet1/0/3
port link-mode bridge
port access vlan 2
#
· Device:
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1.2
ip address 192.168.2.1 255.255.255.0
vlan-type dot1q vid 2
#
Related documentation
· VLAN termination configuration in H3C MSR Router Series Comware 7 Configuration Guides
· VLAN termination commands in H3C MSR Router Series Comware