Debian – routing a second public IP to multiple VM’s

debiankvm-virtualizationlibvirtnetworkingvirtualization

myself and a friend have rented a dedicated server and have used KVM and libvirt to create virtual machines for us to use. (we are using debian jessie on the host)

we purchased two additional IP adresses (one for each of us) giving us three IP adresses total including the original host IP.

the host IP is 195.154.XXX.221 with a gateway of 195.154.XXX.1 and our extra IP's are 212.129.XXX.XXX
on a different subnet with the same gateway.
Our provider has given us mac addresses that have to be used on the device with the additional IP assigned.

we have no trouble assigning the IP's to a single virtual machine, however we do not know how we would have multiple VM's on one IP. A bridge would not work due to the fact all the VM's would need to have the same mac address.

Best Answer

You have to set up DNAT on the Host to forward ports from the outside IP address to the VMs in the private VM network you have set up.

You cannot share the IP on the layer 3.