<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>may the odds be ever in your favour — LowEndSpirit</title>
        <link>https://dev.lowendspirit.com/</link>
        <pubDate>Fri, 24 Jul 2026 06:18:26 +0000</pubDate>
        <language>en</language>
            <description>may the odds be ever in your favour — LowEndSpirit</description>
    <atom:link href="https://dev.lowendspirit.com/discussions/tagged/may-the-odds-be-ever-in-your-favour/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>How-to virtualize opnsense on proxmox</title>
        <link>https://dev.lowendspirit.com/discussion/6682/how-to-virtualize-opnsense-on-proxmox</link>
        <pubDate>Sat, 28 Oct 2023 19:22:43 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>havoc</dc:creator>
        <guid isPermaLink="false">6682@/discussions</guid>
        <description><![CDATA[<p>Busy re-doing my firewall setup &amp; taking notes. Thought I'd turn that into a mini-tutorial, noting that pieces may be a little <a rel="nofollow" href="https://www.reddit.com/r/funny/comments/eccj2/how_to_draw_an_owl/">rest of the fkin owl</a>. If you spot a gap...ask and I'll fill it in.</p>

<p><strong>Why</strong></p>

<p>The gear I've got for firewall is stupidly overkill (optane drive &amp; 16GB RAM) for something that is 99% idle so I want to stick a couple other things on the same hardware via proxmox.</p>

<p><strong>Assumed knowledge and requirements</strong></p>

<p>Proxmox, linux cli, basic networking, (very basic) firewall knowledge. Nothing here is super hardcore technically as such...just unforgiving in sequence &amp; details if unfamiliar hence notes. i.e. when it doesn't work it's not obvious where you fkd up.</p>

<p>Bring backups &amp; loads of time. Frankly...assume that you'll fu.ck this up if you haven't done this before. So this is a Saturday morning project not a Sunday night one.</p>

<p>Before you start set up a ventoy USB stick adding both proxmox and opnsense ISO on there (plus perhaps a PDF copy of this post). You may not have internet access while doing this so come prepared...</p>

<p>I'm using my own IP ranges etc in post - adjust as needed. Key pieces you need to know to follow my descriptions:</p>

<p>vmbr0 is LAN side<br />
vmbr1 is WAN (internet) side. (Proxmox sticks VMs on 0 by default so you want LAN side being 0)<br />
10.32.0.1 is the opnsense VM [LAN side], 10.31.0.5 is WAN side but that doesn't really matter key part is <em>31</em> makes it separate from our main <em>32</em> LAN<br />
10.32.0.2 is the LAN side IP of proxmox<br />
My device has 5 ports with enp2s0 being internet facing [aka vmbr1], rest of the NICs are bridge to vmbr0<br />
The key networking file on proxmox is at /etc/network/interfaces</p>

<p>Assumes upstream ISP is Eth based and just DHCPs whatever is connected. If you've got something else on ISP side you're on your own (sorry)</p>

<p><strong>Virtualized FW</strong></p>

<p>There are two basic ways to do this. Either pass through the NICs to the FW VM, or do two sets of bridges with one being WAN (internet) side and one LAN side. Passthrough is tricky to get working on a basic linux/bios/hardware level but solves some security issues. I'm doing the bridge approach because my gear (oddly) doesn't seem to support pass through. This guide is bridge only...so abandon ship now if you're going passthrough.</p>

<p>Bridge has one significant security implication. Proxmox gets the external traffic and bridges it to the firewall VM. Grand. Except Proxmox is fond of serving the proxmox management interface on ALL interfaces. So it's serving the damn management GUI before anything gets to our FW. Meaning it is potentially exposed BEFORE our fancy opnsense security gets to it. That's a problem we're trying to get around with below section on messing with the Proxmox firewall...despite setting up a opnsense firewall. [In reality the WAN side has a pvt non-routable IP so should be fine even without rules but I don't 100% trust that]</p>

<p>Keep this in mind when doing say incoming wireguard...you're effectively double-firewalled...and would need to pass through wireguard on both.</p>

<p><strong>Security</strong></p>

<p>The bulk of this guide happens BEFORE anything is connected to the internet, mostly because above "I don't trust this" issue. Just the FW device and a laptop directly connected to it.</p>

<p><strong>GO</strong></p>

<p><strong>Step 1</strong>: Install proxmox &amp; ensure you can access the GUI</p>

<p>On the network section do:<br />
IP 10.32.0.2<br />
Gateway 10.32.0.1<br />
Set DNS to 1.1.1.1<br />
Select a NIC that is LAN side (enp7s0 for me) - this should be whatever your laptop is plug in to</p>

<p>The proxmox interface is on <a href="https://10.32.0.2:8006" rel="nofollow">https://10.32.0.2:8006</a></p>

<p><strong>Step 2</strong>: Set up a second bridge in /etc/network/interfaces with WAN</p>

<pre><code>auto vmbr1
iface vmbr1 inet static
        address 10.31.0.5/24
        bridge-ports enp2s0
        bridge-stp off
        bridge-fd 0

iface enp2s0 inet manual
</code></pre>

<p>Note how it is set to a static unroutable IP despite us aiming for DHCP upstream ISP side. That's because we want the firewall VM to grab the DHCP from ISP, not the proxmox level interface.</p>

<p>Restart to make the 2nd bridge show in GUI.</p>

<p><strong>Step 3</strong>: Set up a opnsense VM</p>

<p>Copy over ISO off USB stick like so:</p>

<pre><code>mkdir /media/usbstick
fdisk -l  [[[to get the /dev/ location for the stick]]]
mount /dev/sda1 /media/usbstick
cp /media/usbstick/OPNSense.sio /var/lib/vz/template/iso/
</code></pre>

<p>If the iso is in that location then proxmox GUI should pick it up.</p>

<p>Set up a VM that has 12GB, 5120mb RAM and 3 cores. Going lower on space &amp; ram works but has consequences downstream on how zfs plays out so if you can do 12 &amp; 5 or more.</p>

<p>Before starting VM add the second bridge (vmbr1). Ideally add the LAN side during VM creation so that the naming 0 &amp; 1 line up consistently. Memorize the MACs on both (sorta...just which is which).</p>

<p><strong>Step 4</strong>: Install opnsense</p>

<p>Where it asks you for a login, use installer as user and opnsense as password</p>

<p>Key point here is you need to line up what opnsense thinks is LAN side and WAN side...with the right MAC per above...which in turn maps to the right bridge...which in turn maps to a physical port.</p>

<p>Finish install, change root pass &amp; unmount the ISO. Reboot.</p>

<p><strong>Step 5</strong>: Initial config of opnsense</p>

<p>Log into console of opnsense (the proxmox built in one). Option 2 - set interface IP. Configure LAN side. This part is a little confusing. We DONT want it to use DHCP as in where it gets it's IP, but we want it to SERVE DHCP...so that other LAN devices can get an IP from it. So in this menu the first time it asks you about DHCP the answer is no, the second time the answer is yes. Set IP to 10.32.0.1 and 24 as subnet bit count. Enable DHCP server. Start clients at 10.32.0.51 and end at 10.32.0.254. That way we've got ~50 IPs for statics. Change GUI to http. Reset to defaults - yes.</p>

<p>...now try to access GUI on <a href="http://10.32.0.1" rel="nofollow">http://10.32.0.1</a></p>

<p>On the GUI you should have an initial setup. Set hostname, domain, and DNS. Go with a public one for now e.g. 1.1.1.1 Leave the WAN side as DHCP - no need to change anything here.</p>

<p><strong>Step 6</strong>: Firewall</p>

<p>Go back to proxmox &amp; navigate to datacenter on left then to firewall. This stuff cascades so the rules you set on datacenter level apply to the device and to VMs below.</p>

<p>The firewall rules use first match principle, starting with zero i.e. top of list. So in general we want a pattern like so</p>

<p>[0] - Allow SSH on LAN side<br />
[1] - Disallow SSH on everything</p>

<p>So lan side incoming SSH hits rule 0 matches that and gets approved, while everything else fails rule 0 then goes to rule 1 and gets dropped.</p>

<pre><code>Direction: In
Action: Accept
Interface: vmbr0 [[[[this is LAN side]]]]
Protocol: TCP
Dest Port: 8006
Enable: Tick

Direction: In
Action: Drop
Interface: [[[[leave empty]]]]
Protocol: TCP
Dest Port: 8006
Enable: Tick
</code></pre>

<p>Do same for 22 TCP and ICMP (protocol, no port). I'd suggest messing with ICMP to experiment and get a better grasp of what blocks when.</p>

<p>Triple check that you've got this right. Next step is enable firewall...and if you fkd this (8006 specifically) up then you're locked out and will need a physically screen &amp; keyboard to sort it out.</p>

<p>You should also block these ports on vmbr1 (internet/wan) for good measure:<br />
TCP 111, UDP 111, UDP 323, TCP 25, TCP 3128. No idea what they all do...but proxmox is listening on them &amp; I don't want them open internet facing. I used command  "lsof -i -P -n" to work out what ports are being listened to.</p>

<p><strong>Step 7</strong>:  Connect device to internet</p>

<p>If all went well then a device plugged into LAN side can now access the internet. First thing you want to do is head over to</p>

<p><a href="https://www.yougetsignal.com/tools/open-ports/" rel="nofollow">https://www.yougetsignal.com/tools/open-ports/</a></p>

<p>And confirm they can't see your port 8006</p>

<p><strong>Trouble shooting</strong></p>

<p>1) You'll need to set a static IP in the right range on your laptop when connecting directly to a device. So when you can't reach the interfaces (proxmox or opnsense) checking that you're on the right net is helpful. Also windows is really shtty on this so sometimes you need to disable and reenable the network adapter to make it pick up things right. Try that before assuming something else is broken. You may also need to restart the laptop entirely...windows tends to get confused easily when rapidly switching networks.</p>

<p>2) Very likely that you'll f up DNS somewhere along the way...so when trying to work out whether a path through the firewall works try to use IPs like 1.1.1.1 with ping rather than google.com.</p>

<p>3) If genuinely stuck do ping device by device. i.e. my laptop is connected to a proxmox device...can i ping that by IP. Yes, ok can I ping opnsense by IP. Yes, can I ping 1.1.1.1. Yes. Can I ping google.com.</p>

<p><strong>Devices</strong></p>

<p>You should point all devices at the opnsense instance for both gateway and DNS [10.32.0.1 for me]. Never point a device at the pihole IP directly...that would work yes but it'll get you into trouble later in unexpected &amp; hard to troubleshoot ways. You want the devices asking opnsense for DNS and opnsense in turn asking the pihole/adguardhome, and that asking 1.1.1.1 in turn. It's under Unbound in opnsense...section called Override...that's where the pihole goes. Also I suggest using Adguard home...it's superior to pihole.</p>

<p><strong>YAY &amp; Thoughts</strong></p>

<p>Once it all sorta works, export the config in opnsense and save a copy of the proxmox /etc/network/interfaces - opnsense has a really nice "one config backup file everything is in it" config thing going...use it.</p>

<p>If anyone finds holes in this post please do tell...I'm running this live so if I'm wrong about something I'd like to find out from you rather than an evil hacker</p>

<p>Full /etc/network/interfaces for completeness</p>

<pre><code>root@firewall:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface enp2s0 inet manual

iface enp3s0 inet manual
iface enp4s0 inet manual
iface enp5s0 inet manual
iface enp6s0 inet manual
iface enp7s0 inet manual

auto vmbr0
iface vmbr0 inet static
        address 10.32.0.2/24
        gateway 10.32.0.1
        bridge-ports enp7s0 enp6s0 enp5s0 enp4s0 enp3s0
        bridge-stp off
        bridge-fd 0

auto vmbr1
iface vmbr1 inet static
        address 10.31.0.5/24
        bridge-ports enp2s0
        bridge-stp off
        bridge-fd 0
</code></pre>

<p>And firewall view:</p>

<p><img src="https://i.imgur.com/NDmFLAc.png" alt="" title="" /></p>
]]>
        </description>
    </item>
   </channel>
</rss>
