If you want to route between vlan’s you should configure a trunk port for vlan’s to reach each other. If the switch has a routerprocessor, this would not be necessary. But as, for example a 2950 does not have this, you have to configure a trunk.
On the switch you define a port for the trunk
enable
conf terminal
interface fa0/1
switchport mode trunk
That’s all on the Switch side for the trunk port.
Configuring the vlan’s now.
You should add some ports to themenable
configure terminal
interface range fa0/2 – 4 2
interface range fa0/5 – 6 3
So you have vlan 2 and 3 then and also have added both two ports.
Well let’s go to the router now. Check if cabeling is ok. You need a straight-through cable for the connection from the router to the switchport. Well, when this is done, it’s now the turn for the router.
enable
configure terminal
interface e0/0
no shut
interface e0/0.2
encapsulation dot1Q 2
ip add 192.168.2.1 255.255.255.0
no shutdown
interface e0/0.3
encapsulation dot1Q 3
ip add 192.168.3.1 255.255.255.0
no shutdown
These IP Addresses are now the gateway for the switch. Because for example the 2950 Catalyst Switches do not have a router Processor. You can give a VLAN an IP aderesse, but only for management porposes. The management vlan is a special vlan. You can only give the management vlan an ip address. If you try to give more than one VLAN an ip address, you will find out, that every time you want to enable the vlan with „no shutdown“, one VLAN comes up, while the other will go down. This is not possible to have more than one management vlan up.
This is because the 2950 is only a layer 2 Switch. With the 3550 you can do this, but not with the 2950. So for the 2950 you will alway need a router, or so called „on-stick“ configuration, to route between the vlan’s.
Remember also, frames from the native VLAN are not tagged on a trunk, whereas frames from all other VLAN’s are.
Source:
http://www.cisco.com/univercd/cc/td/doc/product/lan/cat6000/sw_5_2/cofigide/e_trunk.htm