Configuring Port-based VLAN
Overview
Virtual Local Area Network (VLAN) technology divides a physical LAN into multiple broadcast domains, each of which is called a VLAN. VLAN tagging (IEEE 802.1Q) is a networking standard that defines the VLAN. Hosts within a VLAN can communicate with each other but cannot communicate directly with hosts in other VLANs. Consequently, broadcast packets are confined to within a single VLAN.
You can configure a physical port as either a trunk or an access port. With the native VLAN ID, you can add the port (in trunk mode) to more than one VLAN. Access ports only belong to the native VLAN, while trunk ports belong to more than one VLAN, including the native VLAN.
If hosts in different VLANs need to communicate, configure inter-VLAN communication. A VLAN interface is a Layer 3 logical interface and can implement inter-VLAN Layer 3 connectivity. Each VLAN corresponds to a VLAN interface. An IP address can be assigned to each VLAN interface. For details about VLAN interface configuration, see Layer 3 VLAN Interface Configuration.
NOTE:
When configuring a VLAN member, use VLAN ID or VLAN range, but NOT other strings.
Configure the Access/Trunk Mode
admin@PICOS# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching port-mode access
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching port-mode trunk
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# Configure the Native VLAN ID
NOTE:
VLAN IDs (VLAN 1-4094) have been pre-configured in the system from version 4.3.2 and are not user-deletable. You no longer need to use the command set vlans vlan-id <vlan-id> to create VLAN IDs.
The native VLAN ID is the ID of the default VLAN (usually vlan-id 1) in which the port belongs. Every port should be included in at least one VLAN.
admin@PICOS# set vlans vlan-id 5
admin@PICOS# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 5
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# run show vlans vlan-id 5
VLAN ID: 5
VLAN Name: default
Description:
vlan-interface:
Routed-interface:
Number of member ports: 1
Tagged port: None
Untagged port: ge-1/1/1,
admin@PICOS# Add a Port to a VLAN with Tagged Packet
NOTEs:
When you use the set interface gigabit-ethernet family ethernet-switching vlan members command to configure the list of allowed VLAN members on a trunk interface, if the native VLAN is also added as a VLAN member, the VLAN member configuration takes effect, and the outgoing packets are tagged.
To ensure correct packet handling, configure the native VLAN and allowed VLANs separately as needed.
admin@PICOS# set vlans vlan-id 5
admin@PICOS# set vlans vlan-id 6
admin@PICOS# set vlans vlan-id 7
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching port-mode trunk
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 5
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 6
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 7
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# run show vlans
VlanID Tag Interfaces
------ -------- ------------------------------------------------------
1 untagged ge-1/1/1, ge-1/1/2, ge-1/1/3, ge-1/1/4, ge-1/1/5
ge-1/1/6, ge-1/1/7, ge-1/1/8, ge-1/1/9, ge-1/1/10
ge-1/1/11, ge-1/1/12, ge-1/1/13, ge-1/1/14, ge-1/1/15
ge-1/1/16, ge-1/1/17, ge-1/1/18, ge-1/1/19, ge-1/1/20
ge-1/1/21, ge-1/1/22, ge-1/1/23, ge-1/1/24, te-1/1/25
te-1/1/26, te-1/1/27, te-1/1/28, te-1/1/29, te-1/1/30
tagged
5 untagged
tagged ge-1/1/2
6 untagged
tagged ge-1/1/2
7 untagged
tagged ge-1/1/2
Add a Port to a VLAN with Untagged Packet
admin@PICOS# set vlans vlan-id 5
admin@PICOS# set vlans vlan-id 6
admin@PICOS# set vlans vlan-id 7
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching port-mode trunk
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 5 untagged
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 6 untagged
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 7 untagged
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# run show vlans
VlanID Tag Interfaces
------ -------- ------------------------------------------------------
1 untagged ge-1/1/1, ge-1/1/2, ge-1/1/3, ge-1/1/4, ge-1/1/5
ge-1/1/6, ge-1/1/7, ge-1/1/8, ge-1/1/9, ge-1/1/10
ge-1/1/11, ge-1/1/12, ge-1/1/13, ge-1/1/14, ge-1/1/15
ge-1/1/16, ge-1/1/17, ge-1/1/18, ge-1/1/19, ge-1/1/20
ge-1/1/21, ge-1/1/22, ge-1/1/23, ge-1/1/24, te-1/1/25
te-1/1/26, te-1/1/27, te-1/1/28, te-1/1/29, te-1/1/30
tagged
5 untagged ge-1/1/2
tagged
6 untagged ge-1/1/2
tagged
7 untagged ge-1/1/2
tagged Configuring the CPU Egress Rate Limit for a VLAN Interface
admin@PICOS# set l3-interface vlan-interface vlan200 rate-limit 1024
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# Creating a VLAN within the VLAN Range
You can create VLANs within the VLAN range, and then add ports to these VLANs.
admin@PICOS# set vlans vlan-id 2-4094
admin@PICOS# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching port-mode trunk
admin@PICOS# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching vlan members 1-4094
admin@PICOS# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching vlan members 1-4094
admin@PICOS# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching vlan members 1-4094
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# VLAN Configuration Example
In the following topology, the VLANs are configured for each switch.
Figure 4-1.VLAN configuration
Configuring Switch A
For Switch A, you should configure ge-1/1/1 through ge-1/1/4 as access ports and te-1/1/49 as the trunk port because the 10Gbit link will trunk the traffic of VLAN-2 and VLAN-3.
admin@SwitchA# set vlans vlan-id 2
admin@SwitchA# set vlans vlan-id 3
admin@SwitchA# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching port-mode access
admin@SwitchA# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 2
admin@SwitchA# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching port-mode access
admin@SwitchA# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 2
admin@SwitchA# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching port-mode access
admin@SwitchA# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 3
admin@SwitchA# set interface gigabit-ethernet ge-1/1/4 family ethernet-switching port-mode access
admin@SwitchA# set interface gigabit-ethernet ge-1/1/4 family ethernet-switching native-vlan-id 3
admin@SwitchA#set interface gigabit-ethernet te-1/1/49 family ethernet-switching port-mode trunk
admin@SwitchA#set interface gigabit-ethernet te-1/1/49 family ethernet-switching vlan members 2
admin@SwitchA#set interface gigabit-ethernet te-1/1/49 family ethernet-switching vlan members 3
admin@SwitchA# commit
Commit OK.
Save done.
admin@SwitchA#
admin@SwitchA# run show vlans
VlanID Tag Interfaces
------ -------- ------------------------------------------------------
1 tagged
untagged ge-1/1/5, ge-1/1/6, ge-1/1/7, ge-1/1/8, ge-1/1/9,
ge-1/1/10, ge-1/1/11, ge-1/1/12, ge-1/1/13, ge-1/1/14,
ge-1/1/15, ge-1/1/16, ge-1/1/17, ge-1/1/18, ge-1/1/19,
ge-1/1/20, ge-1/1/21, ge-1/1/22, ge-1/1/23, ge-1/1/24,
ge-1/1/25, ge-1/1/26, ge-1/1/27, ge-1/1/28, ge-1/1/29,
ge-1/1/30, ge-1/1/31, ge-1/1/32, ge-1/1/33, ge-1/1/34,
ge-1/1/35, ge-1/1/36, ge-1/1/37, ge-1/1/38, ge-1/1/39,
ge-1/1/40, ge-1/1/41, ge-1/1/42, ge-1/1/43, ge-1/1/44,
ge-1/1/45, ge-1/1/46, ge-1/1/47, ge-1/1/48, te-1/1/49,
te-1/1/50, te-1/1/51, te-1/1/52,
2 tagged te-1/1/49,
untagged ge-1/1/1, ge-1/1/2,
3 tagged te-1/1/49,
untagged ge-1/1/3, ge-1/1/4,
admin@SwitchA# Configuring Switch B
For Switch B, configure ge-1/1/1 through ge-1/1/4 as access ports and te-1/1/49 as the trunk port because the 10 Gbit link will trunk the traffic of VLAN-2 and VLAN-3.
admin@SwitchB# set vlans vlan-id 2
admin@SwitchB# set vlans vlan-id 3
admin@SwitchB# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching port-mode access
admin@SwitchB# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 2
admin@SwitchB# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching port-mode access
admin@SwitchB# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 2
admin@SwitchB# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching port-mode access
admin@SwitchB# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 3
admin@SwitchB# set interface gigabit-ethernet ge-1/1/4 family ethernet-switching port-mode access
admin@SwitchB# set interface gigabit-ethernet ge-1/1/4 family ethernet-switching native-vlan-id 3
admin@SwitchB#set interface gigabit-ethernet te-1/1/49 family ethernet-switching port-mode trunk
admin@SwitchB#set interface gigabit-ethernet te-1/1/49 family ethernet-switching vlan members 2
admin@SwitchB#set interface gigabit-ethernet te-1/1/49 family ethernet-switching vlan members 3
admin@SwitchBS# commit
Commit OK.
Save done.
admin@SwitchB#
admin@SwitchB# run show vlans
VlanID Tag Interfaces
------ -------- ------------------------------------------------------
1 tagged
untagged ge-1/1/5, ge-1/1/6, ge-1/1/7, ge-1/1/8, ge-1/1/9,
ge-1/1/10, ge-1/1/11, ge-1/1/12, ge-1/1/13, ge-1/1/14,
ge-1/1/15, ge-1/1/16, ge-1/1/17, ge-1/1/18, ge-1/1/19,
ge-1/1/20, ge-1/1/21, ge-1/1/22, ge-1/1/23, ge-1/1/24,
ge-1/1/25, ge-1/1/26, ge-1/1/27, ge-1/1/28, ge-1/1/29,
ge-1/1/30, ge-1/1/31, ge-1/1/32, ge-1/1/33, ge-1/1/34,
ge-1/1/35, ge-1/1/36, ge-1/1/37, ge-1/1/38, ge-1/1/39,
ge-1/1/40, ge-1/1/41, ge-1/1/42, ge-1/1/43, ge-1/1/44,
ge-1/1/45, ge-1/1/46, ge-1/1/47, ge-1/1/48, te-1/1/49,
te-1/1/50, te-1/1/51, te-1/1/52,
2 tagged te-1/1/49,
untagged ge-1/1/1, ge-1/1/2,
3 tagged te-1/1/49,
untagged ge-1/1/3, ge-1/1/4,