I have a KVM server and two VMs. I have one main IP and two additional "single" IPs (not a subnet). I don't want have a local network with private addresses on my KVM, but I want to assign my public IPs from the provider (which I bought) to the VMs and I want to manage the routing of those IPs on the KVM Host, not on the provider side (so, no just bridging from the provider, but maybe bridging from my host to the VMs)

All the tutorials I found in the Internet are a bit confusing, because they are all different solving the same problem (but still doesn't work for me).


will this work?

auto  eth0
iface eth0 inet manual

auto vmbr0
iface vmbr0 inet static
  address 176.x.y.133 (not
  netmask (not
  gateway 176.x.y.129 (Provider's GW IP)
  bridge_ports eth0
  bridge_stp off
  bridge_fd 0

Your setup doesn't really have anything to do with public IPs - your underlying problem is that you need to use a bridged network instead of a NATted or host-only bridge.

Put something like the following into /etc/network/interfaces:

iface eth0 inet manual
iface br0 inet static
    bridge_ports eth0
    bridge_stp no
    bridge_fd 0
    bridge_maxwait 0
    dns-search example.com

Reconfiguring of course for your particular setup.

Then configure your VM to bridge to br0 and it'll behave as though it's directly connected to the cable coming in to eth0.

i.e. your guest VM will look like:

<interface type='bridge'>
  <mac address='52:54:de:ad:be:ef'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
  • 192.168.x.x are private. Does it mean I create a new local network or it doesn't matter if I will set it to 176.x.y.z/27 where it is an IP I got from the provider? "...configure your VM to bridge to br0..." - just configuring the ip to one of my public IPs and GW to the br0's IP? Are any static routes needed to add with pre-up/post-down? – static Jul 15 '13 at 16:47
  • You're thinking about it wrong. In the file above, replace the network info with the address for your KVM host. Then in your guest, just give them the appropriate IPs that would work if directly connected to the cable on eth0. – MikeyB Jul 15 '13 at 17:14
  • What's really going on here is that you're configuring a switch (bridge==switch). Plug eth0 into the switch, then plug your KVM host and the VMs into the switch. – MikeyB Jul 15 '13 at 17:17
  • "file above": /etc/network/interfaces ? like in the Update to the question? Does it look like this?: #1# (KVM-Host)(eth0) -> (vmbr0) -> (Provider GW iface) ## #2# (KVM-VM)(eth0) -> (KVM-Host)(vmbr0) -> (Provider GW iface) ## – static Jul 15 '13 at 17:27
  • And now I have confusion: MAC-Addresses of eth0 and vmbr0 (on KVM-Host) are the same [serverfault.com/questions/523454/… – static Jul 15 '13 at 17:32

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.