UBUNTU14.04+KVM Configuring virtual machine bridging (bridge)

Source: Internet
Author: User
Tags manual

Host: Ubuntu14.04 64bit
Virtual machine: Ubuntu14.04 64bit
Vmm:kvm

Bridge Bridging Principle Principle

The default network link after KVM installation is Nat, at which point the virtual machine can only communicate with the rest of the virtual machines installed on this computer, and the IP address of the virtual machine is a private address.
Bridge mode is the network connection mode of virtual bridge, and the machines inside the client and subnet can communicate with each other. You can make a virtual machine a host with a separate IP in the network.
A bridged network (also called a physical device share) is used to replicate a physical device to a single virtual machine. A bridge is used as an advanced setting, especially if the host has multiple network interfaces.

As shown above, the basic principle of the bridge is to create a bridging interface br0 that transmits data between the physical NIC and the virtual network interface.

Configuring the Bridging network on the host machine

Note: This step is done on the host computer, and do not mistakenly assume that the virtual machine

First: To stop the network service

Sudo/etc/init.d/networking stop

Second: Modify the network configuration file

sudo gedit/etc/network/interfaces

If you want to set the IP manually, please copy the following code into the edited file, note: IP and other settings to modify as needed.

Auto Lo
Iface Lo inet Loopback
Auto Eth0
Iface eth0 inet Manual
Auto Br0
Iface br0 inet Static
Address 192.168.200.130
Network 192.168.200.0
Netmask 255.255.255.0
Broadcast 192.168.200.255
Gateway 192.168.200.1
Dns-nameservers 8.8.8.8
Bridge_ports eth0
BRIDGE_STP off
BRIDGE_FD 0
Bridge_maxwait 0

If you want to get it automatically from DHCP, copy the code into the edited file.

Auto Lo
Iface Lo inet Loopback
Auto Eth0
Iface eth0 inet Manual
Auto Br0
Iface br0 inet DHCP
Bridge_ports eth0
BRIDGE_STP off
BRIDGE_FD 0

Finally: Restart the network service to

sudo/etc/init.d/networking restart

I am using DHCP mode, the host network after the modification of the situation is approximately as follows:

In the figure above, there is a network called BR0 before the setup, which is used when bridging.

Configure the network for guest virtual machines

The configuration of the host network card is complete, and the virtual machine is set up.

To open the virtual machine controller:

sudo virt-manager

Change the network properties of the virtual machine to: br0
The following figure:

The above steps to set up the KVM bridge problem solved, at this time can look at the virtual machine network IP address, should be with the host's IP address in the same network segment, but there is still a problem, the wireless card bridge is unsuccessful, the default is the wired network card.

Reference documents:

Http://www.linuxidc.com/Linux/2013-01/78115.htm
Http://www.chenyudong.com/archives/libvirt-kvm-bridge-network.html

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.