Alexander C. Hubbard

OpnSense on Hyper-V | How to add VLANs as Interfaces

I recently switched over to OPNsense from my Ubiquiti Unifi Dream Machine. This is how I presented all my VLANs as interfaces.


To add VLANs as interfaces to OPNsense running on Hyper-V, you can follow these steps:

  1. Configure VLANs on Hyper-V Virtual Switch:
    • Open Hyper-V Manager.
    • Navigate to the virtual switch settings.
    • Create VLANs corresponding to the VLANs you want to use on OPNsense.
    • Assign VLAN IDs to each virtual switch.
  2. Configure Virtual Machine Network Settings:
    • Select the OPNsense virtual machine in Hyper-V Manager.
    • Go to its settings.
    • Add network adapters corresponding to the VLANs you created in the previous step.
    • Assign each adapter to the respective virtual switch with the appropriate VLAN ID.
  3. Configure OPNsense Interfaces:
    • Log in to OPNsense web interface.
    • Navigate to Interfaces > Assignments.
    • You should see the additional network adapters corresponding to the VLANs.
    • Assign each adapter to an interface (e.g., LAN, WAN, OPT1, OPT2, etc.).
    • Configure IP addresses and other settings for each interface as needed.
  4. Configure Firewall Rules and NAT:
    • Once the interfaces are assigned, configure firewall rules to allow or block traffic as per your network requirements.
    • If you’re using NAT, configure NAT rules accordingly.
  5. Verify Configuration:
    • Test connectivity from devices connected to each VLAN to ensure that traffic is passing through OPNsense correctly.
    • Check firewall logs and monitor traffic to ensure that rules are being applied correctly.

By following these steps, you can add VLANs as interfaces to OPNsense running on Hyper-V and effectively manage your network traffic within your virtual environment. Remember to review and adjust configurations as necessary based on your specific network setup and requirements.