howtonetwork

How To Configure InterVlan Routing On Cisco Routers And Switches

VLAN is the concept of using multiple LAN over switches or routers. Each VLAN has it’s own broadcast domain and has different subnet id.  So you can create multiple VLANs and allocate different subnets thus increases the security. I already mentioned that each VLAN has it’s own subnets id so you need a layer 3 device namely router to send packets between these VLANs. This is called inter-VLAN routing, this can be done in three ways. Legacy inter-VLAN routing, the router on a stick and layer 3 switches.

configuring Legacy inter-VLAN routing.

 

As mentioned earlier, the Router is needed to set up the legacy inter-VLAN routing. Especially each plan has separated physical interfaces that connected to the router. So connection mode between router and switch should not be in the trunk. The problem here is the number of VLANs to be depended on the number of physical interfaces on the router. But it can access the full bandwidth of the physical interface. Here we didn’t configure the Router as DHCP server. Let’s see how to configure legacy inter-VLAN routing. if you are a beginner to networking then you can use this book called  CCNA Routing and Switching Complete Study Guide: Exam 100-105, Exam 200-105, Exam 200-125 2nd Edition. This book will help you to pass the CCNA exams easily.
Legacy inter vlan routing

Connection description :-

Fast Ethernet 0/1 is connected to the pc0 which belongs to VLAN 10 using copper straight-through cable and fast Ethernet 0/2 is connected to pc1 which belongs to VLAN 20. Gigabit Ethernet 0/1 and 0/2 are connected to the router’s Gigabit Ethernet 0/0 and 0/1 respectively. VLAN 10 and VLAN 20 belong to network 192.168.1.0, 192.168.2.0 respectively.

Switch configuration.
Firstly we need power on the switch and enable the switch in the ios command line
Switch>en
Switch#config
Now we need to create VLAN 10 and VLAN 20
Switch(config)#vlan 10
Switch(config)#vlan 20

Allocating fast Ethernet 0/1 for VLAN 10 and fast Ethernet 0/2 for VLAN 20.

Switch(config)#interface fastEthernet 0/1

Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/2

Switch(config-if)#switchport access vlan 20

 Allocating fast gigabit ethernet 0/2 for VLAN 10 and gigabit Ethernet 0/1 for VLAN 20. so these interfaces will be in access mode.

Switch(config)#interface gigabitEthernet 0/2

Switch(config-if)#switchport access vlan 10
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#switchport access vlan 20

Router configuration.
Router>en
Assigning IP addresses for interfaces. Here gigabit Ethernet 0/1 belongs to VLAN 10 and gigabit Ethernet 0/0 belongs to VLAN 20.

Router(config)#interface gigabitEthernet 0/1
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown

Router(config)#interface gigabitEthernet 0/0

Router(config-if)#ip address 192.168.2.1 255.255.255.0

Router(config-if)#no shutdown


pc0 configurations.
IP address 192.168.1.2
subnet mask 255.255.255.0
default gateway 192.168.1.1

pc1 configurations.
IP address 192.168.2.2
subnet mask 255.255.255.0
default gateway 192.168.2.1

Configuring Router on a stick.

Router on a stick.

Router>en
creating subinterfaces on gigabit ethernet0/0 according to the number of VLANs and setting up encapsulation protocol type with VLAN id.

Router(config)#interface gigabitEthernet 0/0.10

Router(config-subif)#encapsulation dot1Q 10

Router(config-subif)#ip address 192.168.1.1 255.255.255.0
Router(config)#interface gigabitEthernet 0/0.20

Router(config-subif)#encapsulation dot1Q 20

Router(config-subif)#ip address 192.168.2.1 255.255.255.0
Router(config)#interface gigabitEthernet 0/0.30
Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip address 192.168.3.1 255.255.255.0

no shutdown command should be given to gigabit Ethernet 0/0. so that interface will go up. router’s interfaces are shut down by default because of the security purpose.

Router(config)#interface gigabitEthernet 0/0

Router(config-if)#no shutdown

Switch 1 configuration
Switch>en

Changing these two interfaces to trunk mode
 .

Switch(config)#interface range gigabitethernet 0/1-2
Switch(config-if)#switchport mode trunk

Assigning fast Ethernet 0/1as VLAN 10 and FastEthernet 0/24 as VLAN 20.

Switch(config)#interface fastEthernet 0/1

Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport access vlan 20

Another important thing is VLAN 30 should be created in switch 1 even it doesn’t have any host belong to VLAN 30. Otherwise, the switch will drop the packet.


Switch(config)#vlan 30

Switch 2 configurations

Switch>en

Switch(config)#interface  gigabitethernet 0/2

Switch(config-if)#switchport mode trunk

Switch(config)#interface fastEthernet 0/1

Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport access vlan 20

Switch(config)#interface fastEthernet 0/2

Switch(config-if)#switchport access vlan 30

pc1 configurations.
IP address 192.168.1.2
subnet mask 255.255.255.0

default gateway 192.168.1.1

pc2 configurations.
IP address 192.168.2.2
subnet mask 255.255.255.0

default gateway 192.168.2.1

pc3 configurations.
IP address 192.168.1.3
subnet mask 255.255.255.0

default gateway 192.168.1.1


pc4 configurations.
IP address 192.168.2.3
subnet mask 255.255.255.0

default gateway 192.168.2.1


pc5 configurations.
IP address 192.168.3.2
subnet mask 255.255.255.0

default gateway 192.168.3.1

Configuring inter-VLAN routing with layer 3 switch.

inter vlan routing with layer 3 switch.

layer 3 Switch  configurations
Switch>en
Creating a virtual interface for each VLAN and assigning IP addresses.


Switch(config)#interface vlan 10

Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config)#interface vlan 30

Switch(config-if)#ip address 192.168.3.1 255.255.255.0

Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport access vlan 20
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switchport access vlan 30

enabling IP routing on layer 3 switches. ( IP routing is not enabled in layer 3 switch by default .)
Switch(config-if)#ip routing


pc1 configurations.
IP address 192.168.1.2
subnet mask 255.255.255.0

default gateway 192.168.1.1

pc2 configurations.
IP address 192.168.2.2
subnet mask 255.255.255.0

default gateway 192.168.2.1

pc3 configurations.
IP address 192.168.3.2
subnet mask 255.255.255.0

default gateway 192.168.3.1

Shares:
Show Comments (0)
Leave a Reply

Your email address will not be published. Required fields are marked *