KVM with one host IP and a different subnet for machines

Posted by Jguy on Server Fault See other posts from Server Fault or by Jguy
Published on 2012-08-25T15:02:45Z Indexed on 2012/11/12 23:03 UTC
Read the original article Hit count: 225

Filed under:
|
|

I've already setup a KVM host with proper IP configurations, but my host had me create DHCP and use that to assign the IP's to the machines. I want to see if there's an easier way to do it (or better). Upon my first setting out on this, I didn't find anything that pointed me in the right direction. I'm coming off a fresh install of Debian 6.0 x64, so I have nothing installed. I've logged in, queried for the below information and changed the password from my host set one.

I have a Debian 6.0 x64 system with the following initial network configuration (substituted 255 in place of my real first octave):

# tail /etc/network/interfaces
auto  eth0
iface eth0 inet static
address   255.9.24.80
broadcast 255.9.24.95
netmask   255.255.255.224
gateway   255.9.24.65

# default route to access subnet
up route add -net 255.9.24.64 netmask 255.255.255.224 gw 255.9.24.65 eth0

I have a /29 subnet that I want the virtual machines to use from my host:

IP: 255.46.187.152 /29
Mask: 255.255.255.248
Broadcast: 255.46.187.159

Usable IP addresses: 255.46.187.153 to 255.46.187.158

I like the interface of Cloudmin, so I want to try and use that if I can to administrate my guests.

So, my questions:

How do I set this up on the host system the best so that I can use the additional Subnet IP's on the guests and have them accessible from the internet?

I also need to host a DNS server, which means one of these VM's has to have two IP's assigned to it and accessable from the outside world. How can I do that using Cloudmin? I had a question about this here: Multiple IP addresses assigned to one KVM VM But I just reformatted the entire server and am trying to figure out a better way of doing this.

Machine information:

# ip route show
255.9.24.64/27 via 255.9.24.65 dev eth0
255.9.24.64/27 dev eth0  proto kernel  scope link  src 255.9.24.80
default via 255.9.24.65 dev eth0

brctl is empty

# ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
  valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether c8:60:00:54:b5:d8 brd ff:ff:ff:ff:ff:ff
inet 255.9.24.80/27 brd 255.9.24.95 scope global eth0
inet6 fe80::ca60:ff:fe54:b5d8/64 scope link
  valid_lft forever preferred_lft forever

Thank you for any help you can provide me.

EDIT: I've installed kvm and cloudmin:

aptitude install qemu-kvm libvirt-bin
wget http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-kvm-debian-install.sh
./cloudmin-kvm-debian-install.sh

Rebooted and now my network configuration looks like this:

# device: eth0
iface eth0 inet manual

# default route to access subnet


iface br0 inet static
    address 255.9.24.80
    netmask 255.255.255.224
    broadcast 255.9.24.95
    network 255.9.24.64
    bridge_ports eth0
    gateway 255.9.24.65

I setup in Cloudmin the Start IP as 255.46.187.153 and End IP as 255.46.187.158. The CIDR is 29 and the gateway is 255.46.187.152.

I've installed a guest with ubuntuserver 12.04 x64, which was able to get and retrieve internet resources during installation, but now cannot reach anything nor can it be reached from anything. Its network configuration is:

iface eth0 inet static
 address 255.46.187.153
 netmask 255.255.255.224
 broadcast 255.46.187.159
 gateway 255.46.187.152
 dns-nameservers <host provided nameservers>

And is not able to ping google.com through DNS or direct IP, I can't ping the VM from the outside or the host. any ideas now?

© Server Fault or respective owner

Related posts about debian

Related posts about kvm-virtualization