KVM: Hosts with private and public IPs

bridgedhcpkvm-virtualizationnetworking

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.

Best Answer

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