Set the network card to bridge mode under CentOS6.3 KVM

Set the network card to bridge mode under CentOS6.3 KVM

The default network mode of KVM is NAT, which means to use the [Host] (https://cloud.tencent.com/product/cdh?from=10680) mode to access the Internet. Now we want to change to the bridge mode so that the outside world can directly communicate with the host
The virtual machine is communicating.

1 , First look at the default network settings

cat /etc/libvirt/qemu/networks/default.xml

< network>
  default
  1f118032-0345-4725-adcf-6b94f6aca19c
 
 
 
 
   
     
   

 

< /network>

2 , Look at the network settings in the virtual machine configuration file

cat /etc/libvirt/qemu/ubuntu10.04.xml

< domain type='kvm'>
  ubuntu10.04
  2eeb1395-39a2-a169-4da3-f22b20a1d34f
  1048576
  1048576
  1
 
    hvm
   
 

 
   
   
   
 

 
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
 
    /usr/libexec/qemu-kvm
   
     
     
     
     


   
   
     
     
     
     

   
   
     

   
   
     

   
It turned out to be interface type='default'
     

It turned out to be source network='default'. The br1 here should be based on your physical network card.