Here I will configure a KVM host with virtual machines to be accessible from a local network.
This can be achieved in two ways by configure on KVM host machine:
- A network bridge
- Configure iptables as a router, which will forward traffic to virtual machines.
The easiest way is to use a network bridge, since then both desktop and virtual machines will be on the same subnet.
Here we will configure the KVM host machine network configuration, manually, so we start by disable the NetworkManager
KVM Host Network Bridge Configuration
Above we have disabled NetworkManager (NM_CONTROLLED=no) and is using a Bridge.
Above have we configured a static IP (BOOTPROTO=none) and assigned IP, Gateway and DNS.
KVM Host iptables
Since we are not using the second alternative with routing, the KVM host machines iptables configuration is the same as default.
After editing/creating files you might need to restore SELinux security contexts.
And finally restart network on KVM host
Virtual Macines Network Configuration
The last part is to configure the virtual machine network. This is easiest achieved with the virt-manager.
For an existing virtual machine.
And for a new.
Inside the Virtual Machine
Inside the virtual machine you can configure either a static IP or a dynamic one. The easiest way is to use the tool system-config-network-tui.
And finally test to ping the virtual machine (virtual1) from the desktop.