We have VLAN 5 & 6 defined and created on Cisco router. e do have 3560G switch wherein all the VLAN5 and VLAN6 computers will be connected to this switch, therefore is it possible to assign multiple vlan ( like vlan 5 and vlan 6) to one port in cisco switch? Right now, on the switch port if we define switchport trunk allowed vlan 1-10 it doesn't work. Please advice on how to define this on the switch port.
Could you post config of switch and router ?
Are you trying to route vlans 5 & 6 on the router rather than on the 3560 switch.
A port that belongs to multiple VLANs at the same time is by definition a trunk port. In order to be able to differentiate frames into proper VLANs, the frames must be either 802.1Q tagged or ISL encapsulated. That means, among others, that the device that is connected to a trunk port must be also capable of trunking and tagging the individual frames.
A trunk is created using the command
switchport trunk encapsulation dot1q
switchport mode trunk
optionally adding the "switchport trunk allowed vlan" command as you suggested but this command is not necessary for a trunk to work.
However, I would like to ask you about more information about your topology and the intended use of the trunk port. Defining a trunk port may or may not be a solution for what you plan to do. Can you share more information with us?
This option has been tried already and still didn't work. Apparently PC's won't understand when it is configured as trunking. With this option the PC cannot ping to the default gateway of VLAN and therefore doesn't work.
As I said, the VLANs are created on router as int g0/0.5 and g0/0.6 and there is switch wherein all the computers will be connected to this switch.
As Jon has suggested, we need to more in more detail about your network and your needs. Can you please post the configurations of the 3560 and your router?
Also, my question is: the 3560 is capable of routing between VLANs 5 and 6. Why do you need to route them using an external router - or better said, why are the subinterfaces gi0/0.5 and gi0/0.6 created on the router? The information we have from you are very confusing - you talk about PC connected to a trunk port, then about a router with two subinterfaces. It will be very helpful if you describe your network and what you are trying to achieve concisely and completely.
By the way, a PC without a special software can not work on a trunk port. A trunk port is not intended for connecting ordinary PCs.
I understand " A trunk port is not intended for connecting ordinary PCs" and do apologize if there was any confusion. Basically what we are trying to do is, define two networks for one of our project. On the router, two vlans were defined, and this router is connected to the 3560 switch. The solution which I came up was to define few ports on the switch with VLAN5 and other few ports with VLAN 6, and that seem to work. Let me know if there is any alternate solution.
A simpler solution is to use the 3560 to route your vlans ie. on the 3560
int vlan 5
ip address 192.168.5.1 255.255.255.0
int vlan 6
ip address 192.168.6.1 255.255.255.0
then for the clients -
1) clients in vlan 5 should have an IP address from the 192.168.5.x network with their default-gateway of 192.168.5.1
2) clients in vlan 6 an IP address from 192.168.6.x network with their default-gateway of 192.168.6.1
Make sure you enable "ip routing" on the 3560 and there is no need for the router.
Thanks, that eliminates the router, however what else need to be configured on the switch? For e.g if I can connect 192.168.6.x computer on port 6 of the switch, what I need to configure on that port, so that it auto senses the VLAN and routes accordingly.Please advice.
You would need to configure the port as follows
switchport mode access
switchport access vlan 6
this will place that port into vlan 6. So you actually tell the switch which port the vlan is in.
Yes this is what we ended up doing, essentially if it's 48 port as in this case, we have to assign 20 ports for VLAN 5 and 20 ports for VLAN 6, Is there any other way to do this you might know of?
"Is there any other way to do this you might know of?"
You can do dynamic vlan assignment with an ACS server and 802.1x but it's a lot of hassle for one switch.
Don't forget you can use the int range command eg.
3650(config)# int range gi0/1 - 20
3650(config-if-range)# switchport mode access
3560(config-if-range)# switchport access vlan 6
the above will allocate all ports from gi0/1 - 20 into vlan 6.