Scroll To Top

Configure Inter VLAN Routing on Cisco Router and Layer 3 Switches

Posted in Articles, CCNA2 years ago • Written by ShaisNo Comments

A step by step guide to configure Inter VLAN Routing on the Cisco router or layer 3 switches. Basically on a VLAN no host can communicate with hosts within other VLANs. It means only hosts that are members of the same VLAN can communicate with each other. So if you want your VLANs hosts can communicate with each others, you must configure inter VLAN routing using a router or a layer 3 switch. Here we completely demonstrate the Inter-VLAN configuration using a Cisco router and a layer 3 switch.

The router you are using for Inter-VLAN routing must be compatible and support Inter-Switch Link (ISL) which is a Cisco systems proprietary protocol, and IEEE 802.1q frame format for routing on the Fast Ethernet interfaces. In Inter-VLAN the physical Fast Ethernet interface of router is divided into sub-Interfaces for each VLAN. You can set IP address for each sub-Interface in order to route between VLANs.

How to Create VLAN on Cisco Switchs?

Let’s configure it on the below Inter-VLAN routing Lab. Download the Packet Tracer Inter VLAN routing Lab for CCNA or create your own Lab.

1. First of all create two VLAN in the switch and named VLAN A and VLAN B with the following command.

Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#name VLAN-A
Switch(config-vlan)#vlan 3
Switch(config-vlan)#name VLAN-B
Switch(config-vlan)#exit

2. OK, the VLANs A and B are created successfully. Now check them with “show vlan” command.

Inter-VLAN Routing

Configure Inter VLAN Routing

3. You see the result on screenshot, the VLANs are ready for assigning switch ports to them.

Assigning Switch Ports for VLANs

In this section the switch ports are divide and assign to VLANs. Before configure Inter-VLAN routing, a host in a VLAN can only communicate within it’s own VLAN and not reach to other VLANs. So let’s configure it.

1. Try to assign switch ports for each VLANs with the following commands.

Assigning Switch Ports to VLANs

Assigning Switch Ports to VLANs

Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#
Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit

2. Now the port FastEthernet 0/2 and FastEthernet 0/5 are members of VLAN 2 which named VLAN-A. Go to set the PC3 and PC2 to VLAN-B.

3. Let’s assign a rang or ports to a VLAN using “interface range” command.

Switch(config)#interface range fastEthernet 0/3-4
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 3
Switch(config-if-range)#exit

Note: The interface range command can assign a range of interfaces to a VLAN. Read more about basic VLAN configuration on “Configure VLAN on Cisco Switches Using Cisco Packet Tracer” post.

Assign Switch Ports to VLAN

Assign Switch Ports to VLAN

4. Now we have just done the basic VLAN configuration like creating VLAN and assigning switch ports to VLANs. Let’s enable Trunking mode on switch port to router and then configure Inter VLAN routing on router.

Configure Trunking Ports on Switch

With the command “switch port mode trunk” you can configure trunking on the FastEthernet 0/1 port of the SW1. The VLAN Trunking Protocol (VTP) let the VLANs transmit their traffics over a physical line simultaneously. Read more about VTP on wikipedia website.

Configuring Trunk Ports

Configuring Trunk Ports

1. Just navigate to FastEthernet 0/1 interface and type “switchport mode trunk the press enter to enable trunking on Fa0/1 interface line.

Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#

2. Now the VLANs can transmit traffic over the Fastethernet 0/1 without any problems.

Note: Try to enable trunking mode only to interface between to switch or router devices. It’s not necessary to enable it on interface of switch to PC.

Configure Inter VLAN Routing on Cisco Router

Finally the lab is ready to configure Inter VLAN routing. If you test the PCs, they can ping with each other within a VLAN but not with other VLANs. So in order to communicate they need routing. Not network routing protocols such as Static routing or dynamic routing like RIP, and OSPF. Just need Inter-VLAN Routing which you simply configure according to below step by step Inter-VLAN routing guide.

1. Try to assign IP address to router and enable the interface you want to configure inter VLAN routing.

VLAN Routing

VLAN Routing

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 192.168.10.1 255.255.255.248
Router(config-if)#no shutdown

2. Good, the IP 192.168.10.1 with the subnet mask of 255.255.255.248 is assigned for physical Fastethernet 0/0 interface.

Note: We need to have sub interface for each VLANs on router. The sub interface is a virtual interface card that inter VLAN doing routing using them.

3. Now try to create sub-interface for each VLAN with interface command and assign IP address from different network for each VLAN. In this case I have sub-netted the 192.168.10.0/24 IP address to 3 networks.

Router(config)#interface fastEthernet 0/0.2
Router(config-subif)#
Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip address 192.168.10.9 255.255.255.248
Router(config-subif)#

4. See the result with “do show ip interface brief” from sub-interface area.

Create Sub-Interface

Create Sub-Interface

The virtual sub-interface FastEthernet0/0.2 has created and it has the 192.168.10.9 IP address. This sub-interface act as default gateway for VLAN-A with address of 192.168.10.8/29.

5. Do the same to create a sub-interface for VLAN-B also.

Router(config)#interface fastEthernet 0/0.3
Router(config-subif)#ip address 192.168.10.17 255.255.255.248

% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.

Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip address 192.168.10.17 255.255.255.248
Router(config-subif)#

6. Everything is fine, but you see the error with red color! It is because we forgot to set the encapsulation dot1Q command. Before assigning IP address to a sub-interface, you should set IEEE 802.1q with encapsulation command.

Finally all VLANs hosts can communicate with each others. That’s all you need to configure Inter VLAN routing on your corporate network. Download the complete Lab of Inter-VLAN routing Cisco packet Tracer Lab. Follow the below steps if you want to configure inter VLAN on Layer 3 Switches or troubleshooting inter VLAN on routers and switches.

Configure Inter VLAN Using Layer 3 Switches

Work the same, just need a Cisco layer 3 switch. To configure Inter VLAN on a layer 3 switch, you must assign IP address to VLANs instead of sub-interfaces. Assigning IP address to VLAN is easy, only read the “Assigning IP address to VLAN” section at the end of this articles.

To configure Inter VLAN routing using layer 3 switch, you don’t need router any more. All configuration has done within the layer 3 switch.

Troubleshooting and Assigning IP address to VLANs

As this post is related to configure Inter VLAN routing, so we must do some more about VLAN configuration such as assigning IP address to VLANs, controlling VLANs remotely with Telnet, and some essential troubleshooting commands.

How to Assign IP address to VLANs?

In order to assign IP address to a VLAN, simply go to VLAN and set the IP address like assigning IP address to an interface of a router.

Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.10.4 255.255.255.248
Switch(config-if)#no shutdown

Check it with “do show ip interface brief” command, whether the default VLAN 1 has gotten the IP address of 192.168.10.4/29 or not.

Default VLAN 1

Default VLAN 1 – Configure Inter VLAN Routing

Yes, that’s fine. This can help you remotely configure VLANs through the internet or network.

Troubleshooting Inter VLAN Routing

To see the VLANs on a switch, type the “show vlan” command. This command will list all created VLANs within a switch.

The “show interface trunk” command shows encapsulation and trunking statues.

The “show interfaces fastEthernet 0/1 switchport” display the status of a specific switch port. See the result on screenshot.

Encapsulation Status

Configure Inter VLAN routing – Encapsulation Status

OK, I think it’s enough for configuring Inter VLAN routing. I hope you find this configure Inter VLAN routing article’s helpful and if you have any problem or question regarding to this article, ask us through comment section.

Related Search: 

how to configure inter vlan routing on router.
how to configure inter vlan routing in packet tracer.
inter vlan routing configuration on layer 3 switch.
inter vlan routing configuration layer 2 switch.
inter vlan routing configuration example.
inter vlan routing layer 3 switch.
inter vlan routing router on a stick.
inter vlan routing layer 2 switch.
inter vlan routing pdf.
inter vlan routing wiki.
inter vlan routing ppt.
inter vlan routing configuration.
inter vlan routing cisco router.


TAGS: , , ,
About this Author
Shais

I'm a network and Information Security instructor. Here is my online pictorial notebook. I would like to write and share my experience through this website for computer enthusiasts and technology geeks.

Like us on Facebook
on Facebook
Shais

Follow me on Twitter
Follow @technigs on Twitter
Shais
Add me on Google+
on Google+
Shais

Leave A Response