2

We have a small block of static IPs (e.g. 203.0.113.0/29). We currently only use 203.0.113.2 for a mail server.

We'd like to add some other public servers, and if possible would like to have them as VMs under a KVM host, which itself would have a public IP of 203.0.113.1. In addition the KVM host would have to serve as an internet gatweway and DHCP server for several Windows VMs we'd also like to run (which would have private IPs).

Here's a diagram of what I'm hoping for:

enter image description here

I've never setup KVM before. I've read a number of articles on KVM networking, including bridging, DHCP, etc. but I haven't figured out whether this combination is possible or how I would go about doing it?

  • A DHCP server running on the KVM host
  • ...which provides private IPs and internet gateway access to any VMs set to received IPs by DHCP
  • ...but which also supports hosts which have public static IPs configured

How can I setup the KVM host to make this work? Thanks to anyone who can help.

  • 1
    Sure, you can do that. – Michael Hampton Oct 15 '18 at 14:48
  • 1
    Just install kvm and bridge-utils, configure bridges, create new vm with 2 virtual network cards. Links this cards to your bridges on the host machine. Profit. It's a quite easy case and I'm sure too, that you can do it. If you have any problems like "I have install kvm but service don't whant to start" or "I have configured bridge and it doesn't up, my OS is Ubuntu16, here is my configs, here is my error log", I believe you find help here. – Alexander Makarenko Oct 15 '18 at 16:11
  • Thanks, Alexander - I'm think where I'm struggling is that I just don't know how to setup the br0 interface, whether I should be using libvirt/virsh, or frankly just how to get started. There are a number of guides for KVM networking out there, but since I think I'm doing something a bit unusual I suspect that the default configuration assumed by many tutorials will lead me down the wrong path. – David White Oct 18 '18 at 0:17
1

Maybe I misunderstood your requirements. If the VM's are the only living creatures behind the KVM host, only one nic is needed of course. virsh (cli based mgmt client) is included when installing libvirt, along with other virt-xxx tools. So you can manage everything via SSH using these tools, or connect with virt-manager remotely. I dont think that Your setup is very unusual at all. standard "how-to" will fit. The windows VM's will have a nic connected to the default NAT, so they can talk to each other and the KVM host. The other VM's will be attached to the br0 interface. So the internet facing NIC will be attached to the br0, where the external IP address is configured. HOw this is done depends on your distro, but there are guides available for Ubuntu, Centos etc. Check out https://www.thegeekstuff.com/2014/10/linux-kvm-create-guest-vm or https://www.server-world.info/en/note?os=CentOS_7&p=kvm for centos like, or for Ubuntu: https://www.server-world.info/en/note?os=Ubuntu_18.04&p=kvm&f=1

| improve this answer | |
0

I would consider running DHCP in a VM under KVM, just to lower the attack vector from the internet to the KVM host. It much easier to configure the firewall if it doesn't provide any other services than KVM. You need two NICs on the host of course. You don't say why you need to expose the KVM host to the internet using 203.0.113.1, but I would make sure the the iptables/firewalld is configured to drop anything on that IP. The other servers with public IP will have to use their own firewall daemon as well.

| improve this answer | |
  • Regarding why I wanted a public IP on the host, I was assuming that I would need to be able to SSH to the KVM host remotely in order to be able to manage the VMs - bring them down, start them up, etc. – David White Oct 18 '18 at 0:21

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.