If i have a VLAN (say VLAN 10) on switch 1 and again a VLAN 10 on switch 2. Can the hosts on these VLANS communicate with each other?
Cisco VLAN – Communication Between VLANs on Different Switches
ciscoswitchingswitchportvlan
Related Solutions
A VLAN is a broadcast domain. Broadcasts and unknown unicasts are flooded to every port in a broadcast domain. Broadcasts received by a host interrupt the host and must be processed, even if the receiving host has no interest in the content of the broadcast, it must still process it to determine that.
VLANs can be used to reduce the size of the broadcast domain. By using two VLANs (20 and 30), you can restrict the broadcasts in one VLAN from being sent to hosts in the other VLAN.
If the second switch has no ports in VLAN 20, why would you even want to send broadcasts and unknown unicasts for VLAN 20 to that switch? You can restrict what goes across the trunk to only VLAN 30 traffic, thereby reducing the traffic on the trunk.
A MAC address is only relevant within the VLAN where the host with that MAC address is a member. The frames traveling on the trunks are tagged (or not tagged for a native VLAN) with the VLAN tag, and those frames will only be sent across a trunk which allows the VLAN in the tag. Frames are only delivered to the interface where the MAC address is connected, unless the switch doesn't know that and delivers it to all the interfaces in the VLAN, and a trunk interface will be one of those if the trunk allows that VLAN.
A switch will learn which interface a particular MAC address is, over time, and will only send frames with a destination MAC address to that interface. The switch MAC address table eventually times out a MAC address when it isn't used for a while. If the switch doesn't have a destination MAC address in its table, it will flood the frame to every interface in that VLAN.
Two separate VLANs must communicate through a layer-3 device, like a router.
Devices on a VLAN communicate with each other using layer-2. Layer-3 must be used to communicate between separate layer-2 domains.
Assuming the most common communications (layer-2 is ethernet and layer-3 is IP), when a host on a VLAN wants to communicate with another host on the same VLAN, it discovers the other hosts layer-2 (e.g. MAC) address with something like ARP, and it sends the frame to the MAC address.
When a host on one VLAN wants to send something to a host on another VLAN, it must use a layer-3 (e.g. IP) address. The host will use layer-2 to send the frames to its defined gateway (router). The router will strip off the layer-2 frame and inspect the layer-3 packet for the destination layer-3 address. The router will then look up the next hop for the layer-3 address. It will then create a new layer-2 frame for the layer-3 packet based on the layer-2 LAN on the interface where it needs to send the packet for the next hop. Other routers which may be in the path to the end LAN will repeat this process until the frame is placed on the final VLAN, where the receiving host gets the frame.
You should search for the OSI model and learn how it works. Just remember that it is a model, and some things in the real world don't necessarily work exactly like the model would predict, but it will give you a gross understanding of how data travel from an application on one host to an application on another host.
Best Answer
Yes, assuming the switches are connected together and VLAN 10 is forwarding on the connected ports. Both ports have to be configured the same, so that VLAN 10 is either tagged on both or untagged (native) on both.