2

following ubuntu guide on kvm, I've a test server up and running at this ip address 192.168.0.210 (netmask 255.255.255.0). The virtual machine (same as host ubuntu 11 server) use dhcp but has a specific ip 192.168.122.99. The host (already in bridge with guest) can access guest but for other nodes it's impossible! I've created a new virtual ip on the host 192.168.0.11 and trying to route all requests made to 192.168.122.99 (guest) to this ip, but it fails. I've followed this guide: https://help.ubuntu.com/community/KVM/Networking (paragraph IP Aliases).

Anyone can help?

Regards, Giacomo

gsscoder
  • 121
  • 1
  • 5

1 Answers1

1

It sounds like you're using one of the 192.168.122.x addresses libvirt assigns by default, when using the NAT mode. This means the VM is running behind a NAT and not on the bridge you've set up.

Check the configuration, and make sure the VM is plugged into the bridge, and not set up to use NAT

dyasny
  • 18,482
  • 6
  • 48
  • 63
  • The VM is accessible from the kvm host, so I think is on the bridge. Right? Anyway I've found a solution, routing packets from aliased net interface (192.168.0.11) to vm guest (192.168.122.99) on SPECIFIC PORT. I used this commands: sudo iptables -t nat -A PREROUTING -p tcp -d 192.168.0.11 --dport 80 -j DNAT --to-destination 192.168.122.99:80 sudo iptables -I FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT Thanks, Regards, Giacomo – gsscoder Oct 14 '11 at 18:23
  • >The VM is accessible from the kvm host, so I think is on the bridge. Right? ....... wrong. The host has an interface inside the NAT, so it can access it. What you've done is port forwarding. This is ok for a couple of VMs, but it does not scale, and definitely doesn't achieve actually putting the VM on the same network (bcast domain) as the host and the rest of the machines in that network – dyasny Oct 14 '11 at 19:20
  • This is what I'm thinking these days... This kind solution can't scale! What's the right way to deploy a virtual network with kvm? How to do to put VM in the same network? Help REALLY appreciated. Can anyone tell me good documentation (books included)? Regards, Giacomo – gsscoder Oct 15 '11 at 07:28
  • I am pretty far from anything ubuntu, however, if you post your VM definition xml file, I might be able to help – dyasny Oct 15 '11 at 08:02
  • In these days we've moved the test server from a place to another, when it will become available I'll post it. Thanks a lot! – gsscoder Nov 09 '11 at 15:04
  • It defintely sounds like you're using the NAT networking. You need to set up a bridge network and assign you VMs real Ip addresses on your physical network. Here are 2 guides to get you started, this ones for [Redhat based distros](http://www.linux-kvm.com/content/using-bridged-networking-virt-manager) and this ones for [Ubuntu](https://help.ubuntu.com/community/KVM/Networking). – slm Dec 11 '11 at 06:55
  • Also this howtoforge article may prove helpful too, [howtoforge kvm on ubuntu 11.10](http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10). – slm Dec 11 '11 at 07:02