Howto setup KVM guest to be reachable by a dedicated ip from www?

In this case i would like to assign the ip currently on br0:1 to a virtualmachine. The problem i face here is that when i ssh from www into the virtual machine i ssh into my server too.

More precise, how can i manage to have the server (host) on its dedicated ip while using ips that i purchased from my hosting to run the vms i create?

SETUP: Ubuntu 12.04 server, KVM, Convirt


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
        address X.30.152.64
        broadcast X.30.152.255
        gateway X.30.152.1
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off
iface br0:1 inet static
        address X.199.139.224
auto br0:1

EDIT: MOVED FROM https://askubuntu.com/questions/243194/ubuntu-12-04-server-kvm-networking-assign-dedicated-ip-to-guest

  • Assign the IP in the guest, and remove the assignment from the host. – Michael Hampton Jan 14 '13 at 18:42
  • Thx, about to try that. – user150637 Jan 14 '13 at 19:28

A guest VM is a separate machine, and you cannot assing IPs to it on the host, it's like trying to assign an IP to one machine, on another. What you can control is the VM's MACs, so if you want IP autoassignment, you can simply run a DHCP server, with the specified IPs assigned to the MACs you manage and assign to the VMs.

Otherwise, you have to set the IP up in the guest itself, not on the host. As for the bridge alias, don't do that. Think of the bridge as a virtual switch, that it's outside "leg" is the physical eth of the host, and the rest of the ports are connected to the VMs you attach to it

  • Yeah, i remove the br0:1, it was just added while testing arround. However, the ip on br0:1 is intended to end up as dedicated ip for the guest. – user150637 Jan 14 '13 at 19:17
  • Again, you cannot set an IP on a host interface, and expect the VM to have it. This IP will belong to the host, not the guest. A guest IP should be set in the guest, the guest is a separate machine in every relevant sense – dyasny Jan 14 '13 at 19:55

Your Answer

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