Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

IP: /29

Usable IP addresses: to

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 via dev eth0 dev eth0  proto kernel  scope link  src
default via 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 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 brd 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

Rebooted and now my network configuration looks like this:

# device: eth0
iface eth0 inet manual

# default route to access subnet

iface br0 inet static
    bridge_ports eth0

I setup in Cloudmin the Start IP as and End IP as The CIDR is 29 and the gateway is

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
 dns-nameservers <host provided nameservers>

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

share|improve this question
up vote 1 down vote accepted

The gateway configured on guest is not an IP of the host machine, I would try this config on guest:

auto eth0
iface eth0 inet static
       dns-nameservers <host provided nameservers>
       up ip addr add dev eth0

also on host, make sure to add the route to to guest, add this to /etc/network/interfaces

iface eth0 inet static
       up route add -host dev br0
       up route add -host dev br0

this way you can use network and broadcast addresses for guests ( and

some resources, sorry not in english: (catalan) (german)

share|improve this answer
I remember trying this configuration (hetzner is actually my host) a while ago, and it did not work. I just re-tried it, paying attention to all configs and it still does not work. – Jguy Aug 26 '12 at 0:02
I originally followed this guide: and it worked. The only limitation is the fact that I need to assign up to 4 IP's (I think godaddy requires 4) to register my own nameserver. I cant seem to do that with that configuration. – Jguy Aug 26 '12 at 0:07
I am at hetzner too, and I followed the two guides, both are working but first is simpler (the easy way one) – tictacbum Aug 26 '12 at 9:14
I edited answer to configure additional IP on guest – tictacbum Aug 26 '12 at 9:27
@JohnMish As an aside, your domain's nameservers should not be on the same host, or even in the same data center. That defeats the whole purpose of redundancy and high availability. – Michael Hampton Aug 26 '12 at 9:46

If the VM aren't on the same network as the host, then you may need to set up the host as a router for the VMs:

iptables --table nat --append POSTROUTING --out-interface br0 -j MASQUERADE
iptables --append FORWARD --in-interface br0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

Edit: Sorry for the "MASQUERADE", I simply copy-pasted a script I had lying around. In your case, you don't need it. But it can be useful in a different case, for instance when you want to give your VMs privates IPs.

share|improve this answer
What's the MASQUERADE business for? He doesn't seem to be using NAT. – Michael Hampton Aug 25 '12 at 20:51
Indeed. No NAT here. – Jguy Aug 26 '12 at 0:01
Blah. Can't +1 your answer. I had forgot the ip_forwarding. Thanks for pointing it out! – Jguy Aug 27 '12 at 2:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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