CÔNG TY TNHH CÔNG NGHỆ VIỆT THÁI DƯƠNG
Logo CNTTShop.vn

NTT03, Line 1, Thống Nhất Complex, Thanh Xuân, Hà Nội.
Danh mục sản phẩm

Configure a Port-Based VLAN

A port-based VLAN, also called port VLAN, is a VLAN of the simplest division type. After a port is added into the VLAN, the port can forward packets that belong to the VLAN.

Configuration Condition

None

Configure the Port Link Type

A port handles VLAN tags in different modes before it forwards packets. According to the VLAN tag handling modes, the following three link types are available:

  • Access type: The packets that have been forwarded do not carry VLAN tags. Ports of this type are usually connected to user devices.
  • Trunk type: The packets from the VLANs in which the PVID is located do not carry VLAN tags, while the packets from other VLANs still carry VLAN tags.
  • Hybrid type: The packets from the specified VLAN can be configured not to carry or carry VLAN tags. Ports of the type can be connected to user devices or interconnected with network devices.

The ports of the Trunk type and the ports of the Hybrid type cannot be converted to each other directly. They need to be converted to the Access type before being converted to another type.

Table 3-4 Configuring the Port Link Type

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the L2 Ethernet interface configuration mode.

interface interface-name

Either

After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.

Enter the aggregation group configuration mode.

interface link-aggregation link-aggregation-id

Configure the port link type.

switchport mode { access | hybrid | trunk }

Mandatory.

By default, the port link type is the Access type.

caution

  • Some commands can be configured only on the ports with the specified link type. Therefore, if the port link type is converted to another type, the functions that are configured on the port with the original link type may become invalid.

Add an Access Port into the VLAN

One Access port can belong to only one VLAN. When an Access port is added into a specified VLAN, it exits from the current VLAN and then enters the specified VLAN. If the VLAN to which the Access port is to be added does not exists, the VLAN is automatically created.

Table 3-5 Adding an Access Port into the VLAN

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the L2 Ethernet interface configuration mode.

interface interface-name

Either

After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.

Enter the aggregation group configuration mode.

interface link-aggregation link-aggregation-id

Configure the port link type to the Access type. switchport mode access

Mandatory.
By default, the port link type is the Access type.

Add an Access port into the specified VLAN. switchport access vlan vlan-id

Mandatory.
By default, the Access port is added into VLAN1.

Configure a Trunk Port to Allow Services of a VLAN to Pass

If a Trunk port allows services of an existing VLAN to pass, the port allows forwarding packets of the VLAN. If the VLAN that the Trunk port allows to pass does not exist, the VLAN will not be created automatically and you must create the VLAN before the port allows forwarding packets of the VLAN.

Table 3-6 Configuring a Trunk Port to Allow Services of a VLAN to Pass

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the L2 Ethernet interface configuration mode.

interface interface-name

Either

After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.

Enter the aggregation group configuration mode.

interface link-aggregation link-aggregation-id

Configure the port link type to the Trunk type.

switchport mode trunk

Mandatory.

By default, the port link type is the Access type.

Configure a Trunk port to allow a VLAN to pass. switchport trunk allowed vlan { all | add vlan-list }

Mandatory.

By default, the Trunk port allows VLAN1 to pass.

Configure the packets from the VLAN in which the PVID is located to be forwarded with VLAN tags reserved. vlan dot1q tag pvid

Optional.

By default, the packets from the VLAN in which the PVID is located are forwarded without VLAN tags.

Add a Hybrid Port into the VLAN

If the VLAN to which the Access port is to be added does not exist, the VLAN is automatically created.

Table 3-7 Adding a Hybrid Port into the VLAN

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the L2 Ethernet interface configuration mode.

interface interface-name

Either

After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.

Enter the aggregation group configuration mode.

interface link-aggregation link-aggregation-id

Configure the port link type to the Hybrid type.

switchport mode hybrid

Mandatory.

By default, the port link type is the Access type.

Add a Hybrid port to a specified VLAN in a specified mode.

switchport hybrid { untagged | tagged } vlan vlan-list

Mandatory.

By default, the Hybrid port is added into VLAN1 in Untagged mode.

Configure PVIDs for Ports

Port VLAN ID (PVID) is an important parameter of a port. When a port receives an Untag packet, it adds a VLAN tag to the packet, and the VLAN ID of the VLAN tag is the PVID of the port.

The PVID of an Access port is the ID of the VLAN to which it belongs, so the PVID of the Access port can be configured only by changing the VLAN to which it belongs. The Trunk port and hybrid port can belong to multiple VLANs, and their PVIDs can be configured according to the actual requirement.

The Trunk port and Hybrid port must be added into the VLAN to which their PVIDs belong; otherwise, packets of the VLAN to which their PVIDs belong cannot be forwarded, and the port discards the received Untag packets.

Table 3-8 Configuring PVIDs for Ports

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the L2 Ethernet interface configuration mode.

interface interface-name

Either

After entering the L2 Ethernet interface configuration mode, the subsequent configuration takes effect only on the current port. After entering the aggregation group configuration mode, the subsequent configuration takes effect only on the aggregation group.

Enter the aggregation group configuration mode.

interface link-aggregation link-aggregation-id

Configuring the PVID for the Trunk port.

switchport trunk pvid vlan vlan-id

Mandatory. Select one option according to the port link type.
By default, the port PVID is VLAN1.

Configuring the PVID for the Hybrid port.

switchport hybrid pvid vlan vlan-id

note


  • In configuring the PVID for a port, the VLAN to which the PVID belongs must have been created; otherwise, the configuration fails, and an error message is prompted.