1

What's the generally used way to forward traffic from a virtual machine on one of my local hosts to the rest of the house?

I've got a CentOS host at 192.168.1.128 and within that host I have a KVM CentOS guest at 192.168.122.150 running emby-server on port 8096.

I've managed to forward port 8096 to the host by doing:

firewall-cmd --add-port 8096/tcp --zone=public

and I can get the web interface up on the host. Now I want to be able to stream emby media to the rest of my LAN.

1 Answer 1

2

So I got it working by using a bridge instead of the 'default' virtual network that is applied when installing a KVM guest.

A basic kvm guest in CentOS uses a virtual network (named 'default'), which provides NAT from your LAN through to your virtual machines via the virtual host, so what you get is a different subnet for the guest machines compared to the rest of your network.

If you shut your guest(s) down and disable the virtual network you can create a bridge (usually 'br1') in the virt-manager GUI and give it a static IP and gateway. I used my router as the gateway (192.168.1.1) and gave a static IP of 192.168.1.129.

When I booted the guest I had a small problem because I'd forgotten that I'd already given it a static IP, so I edited /etc/sysconfig/network-scripts/ifcfg- and restored my guest VM to dhcp automatic IP.

When I rebooted the guest I had a local IP address given to it by DCHP which was on the same subnet as the rest of my LAN. Then I just forwarded the relevant ports for emby/dlna and I can now stream videos around my LAN from inside the virtual guest.

Tomorrow I will try giving my emby server a static IP and do some further tweaking.

One thing I am left wondering: If I use this method for all of the services on my server in order to make it more secure against malware or hacking, am I losing the added security of a VM by putting each guest on the same network or is it still a more robust way of doing things? That question is a bit off-topic but still an interesting one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .