I have a physical machine running CentOS 6.4 and I will rent a place to run it in a data center. I want to install KVM on that machine to run some virtual machines.

The problem is my physical machine have only one NIC and the data center give me a public IP for that interface. So how should I configure network on the physical machine to make it assign for each vm a private IP that can connect to Internet.

If I create a br0 bridged with eth0 interface and create a vm with option --bridge=br0 then KVM could not assign an IP for the vm so setup can not be done.

Should I use NAT mode? Does KVM have any host-only network like Virtualbox? But the vm still has to connect to outside?

Thank you!


I install the guest network using NAT (--network network:default) and then I only have to port-forwarding from the host.

But if I config br0 bridged with physical eth0 then the guest can not get an IP from boot. So I removed the br0 and it worked.


If you use libvirt, all you need to do is change your VMs to use NAT mode. If you set your VMs to use the br0 bridge that has eth0 enslaved, and use that for your VM, you will not get an IP because your ISP's DHCP server does not have a lease record for your VM's MAC address. Using a bridge is like plugging your Internet uplink into a switch, and then plugging your physical machine and your VM each into the same switch with its own cable.

Libvirt will automatically setup the private NATed network via dnsmasq. You'll have to set that up manually if you aren't using libvirt, but I highly recommend using libvirt.

  • Thanks for your explain. I used to setup a NAT and a private host-only interface for vm in VirtualBox but I've never ever use that on KVM. So each vm will have an IP like 10.0.x.x? Should I connect the vms by those IP. Because on VBox I see all of them are If ok,then I have to manually config iptables to port-forwarding to connect to each vm from outside? – neo0 Nov 7 '13 at 1:58
  • Yes, you will have to manually configure iptables to forward because your ISP is only giving you one public IP. By default KVM uses for NAT, but it works teh same as 10.0.x.x on VBox. – Michael Feb 3 '14 at 23:02

I had your same problem with my hypervisor and I've managed it this way:

I've created a bridge br0 with the ip address:


I've configured eth0 this way:


The interface of each vm is a bridge on br0:

<interface type='bridge'>
  <mac address='YY:YY:YY:YY:YY:YY'/>
  <source bridge='br0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
  • I did bridge mode on my local machine and this type of config worked. But the problem is the Data center only give me a single public IP, there is no DHCP. Then the vm did not get an IP to install. Think I have to use NAT mode. – neo0 Nov 7 '13 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.