Friday, May 8, 2020

Best way to give a host internet access through a kvm virtual machine.

Hi guys. I have an intel router with linux debian installed and 6 gigabit interfaces.

I configured a anonymous bridge (wanbr) and attached one interface to it to act as a WAN port. I also configured another anonymous bridge (lanbr) and attached 4 interfaces to it to act as a LAN switch. Then I instantiated a opnsense VM and connected it to that two bridges. The VM worked as expected. So far so good.

I left one interface for the host, configured with a dhcp server to give me access to the bare metal if something happens to the VM. Now I would like to configure on the host a default route to get internet through the VM. By doing that I will get connectivity and packet filtering for the host and for the device connected to that interface.

Problem is that, as the LAN bridge is configured as anonymous (L2) to give the VM the possibility to change subnet addressing without having to change anything on the host system, I am unable to add a default route without specifying the gateway.

What would be the best solution for this scenario? What do you think?

``` WANBR |- eth0 |- vnet0 (opnsense)

LANBR |- eth1 |- eth2 |- eth3 |- eth4 |- vnet1 (opnsense)

eth5 (dhcp-server) ```



No comments:

Post a Comment