KVM Virtual Machine Network configuration bridge mode

Source: Internet
Author: User

Zz:http://www.linuxidc.com/linux/2012-05/61445p2.htm

Summary: Two ways to configure a KVM virtual Machine network: NAT and bridge. The configuration principle and procedure of bridge mode. The bridge approach applies to virtualization of server hosts. problem

After the client installation is complete, you need to set up a network interface for it to communicate with the host network, the client network. In fact, if you want to use network traffic at installation time, you need to set up a client's network connection in advance.

There are two ways to have a KVM client network connection: A user network: A simple way for a virtual machine to access resources on a host, internet, or local network, but not access to clients from a network or other client, which requires significant performance adjustments. Networking Nat Way. Virtual Bridge: This approach is more complex than the user network, but with the client and the Internet set up, communication between the client and the host is easy. Bridge Way.

This article mainly explains the configuration of bridge mode. Bridge Mode principle

Bridge mode is the network connection mode of virtual bridges, and the machines inside the client and subnet can communicate with each other. You can make a virtual machine a host with independent IP on your network.

Bridging networks (also called physical device sharing) are used to replicate a physical device to a virtual machine. The network bridge is used as the advanced setting, especially the host multiple network interfaces.

As pictured above, the basic principle of the bridge is to create a bridging interface Br0, which transmits data between the physical and virtual network interfaces.

the application scope of bridge mode

Server host virtualization.
Network Bridge mode configuration steps

1, edit and modify the network device script file, increase the network Bridge equipment br0

Vi/etc/sysconfig/network-scripts/ifcfg-br0
Device= "Br0"
onboot= "Yes"
Type= "Bridge"
Bootproto=static
ipaddr=10.0.112.39
netmask=255.255.255.0
gateway=10.0.112.1
Defroute=yes

The configuration above configures the virtual NIC to the 10.0.112.* network segment. If you do not need a static address, you can mask the dependencies of the configuration address. Such as:

Device= "Br0"
onboot= "Yes"
Type= "Bridge"
Bootproto=dhcp


2, Edit and modify the network device script file, modify the NIC device eth0

Device= "Eth0"
Nm_controlled= "No"
onboot= "Yes"
Type=ethernet
Bootproto=none
Bridge= "Br0"
Name= "System eth0"
Hwaddr=44:37:e6:4a:62:ad

Nm_controlled This property value, the Redhat company's document must be set to "no" (this value is "yes" to be managed by the service NetworkManager). The NetworkManager service does not support bridging, so it is set to "no". , but actually found no problem setting to Yes. Communication is normal.

3. Restart Network Services

#service Network Restart

4, check Bridge interface

#brctl Show
Bridge name Bridge ID STP enabled interfaces
Br0 8000.4437E64A62AD No eth0


Client Configuration

When the client is installed, be aware that the network will choose to use the Br0 bridging method.

Graphical approach:


Text mode:

Edit the virtual machine configuration file/etc/libvirt/qemu/v1.xml to add the following

<interface type= ' bridge ' >
<mac address= ' 52:54:00:da:c3:dc '/>
<source bridge= ' br0 '/>
<model type= ' Virtio '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' ' slot= ' 0x03 ' ' function= ', ' 0x0 '
</interface>


Verify that the network interface is normal after the virtual machine is started:

# brctl Show
Bridge name     Bridge id                STP enabled     Interfaces
br0              8000.4437e64a62ad       No               eth0
                                                                                   VNET0
NAT-mode impact

The configuration of the bridge mode and the virtual Machine Support module installation of the Virtual Network Bridge interface Virbr0 does not have any relationship, configure the Network bridge mode, you can virbr0 interface (that is, the default virtual network in the NAT mode) deleted.

# Virsh Net-destroy Default
# Virsh Net-undefine Default
# Service LIBVIRTD Restart


Reference: Nat mode

NAT is the default method after KVM installation. It supports the exchange of hosts and virtual machines, while also supporting virtual machines to access the Internet, but does not support outside access to virtual machines.

The configuration and principle of NAT mode see http://www.linuxidc.com/Linux/2012-05/61445.htm

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.