VLAN Basics 2_VLAN Layer 2 Communication Principles

Table of contents

1. Introduction to VLAN Layer 2 Communication

2. VLAN Layer 2 communication on the same switch

3. Cross-switch VLAN Layer 2 communication

4. VLAN layer 2 communication experiment

4.1 Basic VLAN configuration commands

4.2 VLAN configuration steps

4.3 VLAN Layer 2 communication experimental results


1. Introduction to VLAN Layer 2 Communication

VLAN is a logical grouping that can divide a physical network port into multiple virtual networks so that different computers can communicate on the same physical network without conflict.

VLAN Layer 2 communication means that after a VLAN is created, devices in the same VLAN can transmit data through Layer 2 communication. In VLAN Layer 2 communication, devices within the same VLAN can use MAC addresses to identify and address other devices, and transmit data from one device to another through the switch.

For communication between different VLANs, Layer 2 forwarding through a router or Layer 3 forwarding is required.

2. VLAN Layer 2 communication on the same switch

①Host A needs to communicate with Host B. Host A only knows the IP address of Host B but not the MAC address of Host B. Host A broadcasts an ARP request to the entire virtual LAN (VID 10) to obtain the MAC address of Host B.

figure 1

② After switch A port 1 (Access) receives the ARP request sent by host A, it adds the default VLAN tag 10 to the ARP request. The ARP request enters the switch, and then switch A records the MAC+VID (10) information of host A to MAC address table.

 Figure 2-2

③Switch A broadcasts the ARP request to the entire virtual LAN (VID 10). All hosts in the virtual LAN (VID 10) will receive the ARP request. When the ARP request passes through port 2 (Access), the VLAN in the ARP request will be removed. Label.

 Figure 2-3

④After port 2 (Access) of switch A receives the ARP response sent by host B, it puts the default VLAN tag 10 on the ARP response. The ARP response enters the switch through port 2 (Access), and then switch A records the MAC of host B. +VID(10) information to MAC address table.

 Figure 2-4

⑤ Switch A checks the MAC address table and finds that the destination MAC address of the ARP response is the MAC address of host A, and host A and host B are in the same virtual LAN (VID 10). The switch unicasts an ARP response to port 1 (Access). Port 1 (Access) removes the VLAN tag and sends it to host A. Host A can communicate with host B after receiving the ARP response.

Figure 2-5

Host A and Host B data communication

Host A sends an IP packet to Host B. After switch A port 1 (Access) receives the IP packet, it adds the default VLAN tag 10 and enters the switch. Switch A queries the MAC address table and finds that the destination MAC address of the IP packet is the host. The MAC address of host B, and host A and host B are in the same virtual LAN (VID 10). Switch A sends IP packets to host B through port 2 (Access). The IP packets pass through port 2 (Access) to remove the VLAN tag. 10.

Please analyze the IP response message communication process by yourself. If you have any questions, send a private message to the blogger or ask in the comment area?

 Figure 2-6

3. Cross-switch VLAN Layer 2 communication

① Host A needs to communicate with host C. Host A only knows the IP address of host C and does not know the MAC address of host C. Host A broadcasts an ARP request to the entire virtual LAN (VID 10) to obtain the MAC address of host C.

 Figure 3-1

② After receiving the ARP request sent by host A, switch A port 1 (Access) adds the default VLAN tag 10 to the ARP request. Then switch A records the MAC+VID (10) information of host A to the MAC address table.

 Figure 3-2

③ Switch A broadcasts an ARP request to the virtual LAN (VID 10). The ARP request passes through the trunk port of switch A. The trunk port allows VID 10 to pass. Switch A retains the VLAN tag in the ARP request and sends it to switch B.

 Figure 3-3

④The trunk port of switch B receives the ARP request packet of VID 10. VID 10 is the VID allowed by the trunk port (retaining the VLAN tag). The ARP request packet enters switch B. Switch B records the MAC+VID (10) of host A to the MAC address table. .

 Figure 3-4

⑤ Switch B broadcasts the ARP request to the entire virtual LAN (VID 10). All hosts in the virtual LAN (VID 10) will receive the ARP request. When the ARP request passes through port 1 (Access), the VLAN in the ARP request will be removed. Label.

Figure 3-5

⑥After the port 1 (Access) of switch B receives the ARP response sent by host C, it adds the default VLAN tag 10 to the ARP response. Then switch B records the MAC+VID (10) information of host C into the MAC address table.

 Figure 3-6

⑦ Switch B queries the MAC table and finds that the MAC address of host A is on the Trunk port, and host A and host C are in the same virtual LAN (VID 10). Switch B sends an ARP response to the Trunk port. The Trunk port allows VID 10 to pass and retains ARP The VLAN tag in the response packet is sent to switch A.

 Figure 3-7

⑧The trunk port of switch A receives the ARP response packet of VID 10. VID 10 is the VID allowed by the trunk port (retaining the VLAN tag). The ARP response packet enters switch A. Switch A records the MAC+VID (10) of host B into the MAC address table. .

Figure 3-8

⑨ Switch A checks the destination MAC address of host C's ARP response and finds out that it is the MAC address of host A. Host A and host C are in the same virtual LAN (VID 10). Switch A unicasts an ARP response to port 1 (Access). Port 1 (Access) removes the VLAN tag and sends it to host A. After receiving the ARP response, host A can communicate with host C.

Figure 3-9

Host A and Host B data communication

Host A sends an IP packet to host C. After switch A port 1 (Access) receives the IP packet, it adds the default VLAN tag 10 and enters the switch. Switch A queries the MAC address table and finds the MAC address and VID of host B. Send IP packets to switch B through the trunk port. After the trunk port of switch B receives the IP packet, it determines that the VID 10 of the IP packet is the VID that the port is allowed to pass through (the VLAN tag of the IP packet is retained), and the IP packet enters the switch. Switch B queries the MAC address table and finds the MAC address of host C. Host A and host C are in the same virtual LAN (VID 10). Switch B sends IP data packets to port 1 (Access), and port 1 (Access) is removed. IP packet VLAN tag, send IP packet to host C.

Please analyze the IP response message communication process by yourself. If you have any questions, send a private message to the blogger or ask in the comment area?

Figure 3-10

4. VLAN layer 2 communication experiment

4.1 Basic VLAN configuration commands

Table 1

4.2 VLAN configuration steps

Step 1: Create VLAN

Step 2: Set port VLAN type

Step 3: Set the port default VLAN

Step 4: Set Port Allow Pass VID List

4.3 VLAN Layer 2 communication experimental results

 Pic 4-1

Complete experiment download address of VLAN Layer 2 communication principle:

https://download.csdn.net/download/weixin_28673511/87928385

Guess you like

Origin blog.csdn.net/weixin_28673511/article/details/131269927