You are on page 1of 3

Networking 2- routing vlan & subnetting reviewer

Here's a basic example of how you might configure routing for two VLANs (VLAN 10 and VLAN 20) on a
layer 3 switch:

192.168.10.0/24 for VLAN 10


192.168.20.0/24 for VLAN 20

DEFAULT GATEWAY:
VLAN 10 – 192.168.10.1
VLAN 20 – 192.168.20.1

Switch(config)# vlan 10
Switch(config-vlan)# name VLAN10
Switch(config-vlan)# exit

Switch(config)# vlan 20
Switch(config-vlan)# name VLAN20
Switch(config-vlan)# exit

Switch(config)# interface vlan 10


Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Switch(config)# interface vlan 20


Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Switch(config)# ip routing

 Two VLANs are created: VLAN 10 and VLAN 20.


 An SVI (Switched Virtual Interface) is created for each VLAN with an IP address assigned to each. These
SVIs act as the default gateways for devices in their respective VLANs.
 IP routing is enabled to allow the switch to route traffic between the VLANs.

To configure routing for VLANs and assign VLANs to interfaces on a layer 3 switch, you'll need to create
VLANs, configure SVIs for inter-VLAN routing, and assign VLANs to switch interfaces.

Switch(config)# vlan 10

pg. 1
Networking 2- routing vlan & subnetting reviewer

Switch(config-vlan)# name VLAN10


Switch(config-vlan)# exit

Switch(config)# vlan 20
Switch(config-vlan)# name VLAN20
Switch(config-vlan)# exit

Switch(config)# interface vlan 10


Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Switch(config)# interface vlan 20


Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Switch(config)# ip routing

Switch(config)# interface gigabitethernet 0/1


Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# exit

Switch(config)# interface gigabitethernet 0/2


Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
Switch(config-if)# exit

In this configuration:
 Two VLANs are created: VLAN 10 and VLAN 20.
 SVIs are configured for each VLAN with IP addresses assigned to each.
 IP routing is enabled to allow the switch to route traffic between the VLANs.
 Interfaces GigabitEthernet0/1 and GigabitEthernet0/2 are assigned to VLAN 10 and VLAN 20,
respectively, using access mode.
 Make sure to replace GigabitEthernet0/1 and GigabitEthernet0/2 with the actual interface names on your
switch.
 With this configuration, devices connected to interface GigabitEthernet0/1 will be part of VLAN 10 and
will communicate using the IP subnet 192.168.10.0/24, while devices connected to interface
GigabitEthernet0/2 will be part of VLAN 20 and will communicate using the IP subnet 192.168.20.0/24.
Inter-VLAN routing will be handled by the switch, allowing communication between devices in different
VLANs.

To configure routing for VLANs, assign VLANs to interfaces, and enable trunking on a layer 3 switch, you'll
need to create VLANs, configure SVIs for inter-VLAN routing, assign VLANs to switch interfaces, and enable
trunking on interfaces connected to other switches or routers.

Switch(config)# vlan 10
Switch(config-vlan)# name VLAN10
Switch(config-vlan)# exit

pg. 2
Networking 2- routing vlan & subnetting reviewer

Switch(config)# vlan 20
Switch(config-vlan)# name VLAN20
Switch(config-vlan)# exit

Switch(config)# interface vlan 10


Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Switch(config)# interface vlan 20


Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Switch(config)# ip routing

Switch(config)# interface gigabitethernet 0/1


Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# exit

Switch(config)# interface gigabitethernet 0/2


Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
Switch(config-if)# exit

Switch(config)# interface gigabitethernet 0/3


Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Switch(config-if)# exit

In this configuration:
 Two VLANs are created: VLAN 10 and VLAN 20.
 SVIs are configured for each VLAN with IP addresses assigned to each for inter-VLAN routing.
 IP routing is enabled to allow the switch to route traffic between the VLANs.
 Interfaces GigabitEthernet0/1 and GigabitEthernet0/2 are assigned to VLAN 10 and VLAN 20,
respectively, using access mode.
 Interface GigabitEthernet0/3 is configured as a trunk port to allow traffic from both VLANs to pass
through.
 Make sure to replace GigabitEthernet0/1, GigabitEthernet0/2, and GigabitEthernet0/3 with the actual
interface names on your switch.
 With this configuration, devices connected to interfaces GigabitEthernet0/1 and GigabitEthernet0/2 will be
part of VLAN 10 and VLAN 20, respectively, and devices connected to interface GigabitEthernet0/3 will
be able to pass traffic from both VLANs. Inter-VLAN routing will be handled by the switch, allowing
communication between devices in different VLANs.

pg. 3

You might also like