Category: Network

  • UniFi camera VLANs with OPNsense and FreeRADIUS

    UniFi camera VLANs with OPNsense and FreeRADIUS

    My IP cameras use a local recorder and have no need for Internet access. They’re on a separate VLAN, with firewall rules allowing the recorder access and blocking everything else they don’t need.

    UniFi’s RADIUS MAC authentication lets them join the existing WiFi and still be assigned to the camera VLAN. FreeRADIUS on OPNsense holds the MAC-to-VLAN mapping. The cameras continue using the normal WiFi password.

    This example uses VLAN 500 for cameras. The VLAN, DHCP scope and firewall rules need to exist on OPNsense, and VLAN 500 must be carried through the switches to the AP. The steps below cover the UniFi and FreeRADIUS configuration.

    Camera MAC address sent by a UniFi AP to FreeRADIUS on OPNsense; the returned VLAN places the camera on VLAN 500.
    The AP asks FreeRADIUS for the camera’s VLAN, then applies the result. Simplified successful connection; click to enlarge.

    UniFi configuration

    1. Add the camera network

    Under Settings → Networks, add a network named Cameras, with VLAN ID 500 and the router set to Third-party Gateway. If the network already exists, use that. Routing and DHCP remain on OPNsense.

    2. Create the RADIUS profile

    Open Settings → Networks → RADIUS Servers and create an external RADIUS profile. Some Network versions put RADIUS under Profiles.

    • Name: opnsense.
    • Authentication server: the OPNsense address reachable from the AP.
    • Port: 1812.
    • Shared secret: a generated secret, which will also be entered against the AP in FreeRADIUS.
    • RADIUS Assigned VLAN Support: enable it for wireless networks.

    Save the profile. Accounting isn’t required for VLAN assignment.

    3. Select the profile on the WiFi network

    Under Settings → WiFi, edit the existing SSID. Keep its usual WPA2/WPA3-Personal security and password.

    1. Open the advanced settings and enable RADIUS MAC Authentication.
    2. Select the opnsense RADIUS profile.
    3. Set MAC Address Format to lowercase without separators: aabbccddeeff.
    UniFi RADIUS MAC Authentication settings with the MAC address format dropdown open
    UniFi Network 10.1.85: MAC address format.

    For a new setup, apply the WiFi change after completing the FreeRADIUS configuration below, so reconnecting clients have a working RADIUS service to query. These settings follow Ubiquiti’s MAC-based VLAN guide.

    OPNsense / FreeRADIUS configuration

    4. Enable FreeRADIUS and VLAN assignment

    If needed, install os-freeradius under System → Firmware → Plugins. Open Services → FreeRADIUS → General and enable both Enable and Enable VLAN assignment.

    My configuration also uses Enable VLAN fallback assignment, visible in advanced mode, with Fallback VLAN ID set to 1. This allows devices without a matching camera entry onto the normal network. Use the VLAN appropriate to your default network. This option deliberately accepts failed MAC logins onto that VLAN; leave it off if unmatched devices should be rejected.

    Save the settings. FreeRADIUS’s separate DHCP Enable option isn’t needed here; clients use the existing DHCP service on their assigned VLAN.

    5. Add the AP as a RADIUS client

    Open Services → FreeRADIUS → Clients and add an entry:

    FieldValue
    EnabledChecked
    NameA descriptive AP name
    SecretThe same shared secret entered in the UniFi profile
    IP Address or Network with CIDRThe AP’s RADIUS source address, normally its management IP; use /32 for a single IPv4 address

    Save the entry and repeat for each AP serving this SSID. Allow UDP 1812 from those AP addresses to OPNsense through the relevant firewall rules. The client address is the AP, not the camera or UniFi controller.

    6. Add the cameras as users

    Under Services → FreeRADIUS → Users, add one user for each camera. For an example wireless MAC of AA:BB:CC:DD:EE:FF:

    FieldValue
    EnabledChecked
    Usernameaabbccddeeff
    Passwordaabbccddeeff
    DescriptionA camera name or location
    VLAN ID500
    IP Address / SubnetmaskLeave blank; use DHCP

    The username and password are both the MAC address, in exactly the format selected in UniFi. Leave Password Encryption at its default Cleartext-Password if viewing the advanced fields. This RADIUS password is separate from the WiFi password configured on the camera.

    Save each user, then apply the FreeRADIUS changes. With VLAN assignment enabled, OPNsense generates the required tunnel attributes from VLAN ID; no custom reply attributes are needed. The OPNsense FreeRADIUS guide covers the plugin settings.

    Check the result

    Apply the UniFi WiFi changes, then reconnect a camera. In UniFi’s client list it should still show the existing SSID, but its network should be Cameras. Check that its DHCP lease belongs to the VLAN 500 subnet, that the recorder can reach it, and that Internet access is blocked.

    If it fails, check Services → FreeRADIUS → Log File. A rejected login usually warrants checking the wireless MAC, its formatting and the matching password first. No request points towards the AP client entry, shared secret, firewall or server address. If authentication succeeds but the network is wrong, check both VLAN-assignment settings and the VLAN path to the AP.

    This is running here with cameras on the normal 2.4 GHz SSID and VLAN 500. Adding another camera is one more FreeRADIUS user entry. MAC addresses can be spoofed, so this is convenient segregation for devices using the WiFi password, rather than strong device authentication.

  • Netgear WAX214 WiFi 6 Access Point

    Netgear WAX214 WiFi 6 Access Point

    (Or Why I’ll Never Buy Another Netgear Product)

    A long, long time ago I bought a Matrox Marvel G200 graphics card. It was (for the time) quite expensive. It did 2D, 3D, and had a built-in TV tuner. It was great.

    Shortly after, Windows XP was released. That was great too. Mostly everything just worked.

    There was one hiccup, however. Matrox, in their wisdom, decided not to invest the effort in producing a Windows XP driver set for the Marvel G200. You could use it as a graphics card, but the TV function didn’t work at all, despite it being supported under Windows 2000.

    Matrox went on my manufacturer blacklist from that moment.

    Cut forward some years, I go and buy a Netgear WAX214 access point. I’m relatively impressed with it from a speed point of view, and it covers my house quite well.

    Some time later, I notice I’m not getting great speed in one corner of one room, nearest to the wall shared with our neighbours. I pull out my phone and do a quick scan check strength … and I see that the WAX214 5GHz SSID is overlapping channels badly with next door’s WiFi.

    Simple! I’ll change the channel on the WAX214 to a free higher channel, and that should fix the problem. I log onto the GUI and … what? There are only 4 channels to choose from on the 5GHz side. Wait what?!

    Long story short, it turns out that Netgear have, for some reason, failed to certify this device for higher channels, so those channels aren’t available in the UI. There are mixed reports that on earlier firmware you can still get them, but I downloaded the first release available and it still has the same issue.

    https://community.netgear.com/t5/Business-Wireless/WAX214-Only-U-NII-1-5Ghz-channels-available/td-p/2075537

    https://community.netgear.com/t5/Business-Wireless/WAX214-missing-5GHz-channels/td-p/2217122

    So thanks, Netgear, for your stunning work on this – still current model – access point, that’s basically useless unless you live in a field with no neighbours. Welcome to my shit-list.

    Matrox

    Netgear