cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1808
Views
0
Helpful
11
Replies

How do L2 switches route frames between same vlan???

gowdakssujan
Level 1
Level 1

Scenario:

Imagine there are 3 switches s0 s1 s2. S0 is connected to s1 and s1 connected to s2. 

Pc0 is connected to s0 and Pc2 connected to s2. Both pc0 and Pc2 are in vlan 2. Trunk links between switches. Does pc0 and Pc2 communicates????

1 Accepted Solution

Accepted Solutions

Hello,

>> Yes now the pc0 and Pc2 communicates.
Now I will add a switch s1 between s0 and s2. ie., s0 connected to s1 and s1 to s2. Do pc0 and pc1 communicate now?? 

 

Yes if S1 has Vlan2 defined and active in its vlan database and Vlan 2 is allowed and in STP forwarding state on the ports of S1 to S0 and of S1 to S2.

 

if after switch S1 insertion communication is broken check S1 using

show vlan 2

show interface trunk

 

if Vlan 2 is not defined on S1 you need to configure it on S1.

 

 

Hope to help

Giuseppe

 

View solution in original post

11 Replies 11

Martin L
VIP
VIP

 

Pcs must be on the same vlan, and subnet, PCs are in vlan x access ports

Vlan x must be allowed on trunks which usually means vlan x exists in vlan database. 

omz
VIP Alumni
VIP Alumni

Hello 

When you configure a port in access mode, you can specify which VLAN will carry the traffic for that interface. If you do not configure the VLAN for a port in access mode, or an access port, the interface carries traffic for the default VLAN (VLAN1).

Switch1 tags the incoming frame from the pc on vlan 100 and send it across the trunk. Switch4 untags the frame and send it out to the port in vlan 100. 

 

image.png

https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus5000/sw/configuration/guide/cli_rel_4_0_1a/CLIConfigurationGuide/AccessTrunk.html#wp1206599

Hope this helps.

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello gowdakssujan,

L2 switches look at the destination MAC address of the ethernet frame.

 

By listening to user traffic they build for each VLAN a CAM table also called MAC address table that lists what MAC address has been seen and in what port from the point of view of the local switch.

The CAM Entries have a maximum age of 300 seconds.

When a switch receives a frame with an unknown unicast destination MAC address the switch will flood the frame to all the ports in the same Vlan with the exception of the source port.

As soon as the other side answers back a new entry is created in all switches on the path.

 

Being transparent switches the L2 switches cannot change the frame content and they learn by listening to user traffic.

 

As explained in the other post a working end to end link in Vlan 2 is needed via all the involved switches for successful connectivity between the two PCs.

 

The correct term is not routing but forwarding or switching frames. Because routing is performed at OSI layer 3 and switching of frames is performed at OSI layer 2.

 

Hope to help

Giuseppe

 

Can you brief how tagging happens for the scenario I have explained? and
where does frame end up/fails when I try to communicate from PC0 to PC2.

Hello gowdakssujan,

Vlan 2 tagging happens on inter switch links.

For communication to be successful :

all switches S0, S1, S2 need to have Vlan 2 defined and active in their Vlan database

access ports to PCs have to be in vlan 2

interface gi0/5

switchport

swithcport mode access

>>switchport access vlan 2

 

on inter switch links the Vlan 2 has to be allowed and in STP forwarding state.

Check this with

show interface trunk

 

looks for the last section Vlans allowed not pruned and in STP forwarding state and verify vlan2 is included in the list on both sides of each trunk link.

On S2 access port has to be associated to vlan 2 as described above

 

Vlan tagging with Vlan id 2 is performed automatically out of trunk ports that are part of Vlan2.

 

Hint:

verify if there is any firewall running on PCs

check in the shell with arp -g if you see an entry fot the other PC IP address listed as dynamic.

 

Hope to help

Giuseppe

 

omz
VIP Alumni
VIP Alumni

Pc0 is connected to s0 and Pc2 connected to s2. Both pc0 and Pc2 are in vlan 2. Trunk links between switches. Does pc0 and Pc2 communicates????

If VLAN 2 exists on the switches, ports were pcs are connected are configured as access VLAN 2, VLAN 2 is allowed on the trunk and no other blocking/filtering then yes they should communicate.

s0 switch has a access port which belongs vlan 2 and connected to pc0. Similarly, s2 has a access port which belongs to vlan 2 and connected to pc1. The link between s0 and s2 is trunk. Yes now the pc0 and Pc2 communicates.
Now I will add a switch s1 between s0 and s2. ie., s0 connected to s1 and s1 to s2. Do pc0 and pc1 communicate now??

Hello,

>> Yes now the pc0 and Pc2 communicates.
Now I will add a switch s1 between s0 and s2. ie., s0 connected to s1 and s1 to s2. Do pc0 and pc1 communicate now?? 

 

Yes if S1 has Vlan2 defined and active in its vlan database and Vlan 2 is allowed and in STP forwarding state on the ports of S1 to S0 and of S1 to S2.

 

if after switch S1 insertion communication is broken check S1 using

show vlan 2

show interface trunk

 

if Vlan 2 is not defined on S1 you need to configure it on S1.

 

 

Hope to help

Giuseppe

 

Great, it;s working.
But i want to know how tagging changes/happens between those switches.

Hello gowdakssujan,

Vlan tagging occurs when sending a frame out of a trunk port.

Adding an 802.1Q Vlan tag means adding 4 bytes between the end of the 6bytes Source MAC address and the two bytes ethertype. It is inserted in the ethernet header of the frame.

Actually 802.1Q uses its own ethertype 0x8100 the following two bytes provide the following fields:

a 12 bit Vlan id ranging from 0 to 4095 ( vlan 0 has a special meaning, vlan 4095 cannot be used)

a 3 bit CoS field ranging from 000 to 111 binary from 0 to 7 in decimal

a 1 bit Canonical format indicator.

An 802.1Q tagged frame is still an ethernet frame with the same destination and source MAC addresses.

 

We could also see this in a different manner a Vlan-id is associated to its corresponding 802.1Q 4 bytes header.

This Vlan tag is removed when sending a frame out of an access port or if the Vlan is the native Vlan for the trunk.

This Vlan tag is kept when sending out of a trunk port and the Vlan-id is not the native Vlan on the trunk.

 

Hope to help

Giuseppe

 

Hello
After the src/dest ip has been added to the packet created by pc0 nic, A frame header/trailer will be created which will encapsulate this packet, But to obtain this pc0 will need to check the arp table for a cached mac address for PC2 and if there isnt one it will arp broadcast for it on (vlan2)towards the switch its attached to with its own mac- address as source address and with a destination mac-address of FFFF.FFFF.FFFF

The switch will check the layer 2 header and see its a broadcast so floods it out on all ports (vlan 2) other than the port it came in on, However as the trunk is also layer2 it can forward arp broadcast to the other switches and all hosts on vlan 2 by appending a 4 bit vlan tag(vlan2) to the frame so it can cross the trunk.

As Pc2 is on the same vlan it will see this arp request and with its own mac address as source reply's to that arp request.

Now this process is occurring these switches will be logging(caching) pc0 mac address and the port it came in on from the initial arp request and does the same for pc2 from its arp reply, As a result the switches now have knowledge of the source/destination mac address of pc0 and pc2 and will be able tp forward pc0 frames to the correct switch port of PC2.

Once pc2 receives this frame it sees its for itself and removes it, then checks the L3 header again sees for it self and removes that and then processes the data.

The reply from PC2 will be now a quicker process as the src/dest ip mac-addresses have already been learned by both hosts and switches.

 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul