Monthly Archives: January 2020

Cisco VLAN Range

 

Release

Modification

12.0(7)XE

The interface range command was introduced.

12.1(5)T

The interface range command was integrated into Cisco IOS Release 12.1(5)T.

12.2(2)DD

The interface range command was expanded to enable configuration of subinterfaces.

C

onfiguring a Range of VLAN Subinterfaces

 
 

Command

Purpose

Step 1

Router(config)# interface range {{ethernet | fastethernet | gigabitethernet | atmslot/interface.subinterface – {{ethernet | fastethernet | gigabitethernet | atm}slot/interface.subinterface}

Selects the range of subinterfaces to be configured.

Note The space before the dash is required. For example, the command interface range fastethernet 1 – 5 is valid; the command interface range fastethernet 1-5 is not valid.

Step 2

Router(config-int-range)# encapsulation dot1Q vlan-id

Applies a unique VLAN ID to each subinterface within the range.

vlan-id—Virtual LAN identifier. The allowed range is from 1 to 4095.

The VLAN ID specified by the vlan-id argument is applied to the first subinterface in the range. Each subsequent interface is assigned a VLAN ID which is the specified vlan-id plus the subinterface number minus the first subinterface number (VLAN ID + subinterface number – first subinterface number).

Single Range Configuration Example

The following example configures the Fast Ethernet subinterfaces within the range 5/1.1 and 5/1.4 and applies the following VLAN IDs to those subinterfaces:

Fast Ethernet5/1.1 = VLAN ID 301 (vlan-id)

Fast Ethernet5/1.2 = VLAN ID 302 (vlan-id=301 + 2 – 1=302)

Fast Ethernet5/1.3 = VLAN ID 303 (vlan-id=301 + 3 – 1=303)

Fast Ethernet5/1.4 = VLAN ID 304 (vlan-id=301 + 4 – 1=304)

Router(config)# interface range fastethernet5/1.1 - fastethernet5/1.4 

Router(config-if)# encapsulation dot1Q 301

Router(config-if)# no shutdown 

Router(config-if)#

Configuring the Allowed VLANs for Trunking Ports

configure the allowed VLAN for a trunk port, perform this task:

Command
Purpose

Step 1

switch# configure terminal

Enters configuration mode.

Step 2

switch(config)# interface { type slot / port | port-channel number }

Specifies an interface to configure, and enters interface configuration mode.

Step 3

switch(config-if)# switchport trunk allowed vlan { vlan-list all | none [ add |except | none | remove { vlan-list }]}

Sets allowed VLANs for the trunk interface. The default is to allow all VLANs on the trunk interface: 1 to 3967 and 4048 to 4094. VLANs 3968 to 4047 are the default VLANs reserved for internal use by default; this group of VLANs is configurable. By default, all VLANs are allowed on all trunk interfaces.

Note You cannot add internally allocated VLANs as allowed VLANs on trunk ports. The system returns a message if you attempt to list an internally allocated VLAN as an allowed VLAN.

This example shows how to add VLANs 15 to 20 to the list of allowed VLANs on the Ethernet 3/1 Ethernet trunk port:

switch# configure terminal
switch(config)# interface ethernet 3/1
switch(config-if)# switchport trunk allow vlan 15-20

Verifying Interface Configuration

To display access and trunk interface configuration information, perform one of these tasks:

Command
Purpose

switch# show interface

Displays the interface configuration

switch# show interface switchport

Displays information for all Ethernet interfaces, including access and trunk interfaces.

switch# show interface brief

Displays interface configuration information.

Configuring the Native VLAN for 802.1Q Trunking Ports

If you do not configure this parameter, the trunk port uses the default VLAN as the native VLAN ID.

To configure native VLAN for a 802.1Q trunk port, perform this task:

Command
Purpose

Step 1

switch# configure terminal

Enters configuration mode.

Step 2

switch(config)# interface { type slot / port | port-channel number }

Specifies an interface to configure, and enters interface configuration mode.

Step 3

switch(config-if)# switchport trunk native vlan vlan-id

Sets the native VLAN for the 802.1Q trunk. Valid values are from 1 to 4094, except those VLANs reserved for internal use. The default value is VLAN1.

This example shows how to set the native VLAN for Ethernet 3/1 Ethernet trunk port to VLAN 5:

switch# configure terminal
switch(config)# interface ethernet 3/1
switch(config-if)# switchport trunk native vlan 5

Cisco Configuring Trunk Ports

onfigure a trunk port, perform this task:

Command
Purpose

Step 1

switch# configure terminal

Enters configuration mode.

Step 2

switch(config)# interface { type slot / port | port-channel number }

Specifies an interface to configure, and enters interface configuration mode.

Step 3

switch(config-if)# switchport mode { access | trunk }

Sets the interface as an Ethernet trunk port. A trunk port can carry traffic in one or more VLANs on the same physical link (VLANs are based on the trunk-allowed VLANs list). By default, a trunk interface can carry traffic for all VLANs. To specify that only certain VLANs are allowed on the specified trunk, use the switchport trunk allowed vlan command.

This example shows how to set Ethernet 3/1 as an Ethernet trunk port:

switch# configure terminal
switch(config)# interface ethernet 3/1
switch(config-if)# switchport mode trunk