Ask Your Question

deuscapturus's profile - activity

2016-01-27 14:52:40 -0500 answered a question How to port-forwarding requests coming into a kVM host (say, kvmHost) to one of its guests (say, kvmGuest01) ...

Setup libvirt virtual network:

Create a new virtual network. Set network mode as "route" (not NAT) on the external network interface of the virtual host.

Example virtual network config in xml: (see 'virsh help network' or use the Virtual Machine Manager GUI).

<network connections='1'> <name>network1</name> <forward dev='enp6s0' mode='route'> <interface dev='enp6s0'/> </forward> <bridge name='virbr1' stp='on' delay='0'/> <ip address='192.168.201.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.201.128' end='192.168.201.254'/> </dhcp> </ip> </network>

Change your virtual guests NIC to this new virtual network.

Setup Port-forward

Setup port forward rules with firewalld on the Virtual Host with 'toaddr' set to the Virtual Guest

firewall-cmd --add-masquerade
firewall-cmd --add-forward-port=port=8888:proto=tcp:toport=8888:toaddr=192.168.122.180

Results

You should now be able to hit the guest port 8888 from the virtual host 192.168.0.15