cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3065
Views
9
Helpful
10
Replies

Inter-VLAN routing - Basic concept &setup

markbd111
Level 1
Level 1

Hi,

I've searched on the net and still can't find a clear-cut answer. Could anyone provide a config example of this.

Server A (in VLAN 10) needs to be accessible to PC2 (in VLAN 2), PC3 (in VLAN 3) and PC4 (in VLAN 4).

If I have a 3550 switch, I should be able to accomplish all of this on it, correct? Since it is layer 2 and 3. What if I had a 2950 layer 2 switch? Would that also be possible or would I need a router or something layer 3 to cause the inter-vlan routing. I guess I'm confused because I read that VLAN's operate at layer 2.

Thanks guys.

10 Replies 10

thisisshanky
Level 11
Level 11

Define vlans on 3550..

config t

ip routing

vlan 10

name Server

vlan 2

name PC2

vlan 3

name PC3

vlan 4

name PC4

int vlan 10

ip add x.x.x.x

int vlan 2

ip add x.x.x.x

int vlan 3

ip add x.x.x.x

int vlan 4

ip add x.x.x.x

Set default gateway on each respective PC as the ip address configured on the above vlans. That should take care of routing.

If you have a 2950, you will need an external router.

Here is a link.

http://www.cisco.com/univercd/cc/td/doc/product/lan/cat5000/rel_5_2/layer3/routing.htm#wp38695

Sankar Nair
UC Solutions Architect
Pacific Northwest | CDW
CCIE Collaboration #17135 Emeritus

But how does VLAN 2,3,4 access VLAN 10 and how does VLAN 10 server access 2,3,4? I saw something about using sub-interfaces. Do I have to use sub-interfaces or is there another method I didn't mention?

Another config example would be great too, thanks.

Shanky's config is exactly what you need, but you also have to assign the ports the server, and pc's are connecting to, to the appropriate vlan.

So if ports 1-3 have the PC's and 4 has the server than it would be some thing like this.

ip routing

!

interface fa 0/1

switchport mode access

switchport access vlan 2

!

interface fa 0/2

switchport mode access

switchport access vlan 3

!

interface fa 0/3

switchport mode access

switchport access vlan 4

!

interface fa 0/4

switchport mode access

switchport access vlan 10

!

interface vlan 2

ip add 172.16.2.1 255.255.255.0

no shut

!

interface vlan 3

ip add 172.16.3.1 255.255.255.0

no shut

!

interface vlan 4

ip add 172.16.4.1 255.255.25.0

no shut

!

interface vlan 10

ip add 172.16.10.1 255.255.255.0

no shut

!

Now you assign the PC's and the Server an IP address that falls within the appropriate VLAN interface's IP range. The machines will communicate with each other using plain ip routing. Each PC will send packets to the default gateway (the vlan interface of the vlan you are connetcted to) and than routed to the destination IP/vlan.

For example, you could ping from each PC to the server and vice versa.

Daniel

s.sima
Level 1
Level 1

Assuming you've set your layer-2 vlans up and the interfaces/ports assigned into them, and assumming four (4) class "C" ip address spaces ...

> conf t

int vlan 10

ip address 10.1.1.1 255.255.255.0

...

exit

!

int vlan 2

ip address 10.1.2.1 255.255.255.0

...

exit

int vlan 3

ip address 10.1.3.1 255.255.255.0

...

exit

!

int vlan 4

ip address 10.1.4.1 255.255.255.0

...

exit

!

end

!

Try enabling ip routing on the 3550 and add each vlan to a router protocol such as eigrp in the 3550 switch configuration.

If you have a 2950 switch hanging off of the 3550 switch make the 3550 vlan address the 2950s default gateway.

But: routing doesn't happen automatically. You need to specify where to route. You must specify the vlans that will use routing and what type. IP routing just enables you to be able to do this.

How would you specify the routing from all the PC Vlans to the Server Vlan and back?

Hi Mark,

I see lot of replies going in this chain and creating the confusion so let us clear this and finish this problem.

As Shanky updated on his first post that config will work for you.

Now you have 3550 switch which is a layer 3 switch and will take care of your routing if you configure it for routing. Because you just want your pcs which are in different vlan to talk to each other it is known as inter vlan routing.

Once you create logical interfaces for vlan like interface vlan 1 and interface vlan 2 and so on it will be a layer 3 interface.

Then once you enable "ip routing" command on 3550 switch and you have any pc's to this switch for those vlans or just a trunk to other switch you will see all the logical interfaces as connected interfaces in the routing table.

Because all the logical layer 3 interfaces are on same switch they are directly connected and routing will happen between all the vlans.

Now you will be curious how it will work.

The pc for example in vlan 10 want to talk to server in another vlan say vlan 20 which will be in different subnet will not find server in same subnet and will throw the request to its gateway. Now the request is with 3550 switch and 3550 switch will check its routing table and will see that the server vlan which is vlan 20 is directly connected so it will route the packet to that vlan.

3550 will send an arp request for the server in vlan 20 to which your pc from vlan 10 want to talk to and once the mac address is learned it will reach the server and same way the reply will come back.

You do not need any subinterfaces because 3550 is itself a layer 3 switch will will handle routing between the vlans. If by anychance you do not have 3550 and just have a layer 2 switch then you need external routers like 2600 and all to perform the inter vlan routing.

Check this link will guide you with topology and config how intervlan routing works on 3550 layer 3 switches

http://www.cisco.com/en/US/tech/tk389/tk815/technologies_configuration_example09186a008015f17a.shtml

HTH

Ankur

Hi All,

am studying CCNA, and today I rehashed my knowledge of vlans/stp/etc. If the server has an ISL type card, couldn't that also solve the problem, if the OP doesn't have a router or L3 switch..? Just curious. Cheers.

coolboarderguy...

Thanks Ankur. Your explanation helped a lot and so did the article.

Great job!!!!!! :)