Table of Contents
Configuring Virtual LANs
About VLANs
Configuring VLANs with ISL Encapsulation
Configuring VLANs with 802.1Q Encapsulation
Monitoring VLAN Operation
Configuring Virtual LANs
This chapter describes basic configuration tasks for Virtual LANs (VLANs) and includes the following sections:
About VLANs
VLANs enable network managers to group users logically rather than by physical location. A VLAN emulates a standard LAN, which allows data transfer and communication to occur without the traditional restraints placed on the network. It can also be considered a broadcast domain set up within a switch. With VLANs, switches can support more than one subnetwork (or VLAN) on each switch, and give routers and switches the opportunity to support multiple subnets on a single physical link. A group of devices on a LAN is configured so that the devices communicate as if they were attached to the same LAN segment. In actuality, the devices are located on different segments. Figure 8-1 shows an example of VLANs segmented into logically defined networks.
Figure 8-1 VLANs Configured as Logically Defined Networks

VLANs enable efficient traffic separation and provide excellent bandwidth utilization. VLANs also alleviate scaling issues by logically segmenting the physical LAN structure into different subnetworks so that packets are switched only between ports within the same VLAN. This can be very useful for security, broadcast containment, and accounting.
Layer 3 switching software supports a port-based VLAN on a trunk port, which is a port that carries the traffic of multiple VLANs. Each frame transmitted on a trunk link is tagged as belonging to only one VLAN.
Figure 8-2 shows three VLANs configured from a Layer 2 switch, which connects to a
Catalyst 8540 CSR through a trunk line.
Figure 8-2 Sample VLAN Configuration

VLAN Encapsulation
Layer 3 switching software supports VLAN frame encapsulation through the Inter-Switch Link (ISL) protocol and the 802.1Q standard.
To configure encapsulation over the EtherChannel, see the "About Encapsulation over EtherChannel" section.
 |
Note The four adjacent ports (such as 0 through 3, or 4 through 7) on a 10/100 interface must all use the same VLAN encapsulation; that is, either 802.1Q, or ISL. |
Configuring VLANs for Routing or Bridging
VLANS can be configured for routing or bridging, depending on the type of traffic you are running. IP and IPX traffic can be routed. Non-IP/IPX traffic, such as LAT traffic, must be bridged. The following sections describe how to route and bridge traffic between VLANs with ISL and 802.1Q encapsulation.
Maximum VLAN Bridge Group Values
The maximum VLAN bridge group values follow:
- Maximum number of bridge groups: 64
- Maximum number of interfaces per bridge group: 128
Configuring VLANs with ISL Encapsulation
Inter-Switch Link (ISL) is a Cisco protocol for interconnecting multiple switches and maintaining VLAN information as traffic travels between switches. This section describes how to configure VLANs with ISL encapsulation.
Routing IP Traffic Between VLANs with ISL Encapsulation
To route IP traffic between VLANs with ISL encapsulation, perform the following steps, beginning in global configuration mode.
|
Command |
Purpose |
Step 1
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
Note Specify either a Gigabit Ethernet or Fast Ethernet interface.
|
Step 2
|
Router(config-subif)# encapsulation isl vlan-id
|
Uses ISL to encapsulate the Ethernet frames sent from this subinterface with a header that maintains the specified vlan-id between network nodes.
|
Step 3
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface ip address ip-address subnet-mask
|
Sets a primary IP address for the subinterface.
|
Example
The following example shows how to configure three VLANs (VLAN 1, VLAN 2, VLAN 3) for IP routing with ISL encapsulation:
Router(config)# interface gigabitethernet 1/0/1.1
Router(config-subif)# encapsulation isl 1
Router(config-subif)# ip address 192.168.1.1 255.255.255.0
Router(config-subif)# exit
Router(config)# interface gigabitethernet 1/0/1.2
Router(config-subif)# encapsulation isl 2
Router(config-subif)# ip address 192.168.2.1 255.255.255.0
Router(config-subif)# exit
Router(config)# interface gigabitethernet 1/0/1.3
Router(config-subif)# encapsulation isl 3
Router(config-subif)# ip address 192.168.3.1 255.255.255.0
Router(config-subif)# end
Router# copy system:running-config nvram:startup-config
 |
Note When configuring ISL with IP, you cannot configure IP addresses on a subinterface unless the VLANs are already configured (that is, you must have already entered the encapsulation isl command). This is not the case with IPX; you can configure IPX networks on a subinterface even when the VLANs have not been configured. |
Verifying the ISL Configuration (Routing IP Traffic Between VLANs)
To verify the ISL configuration, use the following EXEC command:
| Command |
Purpose |
|
show running-config
|
Displays the system configuration.
|
Example
The following example shows the resulting configuration, using the show running-config command:
8540CSR# show running-config
Building configuration...
interface GigabitEthernet1/0/1.1
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
interface GigabitEthernet1/0/1.3
ip address 192.168.3.1 255.255.255.0
Routing IPX Traffic Between VLANs with ISL Encapsulation
To route IPX traffic between VLANs with ISL encapsulation, perform the following steps, beginning in global configuration mode:
|
Command |
Purpose |
Step 1
|
Router(config)# ipx routing
|
Enables IPX routing globally.
|
Step 2
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
Note Specify either a Gigabit Ethernet or Fast Ethernet interface.
|
Step 3
|
Router(config-subif)# encapsulation isl vlan-id
|
Uses ISL to encapsulate Ethernet frames sent from the subinterface with a header that maintains the specified vlan-id between network nodes.
|
Step 4
|
Router(config-subif)# ipx network network-number encapsulation encapsulation-type
|
Enables IPX routing on the subinterface with the specified IPX encapsulation type.
|
Example
The following example shows how to configure VLANs with ISL encapsulation and assign different IPX networks and encapsulation for each subinterface:
Router(config)# ipx routing
Router(config)# interface gigabitethernet 9/0/0.2
Router(config-subif)# encapsulation isl 2
Router(config-subif)# ipx network 2
Router(config-subif)# exit
Router(config)# interface gigabitethernet 9/0/0.3
Router(config-subif)# encapsulation isl 3
Router(config-subif)# ipx network 3 encapsulation sap
Router(config-subif)# exit
Router(config)# interface gigabitethernet 9/0/0.4
Router(config-subif)# encap isl 4
Router(config-subif)# ipx network 4 encapsulation arpa
Router(config-subif)# end
Router# copy system:running-config nvram:startup-config
Verifying the ISL Configuration (Routing IPX Traffic Between VLANs)
To verify the ISL configuration, use the following EXEC command:
| Command |
Purpose |
|
show running-config
|
Displays the system configuration.
|
Example
The following example shows the resulting configuration, using the show running-config command:
540CSR#
show running-config
Building configuration...
interface GigabitEthernet9/0/0.2
interface GigabitEthernet9/0/0.3
interface GigabitEthernet9/0/0.4
ipx network 4 encapsulation ARPA
Bridging Non-IP/IPX Traffic Between VLANs with ISL Encapsulation
To bridge non-IP/IPX traffic between VLANs with ISL encapsulation, perform the following steps, beginning in global configuration mode:
|
Command |
Purpose |
Step 1
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
Note Specify either a Gigabit Ethernet or Fast Ethernet interface.
|
Step 2
|
Router(config-subif)# encapsulation isl vlan-id
|
Uses ISL to encapsulate the Ethernet frames sent from this subinterface with a header that maintains the specified vlan-id between network nodes.
|
Step 3
|
Router(config-subif)# ip address ip-address subnet-mask
|
Sets a primary IP address for the subinterface.
|
Step 4
|
Router(config-subif)# bridge-group number
|
Assigns the subinterface a bridge group number.
|
Step 5
|
Router(config-subif)# exit
Router(config)#
|
Returns to global configuration mode.
|
Step 6
|
Router(config)# bridge number protocol ieee
|
Specifies that the bridge group will use IEEE Ethernet Spanning Tree Protocol.
|
Example
The following example shows how to configure three VLANs (VLAN 1, VLAN 2, VLAN 3) and perform bridging with ISL encapsulation:
Router(config)# interface gigabitethernet 1/0/1.1
Router(config-subif)# encapsulation isl 1
Router(config-subif)# ip address 192.168.1.1 255.255.255.0
Router(config-subif)# bridge-group 1
Router(config-subif)#
exit
Router(config)# interface gigabitethernet 1/0/1.2
Router(config-subif)# encapsulation isl 2
Router(config-subif)# ip address 192.168.2.1 255.255.255.0
Router(config-subif)# bridge-group 1
Router (config-subif)# exit
Router(config)# interface gigabitethernet 1/0/1.3
Router(config-subif)# encapsulation isl 3
Router(config-subif)# ip address 192.168.3.1 255.255.255.0
Router(config-subif)# bridge-group 1
Router(config-subif)# exit
Router(config)# bridge 1 protocol ieee
Router# copy system:running-config nvram:startup-config
The following ping command confirms connectivity between the Catalyst 8540 CSR [C8540BldgA] in Building A and a SunSPARC workstation in building B [SunSPARCBldgB] with IP address 172.20.52.60:
8540CSR#
ping 172.20.52.60
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.20.52.60, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
The following ping command confirms connectivity between the Catalyst 8540 CSR in Building A and an Intel PC in building A with IP address 172.20.52.35:
8540CSR#
ping 172.20.52.35
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.20.52.35, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
The following traceroute command confirms connectivity and shows the hops between the Catalyst 8540 CSR in Building A and the Intel PC in building A with IP address 172.20.52.35:
8540CSR#
traceroute 172.20.52.35
Type escape sequence to abort.
Tracing the route to 172.20.52.35
2 172.20.52.121 0 msec 4 msec *
The following traceroute command confirms connectivity and shows the hops between the Catalyst 8540 CSR in Building A and the Sun SPARC workstation in building B with IP address 172.20.52.60:
8540CSR#
traceroute 172.20.52.60
Type escape sequence to abort.
Tracing the route to SunSPARCBldgB.cisco.com (172.20.52.60)
1 172.20.52.1 4 msec 0 msec 4 msec
2 172.20.1.203 0 msec 4 msec 0 msec
3 eng-wbu-serv-1.cisco.com (171.69.196.6) 4 msec 4 msec 0 msec
4 eng-cc-3.cisco.com (171.69.4.45) 4 msec 4 msec 8 msec
5 eng-fr-1.cisco.com (171.69.121.34) 4 msec 4 msec 4 msec
6 SunSPARCBldgB.cisco.com (172.20.52.60) 60 msec * 60 msec
Verifying the ISL Configuration (Bridging Non-IP/IPX Traffic Between VLANs)
To verify the ISL configuration, use the following EXEC command:
| Command |
Purpose |
|
show running-config
|
Displays the system configuration.
|
Example
The following example shows the resulting configuration, using the show running-config command:
8540CSR#
show running-config
Building configuration...
interface GigabitEthernet1/0/1.1
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
ipx encapsulation NOVELL-ETHER
interface GigabitEthernet1/0/1.3
ip address 192.168.3.1 255.255.255.0
ipx network 4 encapsulation ARPA
Configuring VLANs with 802.1Q Encapsulation
The IEEE 802.1Q standard provides a method for secure routing and bridging of data across a shared backbone. IEEE 802.1Q VLAN encapsulation uses an internal, or one level, packet tagging scheme to multiplex VLANs across a single physical link, while maintaining strict adherence to the individual VLAN domains.
On an IEEE 802.1Q trunk port, all transmitted and received frames are tagged except for those on the one VLAN configured as the PVID (port VLAN identifier) or native VLAN for the port. Frames on the native VLAN are always transmitted untagged and are normally received untagged.
Routing IP Traffic Between VLANs with 802.1Q Encapsulation
To route IP traffic between VLANs with 802.1Q encapsulation, perform the following steps, beginning in global configuration mode:
|
Command |
Purpose |
Step 1
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
Note Specify either a Gigabit Ethernet or Fast Ethernet interface.
|
Step 2
|
Router(config-subif)# encapsulation dot1q vlan-id
|
Uses 802.1Q to encapsulate the Ethernet frames sent from this subinterface with a header that maintains the specified vlan-id between network nodes.
|
Step 3
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface ip address ip-address subnet-mask
|
Sets a primary IP address for the subinterface.
|
Example
The following example shows how to configure three VLANs (VLAN 1, VLAN 2, VLAN 3) for IP routing with 802.1Q encapsulation:
Router(config)# interface gigabitethernet 1/0/1.1
Router(config-subif)# encapsulation dot1q 1
Router(config-subif)# ip address 192.168.1.1 255.255.255.0
Router(config-subif)#
exit
Router(config)# interface gigabitethernet 1/0/1.2
Router(config-subif)# encapsulation dot1q 2
Router(config-subif)# ip address 192.168.2.1 255.255.255.0
Router(config-subif)# exit
Router(config)# interface gigabitethernet 1/0/1.3
Router(config-subif)# encapsulation dot1q 3
Router(config-subif)# ip address 192.168.3.1 255.255.255.0
Router(config-subif)# end
Router# copy system:running-config nvram:startup-config
 |
Note When configuring 802.1Q with IP, you cannot configure IP addresses on a subinterface unless the VLANs are already configured (that is, you must have already entered the encapsulation dot1q command). This is not the case with IPX; you can configure IPX networks on a subinterface even when the VLANs have not been configured. |
Verifying the 802.1Q Configuration (Routing IP Traffic Between VLANs)
To verify the 802.1Q configuration, use the following EXEC command:
| Command |
Purpose |
|
show running-config
|
Displays the system configuration.
|
Example
The following example shows the resulting configuration, using the show running-config command:
8540CSR#
show running-config
Building configuration...
interface GigabitEthernet1/0/1.1
encapsulation dot1Q 1 native
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
interface GigabitEthernet1/0/1.3
ip address 192.168.3.1 255.255.255.0
Routing IPX Traffic Between VLANs with 802.1Q Encapsulation
To route IPX traffic between VLANs with 802.1Q encapsulation, perform the following steps, beginning in global configuration mode:
|
Command |
Purpose |
Step 1
|
Router(config)# ipx routing
|
Enables IPX routing globally.
|
Step 2
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
Note Specify either a Gigabit Ethernet or Fast Ethernet interface.
|
Step 3
|
Router(config-subif)# encapsulation dot1q vlan-id
|
Uses 802.1Q to encapsulate Ethernet frames sent from the subinterface with a header that maintains the specified vlan-id between network nodes.
|
Step 4
|
Router(config-subif)# ipx network network-number
|
Enables IPX routing on the subinterface.
|
Example
The following example shows how to configure VLANs with 802.1Q encapsulation and assign different IPX networks and encapsulation for each subinterface:
Router(config)# ipx routing
Router(config)# interface gigabitethernet 9/0/0.2
Router(config-subif)# encapsulation dot1q 2
Router(config-subif)# ipx network 2
Router(config-subif)#
exit
Router(config)# interface gigabitethernet 9/0/0.3
Router(config-subif)# encapsulation dot1q 3
Router(config-subif)# ipx network 3 encapsulation sap
Router(config-subif)#
exit
Router(config)# interface gigabitethernet 9/0/0.4
Router(config-subif)# encap dot1q 4
Router(config-subif)# ipx network 4 encapsulation arpa
Router(config-subif)# end
Router# copy system:running-config nvram:startup-config
Verifying the 802.1Q Configuration (Routing IPX Traffic Between VLANs)
To verify the 802.1Q configuration, use the following EXEC command:
| Command |
Purpose |
|
show running-config
|
Displays the system configuration.
|
Example
The following example shows the resulting configuration, using the show running-config command:
8540CSR#
show running-config
Building configuration...
interface GigabitEthernet9/0/0.2
interface GigabitEthernet9/0/0.3
interface GigabitEthernet9/0/0.4
ipx network 4 encapsulation ARPA
Bridging Non-IP/IPX Traffic Between VLANs with 802.1Q Encapsulation
To bridge non-IP/IPX traffic between VLANs with 802.1Q encapsulation, perform the following steps, beginning in global configuration mode.
|
Command |
Purpose |
Step 1
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
Note Specify either a Gigabit Ethernet or Fast Ethernet interface.
|
Step 2
|
Router(config-subif)# encapsulation dot1q vlan-id
|
Uses 802.1Q to encapsulate the Ethernet frames sent from this subinterface with a header that maintains the specified vlan-id between network nodes.
|
Step 3
|
Router(config-subif)# bridge-group number
|
Assigns the subinterface a bridge group number.
|
Step 4
|
Router(config-subif)# exit
Router(config)#
|
Returns to global configuration mode.
|
Step 5
|
Router(config)# bridge number protocol ieee
|
Specifies that the bridge group will use IEEE Ethernet Spanning Tree Protocol.
|
Example
The following example shows how to configure three VLANs (VLAN 1, VLAN 2, VLAN 3) and perform bridging with 802.1Q encapsulation:
Router(config)# interface gigabitethernet 1/0/1.1
Router(config-subif)# encapsulation dot1q 1
Router(config-subif)# bridge-group 1
Router(config-subif)#
exit
Router(config)# interface gigabitethernet 1/0/1.2
Router(config-subif)# encapsulation dot1q 2
Router(config-subif)# bridge-group 1
Router(config-subif)#
exit
Router(config)# interface gigabitethernet 1/0/1.3
Router(config-subif)# encapsulation dot1q 3
Router(config-subif)# bridge-group 1
Router(config-subif)# exit
Router(config)# bridge 1 protocol ieee
Router# copy system:running-config nvram:startup-config
Verifying the 802.1Q Configuration (Bridging Non-IP/IPX Traffic Between VLANs)
To verify the 802.1Q configuration, use the following EXEC command:
| Command |
Purpose |
|
show running-config
|
Displays the system configuration.
|
Example
The following example shows the resulting configuration, using the show running-config command:
8540CSR#
show running-config
Building configuration...
interface GigabitEthernet1/0/1.1
interface GigabitEthernet1/0/1.2
interface GigabitEthernet1/0/1.3
Bridging Between Native and Non-Native VLANs with 802.1Q Encapsulation
To configure bridging between native and non-native VLANs, perform the following steps, beginning in global configuration mode:
|
Command |
Purpose |
Step 1
|
Router(config)# interface gigabitethernet slot/subslot/interface.subinterface
Router(config-subif)#
|
Enters subinterface configuration mode.
|
Step 2
|
Router(config-subif)# encap dot1q vlan-id native
|
Uses 802.1Q to encapsulate Ethernet frames sent from the subinterface with a header that maintains the specified native vlan-id between network nodes.
 |
Note By default, VLAN 1 is the native VLAN, so it is not necessary to specify native when specifying the encapsulation for VLAN 1. To specify a different VLAN as the native VLAN, you must specify native when specifying the encapsulation. |
 |
Note If you are configuring VLAN routing, skip Step 3 and proceed to Step 4. |
|
Step 3
|
Router(config-subif)# bridge-group number
|
Assigns the subinterface to a specified bridge group.
|
Step 4
|
Router(config-subif)# interface gigabitethernet slot/subslot/interface
|
Enters interface configuration mode to configure the Fast Ethernet main interface.
|
Step 5
|
Router(config-if)# bridge-group number
|
Assigns the main interface to a specified bridge group.
|
Step 6
|
Router(config-if)# exit
|
Returns to global configuration mode.
|
Step 7
|
Router(config)# bridge bridge-group protocol ieee
|
Specifies that the bridge group will use the IEEE Ethernet Spanning Tree Protocol.
|
Example
The following example shows how to configure the bridging between native and non-native 802.1Q VLANs:
Router(config)# interface gigabitethernet 1/0/1.1
Router(config-subif)# encap dot1q 1 native
Router(config-subif)# bridge-group 1
Router(config-subif)# interface gigabitethernet 1/0/0
Router(config-if)# bridge-group 1
Router(config)# bridge 1 protocol ieee
Router(config)# interface gigabitethernet 1/0/1.2
Router(config-subif)# encap dot1q 100
Router(config-subif)# bridge-group 2
Router(config-subif)# interface gigabitethernet 3/0/1
Router(config-subif)# bridge-group 2
Router(config-subif)# exit
Router(config)# bridge 2 protocol ieee
Router# copy system:running-config nvram:startup-config
Monitoring VLAN Operation
Once the VLANs are configured on the switch router, you can monitor their operation using the following command:
| Command |
Purpose |
|
debug vlan packet
|
Displays contents of the packets sent to and exiting from the route processor.
|