How to setup vlans and routing on a L3 switch running IOS software.

Many companies use L3 switches on their internal networks to provide connectivity between PCs, servers etc and they use multiple vlans to control traffic.

1.Create the L2 vlans on the switch eg. vlans 3, 4, 5

switch(config)# vlan 3
switch(config-vlan)# name v3
switch(config)# vlan 4
switch(config-vlan)# name v4
switch(config)# vlan 5
switch(config-vlan)# name v5

To verify the vlans

switch# sh vlan brief

 

2. Create the L3 interfaces for the vlans (on n a L3 switch the L3 interfaces for vlans are called SVIs – Switched Virtual Interfaces)

int vlan 3
ip address 192.168.3.1 255.255.255.0
no shut

int vlan 4
ip address 192.168.4.1 255.255.255.0
no shut

int vlan 5
ip address 192.168.5.1 255.255.255.0
no shut

 

3. The L3 interfaces will only show as up/up if either or both of the following conditions are met.

a. One or more access ports are configured to be in the vlans and the port(s) are up/up

b. A trunk port is configured on this switch which is up/up and which the above vlans are allowed on

Now you can connect PCs, servers etc. to the switch, configure the port(s) to be in one of the vlans and then allocate an IP from the vlan IP subnet to the end device.

So a server connected to a port in vlan 3 would be allocated an IP address from the 192.168.3.0/24 subnet and the servers default gateway would be the vlan 3 SVI IP address of 192.168.3.1.

Providing IP routing is enabled the L3 switch will automatically route between the vlans with SVIs configured on the switch.