expertise my question is : i take 2 l2 switch(s1 and s2) 2960. s1 port 1 is an vlan 10 and s2 port 1 is an vlan 20 and both switch is connect through access mode via 24 port of s1 and s2, vlan for s1 24 port is 10 and s2 is 20 vlan. while connecting both pc to both port s1 port 1 and s2 port 1 pc is communicate with each other .in different vlan how can they communicate i want to know. whether i change access to trunk mode communication is break . please explain the mechanism of switch in both cases.
Long time since I last revisited my Cisco CCNA books. They have been collecting dust for a few years.
Anyhow: Im having a bit trouble understanding the question, so here comes an example of typical VLAN use. Lets see if this can help you on your way.
A standard LAN is normally just a bunch of computers connected to a switch all belonging to the same subnet. Whenever an IP package is broadcasted to one device in the LAN it is broadcasted to all devices connected to the same switch.
VLAN is a way to separate the devices into different broadcast domains.
I made 3 VLANs in the example above:
VLAN 10: (S1, gi0) VLAN 20: (S1, gi1) + (S2, gi1) VLAN 30: (S2, gi2)
The trunk link
S1 <--> S2 +
S2 <--> Router carries VLAN tagged ip frames.
The router needs 3 subinterfaces on gi0/1:
gi0/1.10: ip address 192.168.10.1 subnet 255.255.255.0 gi0/1.20: ip address 192.168.20.1 subnet 255.255.255.0 gi0/1.30: ip address 192.168.30.1 subnet 255.255.255.0
They are needed because it is the routers job to relay ip packages between the VLANs.
The package trace if Warehouse computer (192.168.10.2) sends an package to Sales (192.168.20.2) would be:
Warehouse -> S1 (gi0) -> S1 (gi3) -> S2 (gi0) -> S2 (gi3) -> Router (gi0/1.10) -> Router (gi0/1.20) -> S2 (gi3) -> S2 (gi0) -> S1 (gi3) -> S1 (gi1) -> Sales
The traceroute would look something like:
1 192.168.10.2 2 192.168.10.1 3 192.168.20.2
Now here comes the thing I found confusing in your question:
It sounded like you wanted to connect a port belonging to VLAN 10 to another switch belongin to VLAN 20.
That would be a bad idea if you ask me, since all devices on both VLANs need to have an IP address on the same subnet making them in essence behave as there are only one VLANs instead of two - and what was the point in making two VLANs then - if one is enough? :-)
Any broadcast message on VLAN 10 is also propegated to VLAN 20 and vice versa via the access port link.
If you top of having a port on VLAN 10 connected to another switch on VLAN 20 and at the same time have a trunk link on between the same two switches on two different port, then you will run into a loop.
If spanning tree protocol is enabled it will simply change one of the access ports to blocked in order to clear the loop.
No packages is forwarded over a blocked port.
Does this give you any hints what is going on?