By clicking or navigating this website site, you agree to allow our collection of information on Scaleway to offer you an optimal user experience and to keep track of statistics through cookies. Learn more about our Cookie Policy.

KVM Hypervisor on Bare Metal

KVM Overview

KVM or Kernel-based Virtual Machine is a complete open source virtualization solution for Linux on x86 hardware. It supports CPUs that come with virtualization extensions (Intel VT or AMD-V).

9 . Start the virtual machine again, after a few seconds the Ubuntu login appears:

virsh start ubuntu1804 --console

Log into the virtual machine and install the required software. The VM has configured its network automatically with DHCP and is able to communicate with the outside world by passing all traffic over the virtual bridge. However it is not possible to receive external connections with on the virtual machine until now.

Forwarding Ports to Guests with IPtables

By default virtual machines, that are connected via a virtual network with <forward mode='nat'/> can make any outgoing connection they want. Incoming connections are possible from the hypervisor host itself and other virtual machines connected to the same virtual network. To be able to make services running on a guest, connected to a virtual network, publicly available on the Internet, a port forwarding is required. This means the host of the guest machine, forwards all requests sent to a specific port of the public IP to the internal IP of the guest to make services running on the virtual machine available for external users. This is done by configuring IPtables rules for each service that shall be exposed on the Internet.

1 . Get the list of available networks, by running the following command:

The interface vibr1 with the subnet 192.168.122.0/24 is the one used in the virtual network. The interface named ens2 is the public Internet interface of the host machine. Notice that this name may differ depending on your hardware and the OS version used.

10 . Access your VM via SSH by running the following command:

ssh user@PUBLIC_IP_HOST_MACHINE -p 5678

Once logged into the virtual machine you can configure additional service like web or email server applications and expose them on the Internet by adding IPtables rules.