OpenWrt x86 VM as gateway/firewall/router


I'm trying to setup a network where I use my PC with OpenWrt x86 VM as a gateway, here's the network topology

What I'm trying to achieve is:

  1. Set OpenWrt x86 VM with single ethernet port as main gateway to provide extra functionality to the network (VPN, Firewall, Portal for guests, etc)
  2. See all the devices connected to the network via OpenWrt

I'm not sure if #2 is possible, but #1 is the main goal here.

I have followed this documentation to setup OpenWrt x86 in Virtualbox.

I also had tried to look some of the use cases from "Router vs switch vs gateway and NAT" to see if there are any that are similar to my case, the closest I found is Poor Man's Bridge, but it doesn't seem to be working to me after configuring it or perhaps I did a mistake(?).

Any advice on how should I set up?

What route or configuration I need to setup to achieve this?

Thanks in advance

That's how I would do this:

Since you want a firewall/router,The OpenWrt vm needs two network interfaces, one for LAN and one for WAN.

Since the only client connected to the OpenWrt LAN interface is the PC, the LAN interface of the OpenWrt VM (the eth2 or lan in the tutorial) should be an additional Host-only Adapter aka a vboxnet1 for Virtualbox. Also when creating vboxnet1 in Virtualbox you DO NOT want this interface to have Virtualbox's own DHCP (the step that says "(optional) you can also set the DHCP server as shown in the screenshot if you want to have dynamic addresses to the VM," ), because the DHCP server will be the OpenWrt VM already, so disable that option

I would set the WAN interface of the OpenWrt VM as a bridged interface, bridged to the PC's network interface that you use to connect to the physical local network of

Then I would assign a static IP to the PC's interface that you use to connect to the physical local network of Leave the gateway and dns fields empty. This way the PC can still see the devices on the local network of, but it won't try to use the Main Router to access the Internet. If you do not want to see or be seen from devices in the network, you can set the static address to something different, like

Now the OpenWrt VM should be able to see and use it as gateway, through the interface you bridged to your PC's physical network adapter.

Your PC will have two virtual adapters, vboxnet0 with the "management" interface from the tutorial, and vboxnet1 which should be the LAN interface of the OpenWrt VM and the way your PC will access the internet, which can be left as dymanic/DHCP.

1 Like

Hi @bobafetthotmail , thanks for the guidance,

I was able to follow through but my PC was not able to access the internet. Could you explain more on the vboxnet1?

Current situation now:
vboxnet0: (MNG) (eth0) (bridged) (Static) ( (No problem ssh/access luci from PC)
vboxnet1: (LAN) (eth1) (DHCP) (No internet access)
Bridged Adapter: (WAN) (eth2) (Static) ( (Internet access/able to update packages)

The properties of Vboxnet1 in Virtualbox is
Network Mask:
DHCP Server: Disabled