Hands-on Linux VLAN-5 minutes a day to play with OpenStack (13)

Source: Internet
Author: User


In this section we look at how to implement and configure the following VLAN networks in an experimental environment

Configure VLANs

Edit/etc/network/interfaces, configure eth0.10, Brvlan10, eth0.20, and Brvlan20.

The following shows the modification of/etc/network/interfaces with Vmdiff.

Restart host, ifconfig each network interface

Use Brctl Show to view the configuration of the current Linux Bridge. Eth0.10 and eth0.20 were hung on brvlan10 and Brvlan20.

VM VM1 and VM2 have been created in the host in advance and are now in a shutdown state

Configure VM1

In Virt-manager, hang the VM1 virtual NIC on the BRVLAN10.

Start VM1

View Bridge and discover that BRVLAN10 is connected to a VNET0 device

Confirm with Virsh that this is the VM1 virtual network card.

Configure VM2

Similarly, hang the VM2 NIC on the Brvlan20

Start VM2

View Bridge and discover that Brvlan20 is connected to a VNET1 device

Confirm with Virsh that this is the VM2 virtual network card.

Verifying the isolation of VLANs

To verify the isolation between VLAN10 and VLAN20, we configured the IP for the same network segment for VM1 and VM2.

Configure IP for VM1

Configure IP for VM2

Ping test results: VM1 and VM2 are not.

The reasons are as follows: 1. VM2 before you Ping the package to VM1, you need to know the MAC address of the VM1 IP 192.168.100.10. VM2 will broadcast ARP packets on the network, and its role is to ask "who knows what the 192.168.100.10 MAC address is?" "2.ARP is a two-layer protocol, the isolation of VLANs so that ARP can only be broadcast within the VLAN20 range, only Brvlan20 and eth0.20 can receive, VLAN10 equipment is not received. VM1 cannot answer ARP packets emitted by VM2. 3.VM2 can not get VM1 vnet0 MAC address, also Ping not to VM1.

Linux Bridge + VLAN = Virtual Switch

Now a summary of KVM network virtualization.

  1. The physical switch has multiple VLANs, and each VLAN has multiple ports. The same VLAN port can be exchanged for forwarding between different VLAN ports isolated. So the switch has two layers of functionality: switching and isolation .

  2. The VLAN device of Linux implements the isolation function, but does not have the Exchange function. A VLAN parent device (such as eth0) cannot have two VLAN sub-devices of the same ID, so there is no possibility of data exchange.

  3. Linux Bridge is designed for switching functions. The sub-devices of the same VLAN are mounted on a Bridge, and data can be exchanged between devices.

In summary, Linux Bridge plus VLAN emulates the real-world two-layer switch at the functional level.

The eth0 is equivalent to the trunk port on the virtual switch, allowing VLAN10 and vlan20 data to be viewed through eth0.10,vent0 and Brvlan10 both VLAN10 and eth0.20,vent1 access ports You can look at the access port of Vlan20.

Hands-on Linux VLAN-5 minutes a day to play with OpenStack (13)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.