Configure Switch Virtual Interfaces to enable inter-VLAN routing and provide Layer 3 connectivity for VLANs.
Step 1: Enable IP routing on the switch
1
2
3
|
SW1>enable
SW1#configure terminal
SW1(config)#ip routing
|
Step 2: Create VLANs first
Ensure the VLANs exist before creating their corresponding SVI interfaces.
1
2
3
4
5
6
7
8
9
|
SW1(config)#vlan 10
SW1(config-vlan)#name Sales
SW1(config-vlan)#exit
SW1(config)#vlan 20
SW1(config-vlan)#name Marketing
SW1(config-vlan)#exit
SW1(config)#vlan 30
SW1(config-vlan)#name IT
SW1(config-vlan)#exit
|
Step 3: Create and configure SVI interfaces
Configure the virtual interfaces with IP addresses to serve as default gateways for each VLAN.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
SW1(config)#interface vlan 10
SW1(config-if)#description Sales Gateway
SW1(config-if)#ip address 192.168.10.1 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface vlan 20
SW1(config-if)#description Marketing Gateway
SW1(config-if)#ip address 192.168.20.1 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface vlan 30
SW1(config-if)#description IT Gateway
SW1(config-if)#ip address 192.168.30.1 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
|
Step 4: Configure access ports for each VLAN
Assign switch ports to the appropriate VLANs so devices can communicate through their SVI gateways.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
SW1(config)#interface range fastEthernet 0/1-8
SW1(config-if-range)#switchport mode access
SW1(config-if-range)#switchport access vlan 10
SW1(config-if-range)#exit
SW1(config)#interface range fastEthernet 0/9-16
SW1(config-if-range)#switchport mode access
SW1(config-if-range)#switchport access vlan 20
SW1(config-if-range)#exit
SW1(config)#interface range fastEthernet 0/17-24
SW1(config-if-range)#switchport mode access
SW1(config-if-range)#switchport access vlan 30
SW1(config-if-range)#end
|
Step 5: Verify the configuration
1
2
3
4
|
SW1#show ip interface brief
SW1#show vlan brief
SW1#show ip route
SW1#ping 192.168.20.1
|
Key Points:
- SVI will only be “up/up” if the VLAN exists and has at least one active port
- The switch must support Layer 3 functionality (Layer 3 switch required)
- SVI IP addresses typically serve as default gateways for devices in each VLAN
- Use
ip routing command to enable inter-VLAN routing between SVIs