4

I am having trouble when I am using two Layer 3 switches and two PCs to create a simple network for Inter Vlan routing,

First of all have a look at this network,

The configuration for PC1 is,

IP: 192.168.10.1
Default Gateway: 192.168.10.254
Subnet: 255.255.255.0

Similarly for PC2,

IP: 192.168.20.1
Default Gateway: 192.168.20.254
Subnet: 255.255.255.0

enter image description here

Now for the left Switch, I set the Fa0/1 to trunk mode, and enabled created a Vlan 10 and moved the Pc1 to that Vlan,

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

Switch(config)#interface vlan 10


Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#exit

Switch(config)#ip routing

Switch(config)#interface fastEthernet 0/24

Switch(config-if)#switchport mode access 

Switch(config-if)#switchport access vlan 10


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

Switch(config-if)#switchport mode trunk 

and Similarly, I have done the following configuration for the right switch,

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

Switch(config)#interface vlan 20

Switch(config-if)#ip address 192.168.20.254 255.255.255.0
Switch(config-if)#exit

Switch(config)#ip routing 
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport trunk encapsulation dot1q 
Switch(config-if)#switchport mode trunk 
Switch(config-if)#exit


Switch(config)#interface fastEthernet 0/24

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

I have tried so many things. before i was not enable ip routing but even after using ip routing command i couldn't be able to ping PC1 from PC2

I have correctly set the trunk port also, then what is the issue ?

7

To allow VLAN routing four things are neccessary:

  • The VLANs you want to route must exist on all switches.
  • The VLANs must be allowed on the trunk between the switches.
  • Interface IPs for each VLAN must be assigned.
  • IP routing enabled.

In your case you need to add the following lines to your config:

Switch7:

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

Switch8:

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

It is not neccessary to have the same names of the VLANs on both switches but it's a good practice to keep in consistent.

To verify that the VLANs are created on both switches you can issue the following command from Privileged EXEC:

Switch#show vlan brief

and it should list both VLAN 10 and VLAN 20.

Regarding the other condition it should be said that the default is to allow all vlans on the trunk, but to verify that it is indeed allowed you can issue the command:

Switch#show interfaces fastEthernet 0/1 trunk

and you should see vlan 10 and 20 listed under "Vlans allowed and active in management domain" aswell as "Vlans in spanning tree forwarding state and not pruned". If it is not listed under the latter one you need to check your spanning-tree configuration but that should not be a problem in this case.

  • @generalnetworkerror: Thanks for completing my answer. I only thought to point out the things he hadn't done but this is much better. – Jimmy Apr 19 '15 at 21:23
3

You are missing routing between the two switches. There are two ways to fix this. Either move both vlan interfaces to the same switch and use second switch purely as layer 2 device (similar to what @Solitarium suggested) or create another vlan interface that routes between two switches and configure static routes. Something like this (in addition to current config):

switch 7:

vlan 30
 name interswitch
!
interface vlan 30
 ip address 192.168.30.1 255.255.255.252
!
ip route 192.168.20.0 255.255.255.0 192.168.30.2
!

switch 8:

vlan 30
 name interswitch
!
interface vlan 30
 ip address 192.168.30.2 255.255.255.252
!
ip route 192.168.10.0 255.255.255.0 192.168.30.1
!

Last thing - you need to ensure vlan 30 is trunked between two switches. In your above config trunk allowed all vlans (default trunk behavior). I would personally limit this (since you no longer need to trunk other two vlans anyway), so I would do this:

switch 7:

interface Fa0/1
 switchport trunk allowed vlan 30

switch 8:

interface Fa0/1
 switchport trunk allowed vlan 30

Now you should be able to route between two PCs.

Enjoy!

2

Im not sure... but... the Switch need to know all VLAN's to routing between VLAN's.

with

show vlan

you can check if the switch has all VLAN's.

2

Set one of your routers as the core router and define both interface vlans there. That way, your fib has all ip/Mac entries

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.