OPNSense as Virtual Machine

Started by daven2411, November 09, 2022, 02:36:50 PM

Previous topic - Next topic
I live in the UK and have the 'standard' router issued to me by BT. What I am trying to do is create a VM, on a spare laptop that I have, then put the BT router into 'bridge' mode and forward all traffic to the ip address of my OPNsense VM. The OPNsense VM will then be my router and do the little bit of port forwarding that I currently have. My internal network is 192.168.1.0/24 and my gateway is 192.168.1.254.

You will need two interfaces then. Any if you do have a spare machine, why don't you just install OPNsense on that?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

There is only one network port on my laptop. that is why I am trying to install it on a VM.

And how will you connect it to your network and to the ISP bridge modem, then? You could use VLANs and a VLAN capable switch. E.g. a Unifi Edgerouter-X makes a nice 5 port switch for around 50 euro/dollar/pounds.

Did you check that you can run your laptop with the lid closed, that it won't go to sleep unexpectedly, that it can shut down the display ...

Laptops are not well suited to run services that are supposed to be available 24x7.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Laptop can run perfectly with the lid closed. I was hoping to install OPNsense into a VM in either VirtualBox, Hyper-V or even install Proxmox VE on my laptop and install it in a VM under that. I thought I might be able to create multiple NIC's and give them appropriate IP addresses based on the fact that my current internal LAN is 192.168.1.0/24.

That you can but with one physical nic only on the device, once it is connected to the bridge, there's no nic left to go downstream to your local network. Unless all your devices are only VMs inside the laptop.

https://www.youtube.com/watch?v=rVQFGoUG6II

Can you tell me if the instructions in this video will help me in any way?

It does as a theoretical exercise. If you look at the very beginning, it shows the only physical interface is allocated to wan. The two virtual ones are for "internal". Imagine that was a very beefy server and has 20 virtual machines on it. With that tutorial you have a firewall/router vm and two virtual nics for two independent networks, two vlans to be specific. So all traffic is internal to hypervisor and its guests.
If what you want to to is setup a virtual machine for OPN or any router/firewall OS, you need two physical network interfaces minimum unless you go on a very hackish way splitting cables from an rj45 connector for a 100 mb part but only good for academic purposes.
Forgive the plug but I'll be having a spare APU4 in a couple of weeks if interested.

Thanks for the advice. I have sent you a private message.

As others have said, if you want to use OPNsense as a router / firewall for other devices, you need a dedicated WAN interface. If you're running it on a laptop with only one ethernet port, you could get a USB ethernet interface.

To be honest, a laptop is far from an ideal computer to run a router, unless you are only using it with virtual clients.