fix(opnsense-vm): improve script and add single-interface mode #9614
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✍️ Description
Okay, I'm going to divide this PR into two parts. In short, this current version doesn't fix the bug #6183. In fact, I managed to reproduce two of them intentionally. And I think I can solve it later by bringing a more robust solution than just sleeping after this PR #9540 was accepted, because I see this improvement feature being better used as a core for reuse in future VMs scripts.
The first part will be this one where I make adjustments to some steps that I would like to have in this installation.
The second part will be about improving download speed and installation without long or insufficient sleep periods.
This PR adds the option to deploy OPNsense VM with a single network interface, supporting use cases where OPNsense is not intended to be the primary router/firewall.
Background
Not everyone wants to use OPNsense as a full router replacement (like me). Many users run hybrid network topologies where an existing router (like MikroTik, pfSense hardware, or ISP equipment) handles routing/NAT, and OPNsense is deployed as a specialized service for:
Example Topology (Single Interface Mode)
In this setup:
vmbr0) - no WAN bridge requiredChanges
Added network mode selection in default settings
dual: Traditional firewall/router mode (LAN + WAN interfaces)single: Proxy/VPN/IDS server mode (LAN interface only)Conditional WAN interface configuration
vmbr1) is only validated and configured when dual mode is selectedImproved WAN configuration logic
WAN_BRGis setWAN_BRGandWAN_IP_ADDRare definedUse Cases
Testing
NOTE: I tested the script twice, and in both instances, the installation went perfectly (single mode). I was only unable to test the LAN and WAN version because I won't be able to generate a sandbox environment, as I'm short on time this end of the year. I would need one more willing person to test the full version.
Additional Notes
🔗 Related PR / Issue
Link: #
✅ Prerequisites (X in brackets)
🛠️ Type of Change (X in brackets)
README,AppName.md,CONTRIBUTING.md, or other docs.