- Table of Contents
-
- 03-Layer 2—LAN Switching Configuration Examples
- 01-MAC Address Table Configuration Examples
- 02-Ethernet Link Aggregation Configuration Examples
- 03-M-LAG Configuration Examples
- 04-Port Isolation Configuration Examples
- 05-VLAN Configuration Examples
- 06-MVRP Configuration Examples
- 07-VLAN Tagging Configuration Examples
- 08-S-MLAG Configuration Examples
- 09-Spanning Tree Configuration Examples
- Related Documents
-
Title | Size | Download |
---|---|---|
05-VLAN Configuration Examples | 99.26 KB |
Contents
Example: Configuring port-based VLANs
Applicable hardware and software versions
Example: Configuring the voice VLAN
Applicable hardware and software versions
Configuration restrictions and guidelines
Configuring 802.1X authentication
Introduction
This document provides examples of configuring the port-based VLAN, super VLAN, private VLAN, and voice VLAN.
Prerequisites
The configuration examples in this document 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.
This document assumes that you have basic knowledge of VLANs.
Example: Configuring port-based VLANs
Network configuration
As shown in Figure 1:
· Host A and Host C belong to Department A. VLAN 100 is assigned to Department A.
· Host B and Host D belong to Department B. VLAN 200 is assigned to Department B.
Configure port-based VLANs so that hosts only in the same department can communicate with each other.
Applicable hardware and software versions
The following matrix shows the hardware and software versions to which this configuration example is applicable:
Hardware |
Software version |
S9850-G switch series |
Release 6010P03 and later |
S6850-G switch series S6805-G switch series |
Release 6010P03 and later |
S6530X switch series |
Release 8108P22 and later |
S5590-HI switch series |
Release 6010P03 and later |
S5590-EI switch series S5500V3-HI switch series |
Release 6010P03 and later |
S6520X-EI-G switch series S6520XP-EI-G switch series |
Release 7748 and later |
S5590XP-HI-G switch series |
Release 7748 and later |
S5560-EI-G switch series |
Release 7748 and later |
S5500-D-G switch series S5100-D-G switch series |
Release 6010P03 and later |
S5130S-HI-G switch series |
Release 6010P03 and later |
S5130S-EI-G switch series (except S5130S-30C-EI-G and S5130S-54C-EI-G switches) |
Release 6010P03 and later |
S5130S-30C-EI-G switch S5130S-54C-EI-G switch |
Release 7748 and later |
Procedures
# Configure the ports Ten-GigabitEthernet 1/0/1 through Ten-GigabitEthernet 1/0/3 to operate in bridge mode.
[DeviceA] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/3
[DeviceA-if-range] port link-mode bridge
[DeviceA-if-range] quit
# Create VLAN 100, and assign Ten-GigabitEthernet 1/0/1 to VLAN 100.
[DeviceA-vlan100] port ten-gigabitethernet 1/0/1
[DeviceA-vlan100] quit
# Create VLAN 200, and assign Ten-GigabitEthernet 1/0/2 to VLAN 200.
[DeviceA-vlan200] port ten-gigabitethernet 1/0/2
[DeviceA-vlan200] quit
# Configure Ten-GigabitEthernet 1/0/3 as a trunk port, and assign it to VLANs 100 and 200.
[DeviceA] interface ten-gigabitethernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/3] port trunk permit vlan 100 200
2. Configure Device B in the same way Device A is configured. (Details not shown.)
3. Configure hosts:
a. Configure Host A and Host C to be on the same IP subnet. For example, 192.168.100.0/24.
b. Configure Host B and Host D to be on the same IP subnet. For example, 192.168.200.0/24.
Verifying the configuration
# Verify that Host B and Host D can ping each other, but they both fail to ping Host A or Host C. (Details not shown.)
# Display information about VLANs 100 and 200 on Device A.
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 100
VLAN ID: 100
VLAN type: Static
Route interface: Not configured
Description: VLAN 0100
Name: VLAN 0100
Tagged ports:
Ten-GigabitEthernet1/0/3
Untagged ports:
Ten-GigabitEthernet1/0/1
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 200
VLAN ID: 200
VLAN type: Static
Route interface: Not configured
Description: VLAN 0200
Name: VLAN 0200
Tagged ports:
Ten-GigabitEthernet1/0/3
Untagged ports:
Ten-GigabitEthernet1/0/2
The output shows that:
· Ten-GigabitEthernet 1/0/3 and Ten-GigabitEthernet 1/0/1 permit packets from 100 to pass through.
· Ten-GigabitEthernet 1/0/3 and Ten-GigabitEthernet 1/0/2 permit packets from 200 to pass through.
Configuration files
Configuration files on both Device B and Device A are the same. The following configuration files use Device A as an example.
#
vlan 100
#
vlan 200
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 100
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 200
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100 200
#
Example: Configuring the voice VLAN
Network configuration
As shown in Figure 2, the device connects to an IP phone through Ten-GigabitEthernet1/0/1, and the IP phone sends tagged voice traffic. The device authenticates the IP phone through the RADIUS server. If the IP phone passes authentication, the IP phone is allowed to access the device. Configure voice VLAN 2 on the device. Configure LLDP to enable the IP phone to automatically come online after passing 802.1X authentication.
Configure voice VLAN to meet the following requirements:
· The IP phone automatically comes online after passing 802.1X authentication on Ten-GigabitEthernet 1/0/1.
· The IP phone can automatically come online and send voice traffic without manually configured voice VLAN MAC addresses on the device.
Configuration considerations
· By default, an IP phone supports LLDP.
· When enabling LLDP for autodiscovering IP phones, you must configure the network-policy TLV to advertise voice VLAN information on Ten-GigabitEthernet 1/0/1.
· Enable the automatic voice VLAN assignment mode.
· Configure IP addresses for interfaces.
Applicable hardware and software versions
The following matrix shows the hardware and software versions to which this configuration example is applicable:
Hardware |
Software version |
S9850-G switch series |
Release 6010P03 and later |
S6850-G switch series S6805-G switch series |
Release 6010P03 and later |
S6530X switch series |
Release 8108P22 and later |
S5590-HI switch series |
Release 6010P03 and later |
S5590-EI switch series S5500V3-HI switch series |
Release 6010P03 and later |
S6520X-EI-G switch series S6520XP-EI-G switch series |
Release 7748 and later |
S5590XP-HI-G switch series |
Release 7748 and later |
S5560-EI-G switch series |
Release 7748 and later |
S5500-D-G switch series S5100-D-G switch series |
Release 6010P03 and later |
S5130S-HI-G switch series |
Release 6010P03 and later |
S5130S-EI-G switch series (except S5130S-30C-EI-G and S5130S-54C-EI-G switches) |
Release 6010P03 and later |
S5130S-30C-EI-G switch S5130S-54C-EI-G switch |
Release 7748 and later |
Configuration restrictions and guidelines
Whether the username sent to the RADIUS server includes the domain name depends on the RADIUS server configuration and whether the RADIUS server accepts usernames including domain names.
· If the server does not accept usernames including domain names or the service configured for user authentication on the server does not include a domain name, specify the username not to include the domain name (without-domain) on the device.
· If the server can accept usernames including domain names and the service configured for user authentication on the server includes a domain name, specify the username to include the domain name (with-domain) on the device.
Procedures
Configuring the voice VLAN
# Create VLAN 2.
<Device> system-view
[Device] vlan 2
[Device-vlan2] quit
# Enable LLDP globally.
[Device] lldp global enable
# Enable LLDP on Ten-GigabitEthernet 1/0/1, configure LLDP to operate in TxRx mode, and configure LLDP to advertise the voice VLAN ID.
[Device] interface ten-gigabitethernet 1/0/1
[Device-Ten-GigabitEthernet1/0/1] lldp enable
[Device-Ten-GigabitEthernet1/0/1] lldp admin-status txrx
[Device-Ten-GigabitEthernet1/0/1] lldp tlv-enable med-tlv network-policy 2
[Device-Ten-GigabitEthernet1/0/1] quit
# Enable the voice VLAN security mode, and set the voice VLAN aging timer to 30 minutes.
[Device] voice-vlan security enable
[Device] voice-vlan aging 30
# Enable LLDP for automatic IP phone discovery.
[Device] voice-vlan track lldp
# Configure Ten-GigabitEthernet 1/0/1 as a hybrid port, and configure the voice VLAN feature.
[Device] interface ten-gigabitethernet 1/0/1
[Device-Ten-GigabitEthernet1/0/1] port link-type hybrid
[Device-Ten-GigabitEthernet1/0/1] voice-vlan mode auto
[Device-Ten-GigabitEthernet1/0/1] voice-vlan 2 enable
Configuring 802.1X authentication
# Configure the RADIUS server, add user accounts, and make sure accounting, authorization, and accounting run properly for users. (Details not shown.)
# Create a RADIUS scheme. Configure the primary authentication and accounting servers and the keys for secure RADIUS authentication and accounting communication. Specify the device to remove the ISP domain name in the username sent to the RADIUS server.
[Device] radius scheme radius1
[Device-radius-radius1] primary authentication 10.1.1.1
[Device-radius-radius1] primary accounting 10.1.1.1
[Device-radius-radius1] key authentication simple name
[Device-radius-radius1] key accounting simple money
[Device-radius-radius1] user-name-format without-domain
[Device-radius-radius1] quit
# Create ISP domain bbb, and configure 802.1X users to use RADIUS scheme radius1 for authentication, authorization, and accounting.
[Device] domain bbb
[Device-isp-bbb] authentication lan-access radius-scheme radius1
[Device-isp-bbb] authorization lan-access radius-scheme radius1
[Device-isp-bbb] accounting lan-access radius-scheme radius1
[Device-isp-bbb] quit
# Configure 802.1X on Ten-GigabitEthernet 1/0/1, and specify mandatory 802.1X authentication domain bbb on the interface.
[Device] interface ten-gigabitethernet 1/0/1
[Device-Ten-GigabitEthernet1/0/1] dot1x
[Device-Ten-GigabitEthernet1/0/1] dot1x mandatory-domain bbb
# Enable the 802.1X multicast trigger feature. (Optional. By default, the 802.1X multicast trigger feature is enabled.)
[Device-Ten-GigabitEthernet1/0/1] dot1x multicast-trigger
[Device-Ten-GigabitEthernet1/0/1] quit
# Enable the 802.1x feature globally.
[Device] dot1x
# Configure the 802.1X client. (Details not shown.)
If you use an H3C iNode 802.1X client, for the backup authentication method local authentication to succeed, make sure the Upload version info option is not selected in the 802.1X connection properties.
Verifying the configuration
# Display 802.1X authentication information.
[Device] display dot1x interface ten-gigabitethernet 1/0/1
Global 802.1X parameters:
802.1X authentication : Enabled
CHAP authentication : Enabled
Max-tx period : 30 s
Handshake period : 15 s
Offline detect period : 300 s
Quiet timer : Disabled
Quiet period : 60 s
Supp timeout : 30 s
Server timeout : 100 s
Reauth period : 3600 s
Max auth requests : 2
User aging period for Auth-Fail VLAN : 1000 s
User aging period for Auth-Fail VSI : 1000 s
User aging period for critical VLAN : 1000 s
User aging period for critical VSI : 1000 s
User aging period for guest VLAN : 1000 s
User aging period for guest VSI : 1000 s
EAD assistant function : Disabled
EAD timeout : 30 min
Domain delimiter : @
Online 802.1X wired users : 1
Ten-GigabitEthernet1/0/1 is link-up
802.1X authentication : Enabled
Handshake : Enabled
Handshake reply : Disabled
Handshake security : Disabled
Offline detection : Disabled
Unicast trigger : Disabled
Periodic reauth : Disabled
Port role : Authenticator
Authorization mode : Auto
Port access control : MAC-based
Multicast trigger : Enabled
Mandatory auth domain : Not configured
Guest VLAN : Not configured
Auth-Fail VLAN : Not configured
Critical VLAN : Not configured
Critical voice VLAN : Disabled
Add Guest VLAN delay : Disabled
Re-auth server-unreachable : Logoff
Max online users : 4294967295
User IP freezing : Disabled
Reauth period : 0 s
Send Packets Without Tag : Disabled
Max Attempts Fail Number : 0
Guest VSI : Not configured
Auth-Fail VSI : Not configured
Critical VSI : Not configured
Add Guest VSI delay : Disabled
User aging : Enabled
Server-recovery online-user-sync : Enabled
Auth-Fail EAPOL : Disabled
Critical EAPOL : Disabled
EAPOL packets: Tx 0, Rx 0
Sent EAP Request/Identity packets : 0
EAP Request/Challenge packets: 0
EAP Success packets: 0
EAP Failure packets: 0
Received EAPOL Start packets : 0
EAPOL LogOff packets: 0
EAP Response/Identity packets : 0
EAP Response/Challenge packets: 0
Error packets: 0
Online 802.1X users: 1
After the IP phone enters the correct username and password and then comes online, use the display dot1x connection command to display the connections of online users.
# Display the voice VLAN state.
[Device] display voice-vlan state
Current voice VLANs: 1
Voice VLAN security mode: Security
Voice VLAN aging time: 30 minutes
Voice VLAN enabled ports and their modes:
Port VLAN Mode CoS DSCP
XGE1/0/1 2 Auto 6 46
Configuration files
#
voice-vlan aging 30
voice-vlan track lldp
#
dot1x
#
lldp global enable
#
vlan 1
#
vlan 2
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type hybrid
port hybrid vlan 1 untagged
voice-vlan 2 enable
lldp tlv-enable med-tlv network-policy 2
dot1x
dot1x mandatory-domain bbb
#
radius scheme radius1
primary authentication 10.1.1.1
primary accounting 10.1.1.1
key authentication cipher $c$3$/gxrbATUfK4BbF+73EQiCzBM7cwP86o=
key accounting cipher $c$3$mq8b76RILWQr2lH7NTtvE9+7O0v7vd1H
user-name-format without-domain
#
radius scheme system
user-name-format without-domain
#
domain bbb
accounting login radius-scheme radius1
authentication lan-access radius-scheme radius1
authorization lan-access radius-scheme radius1