< Home

Intra-VLAN Communication

Packets transmitted between users in a VLAN go through three phases:

After VLANs are assigned, broadcast packets are forwarded at Layer 2 in the same VLAN. That is, users in the same VLAN can directly communicate at Layer 2. There are two intra-VLAN communication scenarios depending on whether hosts in the same VLAN connect to the same or multiple switches.

Intra-VLAN Communication Through the Same Switch

As shown in Figure 1, Host_1 and Host_2 connect to the same switch, belong to VLAN 2, and are located on the same network segment. The interfaces connected to Host_1 and Host_2 are access interfaces.

Figure 1 Intra-VLAN communication through the same switch

When Host_1 sends a packet to Host_2, the packet is transmitted as follows (assuming that no forwarding entry exists on the switch):

  1. Host_1 determines that the destination IP address is on the same network segment as its IP address, and therefore broadcasts an ARP Request packet to obtain the MAC address of Host_2. The ARP Request packet carries the all-F destination MAC address and destination IP address of 10.1.1.3 (Host_2's IP address).
  2. When the packet reaches IF_1 on the Switch, the Switch detects that the ARP Request packet is untagged and adds VLAN 2 (PVID of IF_1) to the packet. The Switch then adds the mapping between the source MAC address, VLAN ID, and interface (1-1-1, 2, IF_1) to its MAC address table.
  3. The Switch does not find a MAC address entry matching the destination MAC address and VLAN ID of the ARP Request packet, so it broadcasts the ARP Request packet to all interfaces that allow VLAN 2 (IF_2 in this example) except to the interface that it received the packet on.
  4. Before sending the ARP Request packet, IF_2 on the Switch removes the tag with VLAN 2 from the packet.
  5. Host_2 receives the ARP Request packet and records the mapping between the MAC address and IP address of Host_1 in the ARP table. Then Host_2 compares the destination IP address with its own IP address. If they are the same, Host_2 sends an ARP Reply packet. The ARP Reply packet carries Host_2's MAC address of 2-2-2 and Host_1's IP address of 10.1.1.2 as the destination IP address.
  6. After receiving the ARP Reply packet, IF_2 on the Switch tags the packet with VLAN 2.
  7. The Switch adds the mapping between the source MAC address, VLAN ID, and interface (2-2-2, 2, IF_2) to its MAC address table, and then searches for an entry in its MAC address table based on the destination MAC address and VLAN ID (1-1-1, 2). The entry is found because the mapping has been recorded (see step 5). The Switch forwards the ARP Reply packet to IF_1.
  8. Before forwarding the ARP Reply packet to IF_1, the Switch removes the tag with VLAN 2 from the packet.
  9. Host_1 receives the ARP Reply packet and records the mapping between the MAC address and IP address of Host_2 in the ARP table.

Host_1 and Host_2 have now learned the MAC address of each other. In subsequent communication, they can fill the destination MAC address fields of packets with each other's MAC address.

In the preceding networking, if hosts in the same VLAN are on different network segments, they encapsulate the gateway's MAC address into packets. If the Switch is a Layer 2 switch, hosts cannot communicate. If the Switch is a Layer 3 switch, hosts can communicate through VLANIF interfaces (with primary and secondary IP addresses configured). The principles are similar to those in Inter-VLAN Communication Through the Same Switch, and are not described in detail here.

Intra-VLAN Communication Through Multiple Switches

As shown in Figure 2, Host_1 and Host_2 connect to different switches, belong to VLAN 2, and are located on the same network segment. The switches are connected using a trunk link over which frames can be identified and sent between switches.

Figure 2 Intra-VLAN communication through multiple switches

When Host_1 sends a packet to Host_2, the packet is transmitted as follows (assuming that no forwarding entry exists on Switch_1 and Switch_2):
  1. The first two steps are the same as steps 1 and 2 in Intra-VLAN Communication Through the Same Switch and are not repeated here. After the two steps are complete, Host_1 broadcasts the ARP Request packet to IF_2 on Switch_1.
  2. IF_2 on Switch_1 transparently transmits the ARP Request packet to IF_2 on Switch_2 without removing the tag of the packet (also known as transparent transmission), because the VLAN ID of the packet is different from the PVID of IF_2 on Switch_1.
  3. After receiving the ARP Request packet, IF_2 on Switch_2 determines that VLAN 2 is an allowed VLAN and accepts the packet.
  4. The next four steps are the same as steps 3 to 6 in Intra-VLAN Communication Through the Same Switch and are not repeated here. After these steps are complete, Switch_2 forwards the ARP Reply packet of Host_2 to IF_2. IF_2 on Switch_2 transparently transmits the ARP Reply packet to IF_2 on Switch_1, because IF_2 is a trunk interface and its PVID is different from the VLAN ID of the packet.
  5. After receiving the ARP Reply packet, IF_2 on Switch_1 determines that VLAN 2 is an allowed VLAN and accepts the packet. Subsequent steps are the same as steps 7 to 9 in Intra-VLAN Communication Through the Same Switch and are not repeated here.

In addition to transmitting frames from multiple VLANs, a trunk link can transparently transmit frames.

In the preceding networking, if hosts in the same VLAN are on different network segments and Switch_1 or Switch_2 is a Layer 2 switch, hosts cannot communicate. If Switch_1 or Switch_2 is a Layer 3 switch, hosts can communicate through VLANIF interfaces. The principles are similar to those in Inter-VLAN Communication Through the Same Switch, and are not mentioned here.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >