Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to practice Linux VLAN

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to practice Linux VLAN. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Let's take a look at how to implement and configure the following VLAN network in an experimental environment

Restart the host and ifconfig each network interface

Virtual machines VM1 and VM2 have been created in advance in the host, and are now in a shutdown state.

Start VM1

Confirm through virsh that this is the virtual network card of VM1.

Start VM2

Confirm through virsh that this is the virtual network card of VM2.

Configure IP for VM2

The reasons are as follows: 1. Before VM2 sends Ping packets to VM1, you need to know the MAC address corresponding to VM1's IP 192.168.100.10. VM2 broadcasts ARP packets on the network to ask, "who knows what the MAC address of 192.168.100.10 is?" 2. ARP is a layer 2 protocol. Because of the isolation effect of VLAN, ARP can only be broadcast within the range of VLAN20. Only brvlan20 and eth0.20 can receive it, but not devices in VLAN10. VM1 was unable to answer the ARP packet sent by VM2. 3. VM2 cannot get the MAC address of VM1 vnet0, so Ping cannot get VM1.

Linux Bridge + VLAN = virtual switch

Now make a summary of the network virtualization of KVM.

There are multiple VLAN on the physical switch, and each VLAN has multiple ports. The same VLAN port can be exchanged and forwarded, while different VLAN ports are isolated. Therefore, the switch contains two layers of functions: switching and isolation.

Linux's VLAN device implements the isolation function, but does not have the switching function. A VLAN parent device, such as eth0, cannot have two VLAN subdevices with the same ID, so data exchange is not possible.

Linux Bridge specializes in switching functions. By mounting all the sub-devices of the same VLAN to a Bridge, data can be exchanged between the devices.

To sum up, Linux Bridge plus VLAN completely simulates real-world layer 2 switches at the functional level.

Eth0 is equivalent to the trunk port on the virtual switch, allowing the data of vlan10 and vlan20 to look at the access port of vlan10 through eth0.10,vnet0 and brvlan10. Eth0.20,vnet1 and brvlan20 can both look at the access port of vlan20.

After reading the above, do you have any further understanding of how to practice Linux VLAN? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report