2

enter image description here

In the diagram above, when two PCs belonging to same network like 192.168.1.10 /24 and 192.168.1.20 /24 but to diffrent Vlans, I suppose they cant't communicate each other.

Now, I wonder how both PCs know which VLAN the other PC belongs to?

When frames arrive at the trunk port between the switch and the router, VLAN tagg is inserted into frames, so that the switch and the router can tell which VLAN the frame belongs to.

At the access port, does same thing happen like at the trunk port?

1
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer. – Ron Maupin Dec 31 '20 at 4:50
1

In the diagram above, when two PCs belonging to same network like 192.168.1.10 /24 and 192.168.1.20 /24 but to diffrent Vlans, I suppose they cant't communicate each other.

That is correct.

I wonder how both PCs know which VLAN the other PC belongs to?

They don't. Normal hosts have no knowledge of VLANs.

The switch in between does know as it's configured that way (for layer 2), as is the router (for layer 3). Switches only forward L2 traffic within a VLAN, never across. The whole point of VLANs is to separate hosts from each other.

When PC1 sends a packet to PC2 it uses the router as gateway. The IP packet is addressed for PC2 but the encapsulating frame is addressed for the gateway. The frame travels to the switch untagged, gets tagged for VLAN10 and is forwarded to the router.

The router extracts the packet, decides that it needs to be forwarded out of the subinterface connected to VLAN20, encapsulates it in a frame addressed to PC2, tags it, and sends it towards the switch. The switch decides which port is goes to (based on PC2's MAC address), removes the tag and forwards it to PC2.

When frames arrive at the trunk port between the switch and the router, VLAN tagg is inserted into frames, so that the switch and the router can tell which VLAN the frame belongs to.

A tag is used while the frame is on a trunk. That tag tells the switch (or the router) which VLAN the frame belongs to. The switch only forwards within that VLAN, the router knows which subinterface has been addressed.

The router uses its routing table to decide which subinterface it uses towards the destination IP. Each subinterface is connected to one of the VLANs and the transport frame is tagged for that VLAN.

In the opposite direction, the switch tags each frame according to the ingress port's untagged (native) VLAN.

0

Now, I wonder how both PCs know which VLAN the other PC belongs to?

They don't. Normal hosts have no idea about VLANs.

At the access port, does same thing happen like at the trunk port?

When a packet enters on an access port, the switch will add an appropriate VLAN tag.

When a packet is about to exit on an access port, the switch will remove the VLAN tag, but not before checking that the packet is destined for the correct VLAN. The switch will never forward a packet directly between the two hosts.

In the diagram above, when two PCs belonging to same network like 192.168.1.10 /24 and 192.168.1.20 /24 but to diffrent Vlans, I suppose they cant't communicate each other.

Two hosts on different VLANs can't communicate unless the router forwards the packets between them.

The router may only have one physical interface, but it has two logical interfaces one for each VLAN. This creates a few problems if you want to try and route between two VLANs with the same subnet.

  1. Some routers will outright refuse to configure the same subnet on two different interfaces.
  2. The implicit routes created by configuring the two subnets will be the same, so the router will not know which interface to send packets out on.
  3. The hosts will think the destination is on-link, so they will ARP for the destination address rather than the default gateway.

All of these issues can be worked around with the right router and configuration, whether they should be worked around is quite another matter. I imagine for most network admins answer would be somewhere between "hell no" and "only in exceptional circumstances".

0

Basically different VLANs won't communicate to each other by default . To make them communicate inter-Vlan routing need to be enable .

Different VLANs won't communicate to each other because different Vlan are allocated to different node in switch . Switch won't allow them to talk .Unless any routing is configured on different VLANs . For ensuring this routing between different VLANs inter -Vlan routing need to be configured. "IP routing"

2
  • Different VLANs won't communicate to each other beacuse vlans are configured with Different subnets No. Nodes in different VLANs can't talk to each other directly because the switch doesn't let them. If they are in different subnet then you can put a router in between. – Zac67 Dec 4 '20 at 17:45
  • Thanks for info !! Edited accordinglly – Sagar Uragonda Dec 5 '20 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.