How To Configure A Cisco Layer 3 Switch
How To Configure A Cisco Layer 3 Switch
How To Configure A Cisco Layer 3 Switch
InterVLAN Routing
Cisco Catalysts switches equipped with the Enhanced Multilayer Image (EMI) can work as
Layer 3 devices with full routing capabilities. Example switch models that support layer 3
routing are the 3550, 3750, 3560 etc.
On a Layer3-capable switch, the port interfaces work as Layer 2 access ports by default, but you
can also configure them as “Routed Ports” which act as normal router interfaces. That is, you
can assign an IP address directly on the routed port. Moreover, you can configure also a Switch
Vlan Interface (SVI) with the “interface vlan” command which acts as a virtual layer 3 interface
on the Layer3 switch. If you don’t have a Layer3 switch available, you can also configure
InterVLAN routing using a simple Layer2 switch and a Router (also called Router-on-a-Stick).
On this post I will describe a scenario with a Layer3 switch acting as “Inter Vlan Routing”
device together with two Layer2 switches acting as closet access switches.
Moreover, a Cisco ASA firewall will provide Internet connectivity for all internal subnets. A
Routed Port will be configured between the Layer3 Switch and ASA internal interface to route
packets towards the internet (via the ASA).
The focus of this article is to show you how to configure the Layer2 and Layer3 switches to
provide routing between VLANs. At the end of this article you will find also important
routing configuration commands for the ASA and also how to use Access Control Lists (ACL)
on the Layer 3 switch to control traffic (permit or deny) between VLANs at Layer3 level.
This is a fairly popular network scenario that I have seen in many enterprise networks.
Two Vlans are created on the L2 and L3 switches, Vlan10 and Vlan20. On the Layer3 Switch,
for Vlan10 we will create an SVI with IP address 10.10.10.10 and for Vlan20 an SVI with IP
address 10.20.20.20. These two IP addresses will serve as the default gateway addresses for hosts
belonging to Vlan10 and Vlan20 on the Layer2 switches respectively. That is, hosts connected to
Vlan10 on the closet L2 switches will have as default gateway the IP address 10.10.10.10.
Similarly, hosts connected to Vlan20 on the closet switches will have address 10.20.20.20 as
their default gateway.
Traffic between Vlan10 and Vlan20 will be routed by the L3 Switch (InterVlan Routing). Also,
all interfaces connecting the three switches must be configured as Trunk Ports in order to allow
Vlan10 and Vlan20 tagged frames to pass between switches. Let’s see a configuration snapshot
for all switches below:
Layer2-Switch(config)# vlan 20
Layer2-Switch(config-vlan)# name ENGINEERING
Layer2-Switch(config-vlan)# exit
Layer3-Switch(config)# vlan 20
Layer3-Switch(config)# name ENGINEERING
Layer3-Switch(config-vlan)# exit
The configuration above creates an Access Control List to restrict access between Vlan10 to
Vlan20. Specifically, it allows host 10.10.10.1 to access only host 10.20.20.1 and all other traffic
between Vlan10 to Vlan20 is denied. Moreover, access to anything else (i.e Internet) from
vlan10 is allowed. The ACL above is applied on vlan10 SVI in the “in” direction.
ASA(config)# route outside 0.0.0.0 0.0.0.0 2.2.2.2 <– This is default route towards internet
ASA(config)# route inside 10.10.10.0 255.255.255.0 10.0.0.1 <– static route to reach vlan10
ASA(config)# route inside 10.20.20.0 255.255.255.0 10.0.0.1 <– static route to reach vlan20
The above ASA sample configuration shows the necessary static routing required on the ASA to
route packets back to vlan10 (10.10.10.0) and vlan20 (10.20.20.0) via IP 10.0.0.1 which is the
Layer3 switch IP.
See also my other article about a Layer 2 / Layer 3 Switch Design and Configuration example
with aggregation and access switches and Port Channels for link redundancy.