Switched Virtual Interfaces
A multilayer switch can route between its own VLANs. Each VLAN gets a virtual routed interface, an SVI: interface vlan 10 with the gateway address. Then turn routing on with the global command ip routing (off by default on most switches).
In NetLab
▶ MLS1 MLS1>enable MLS1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. MLS1(config)#ip routing MLS1(config)#interface vlan 10 *Mar 1 00:00:04.000: %LINK-3-UPDOWN: Interface Vlan10, changed state to up *Mar 1 00:00:04.000: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up MLS1(config-if)#ip address 192.168.10.1 255.255.255.0 MLS1(config-if)#no shutdown MLS1(config-if)#interface vlan 20 *Mar 1 00:00:07.000: %LINK-3-UPDOWN: Interface Vlan20, changed state to up *Mar 1 00:00:07.000: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up MLS1(config-if)#ip address 192.168.20.1 255.255.255.0 MLS1(config-if)#no shutdown MLS1(config-if)#interface vlan 30 *Mar 1 00:00:10.000: %LINK-3-UPDOWN: Interface Vlan30, changed state to up MLS1(config-if)#ip address 192.168.30.1 255.255.255.0 MLS1(config-if)#no shutdown MLS1(config-if)#end *Mar 1 00:00:13.000: %SYS-5-CONFIG_I: Configured from console by console MLS1#show ip interface brief | include Vlan Vlan1 unassigned YES unset administratively down down Vlan10 192.168.10.1 YES manual up up Vlan20 192.168.20.1 YES manual up up Vlan30 192.168.30.1 YES manual up down ▶ PC1 NetLab Windows-style command prompt. Type help to see the commands. C:\Users\student>ping 192.168.20.10 Pinging 192.168.20.10 with 32 bytes of data: Request timed out. Reply from 192.168.20.10: bytes=32 time<1ms TTL=63 Reply from 192.168.20.10: bytes=32 time<1ms TTL=63 Reply from 192.168.20.10: bytes=32 time<1ms TTL=63 Ping statistics for 192.168.20.10: Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
When is an SVI up?
Vlan30 above is up/down. An SVI's line protocol is up only when all of these are true:
- The VLAN exists in the switch's VLAN database.
- At least one port in the VLAN is up and forwarding (an access port, or a trunk that carries it).
- The SVI isn't shut down.
Routed ports
A switch port can also act like a router port: no switchport turns it into a routed port with its own IP address, ideal for the link to a router or another layer 3 switch. Add a default route and the LAN can reach the rest of the network:
In NetLab
▶ MLS1 MLS1>enable MLS1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. MLS1(config)#interface g0/1 MLS1(config-if)#no switchport MLS1(config-if)#ip address 10.0.0.1 255.255.255.252 MLS1(config-if)#exit MLS1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2 MLS1(config)#end *Mar 1 00:00:08.000: %SYS-5-CONFIG_I: Configured from console by console MLS1#show ip route | begin Gateway Gateway of last resort is 10.0.0.2 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 10.0.0.2 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 10.0.0.0/30 is directly connected, GigabitEthernet0/1 L 10.0.0.1/32 is directly connected, GigabitEthernet0/1 192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.10.0/24 is directly connected, Vlan10 L 192.168.10.1/32 is directly connected, Vlan10 192.168.20.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.20.0/24 is directly connected, Vlan20 L 192.168.20.1/32 is directly connected, Vlan20 ▶ PC2 student@PC2:~$ traceroute 8.8.8.8 traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets 1 192.168.20.1 (192.168.20.1) 0.710 ms 0.710 ms 0.710 ms 2 8.8.8.8 (8.8.8.8) * 1.210 ms 1.210 ms
Remember: Multilayer switch checklist:
ip routing, an SVI per VLAN withno shutdown, the VLAN created and active, andno switchportfor routed uplinks.