Configuring VLANs and Inter‑VLAN Routing with a Layer 3 Switch
This guide explains how to set up separate VLANs for technical and sales departments, configure PCs and both layer‑2 and layer‑3 switches, assign IP addresses, and verify inter‑VLAN communication using routing on a layer‑3 switch.
Scenario: a company with technical and sales departments in separate VLANs needs inter‑VLAN communication via a layer‑3 switch.
PC configurations: PC0 (192.168.1.2/24 GW 192.168.1.1), PC1 (192.168.2.2/24 GW 192.168.2.1), PC2 (192.168.1.3/24 GW 192.168.1.1). Tests: ping between PCs.
Layer‑2 switch setup: create VLAN 2 and VLAN 3, assign ports fa0/2 to VLAN 2, fa0/3 to VLAN 3, set fa0/1 as trunk, then display VLAN table.
Layer‑3 switch configuration (commands):
Switch>en Switch#conf t Switch(config)#vlan 2 // new VLAN 2 Switch(config)#vlan 3 // new VLAN 3 Switch(config)#int fa 0/1 // trunk port Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport mode trunk Switch(config)#int fa 0/2 // access port for VLAN 2 Switch(config-if)#switchport access vlan 2 Switch(config)#int fa 0/3 // access port for VLAN 3 Switch(config-if)#switchport access vlan 3 Switch(config)#interface vlan 2 Switch(config-if)#ip address 192.168.1.1 255.255.255.0 Switch(config-if)#no shutdown Switch(config)#interface vlan 3 Switch(config-if)#ip address 192.168.2.1 255.255.255.0 Switch(config-if)#no shutdown Switch#show ip route Switch#show vlanVerification: ping tests from PC0 to PC2 and PC1 confirm successful inter‑VLAN routing.
Note: The layer‑3 switch performs routing between VLANs using SVI (Switched Virtual Interface) with assigned IP addresses, enabling devices in different VLANs to communicate.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.