I’m moving soon and planning some overhauls to our home lab and local network.

We have security cameras and I really want them on their own VLAN without internet access. Then I got even more ambitious and decided I want to separate a lot of things into different VLANs without internet access, but can still talk to each other.

My long term goal will be to have an OPNsense box that I can do even more intricate network configs with, however in the short term I don’t think I can afford the hardware to do so. So for now, I’m trying to find the simplest, ideally cheapest way to implement at least one VLAN in my local network.

My ISP’s router will not support it, however should support bridge mode. So I’m thinking the easiest way is to buy a VLAN capable router and pass through to it, however I’m still new to this and learning as I go.

Curious if anyone here has VLAN tips, tricks, or suggestions for a cheap/easy setup.

Cheers!

  • neidu4@piefed.social
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    54 minutes ago

    Short answer: Don’t buy a VLAN capable router just yet. Buy a VLAN capable switch first, and then you can reevaluate.

    Longer answer: VLANs have been a major part of my career for the past 20 years, and it seems that a very common thing I need to teach people joining me at work is this: Switches don’t provide access between VLANs. Routers do. But that doesn’t necessarily mean that the router needs to know about VLANs.

    Sure, it’s reasonably obvious to many, and there are exceptions, but a very common question I get is how one can set up VLANs so that some hosts can talk to each other across VLANs.

    There are many ways to set up VLANs, but I find it easiest to number a VLAN based on an octet in the IP scope of its clients. For example:
    172.20.32.0/24 gets VLAN 32
    172.20.40.0/24 gets VLAN 40
    …etc

    And then you plug a router into each of those VLANs and set up firewall rules according to your preferences. The router can be connected via a single trunk cable (if it supports VLAN tagging), or if you’re lazy or your router is too dumb, you use a dedicated interface/cable for each VLAN via Access ports instead and segregate them via subnets.

    So back to your question: Put your cameras on an isolated VLAN, provide that VLAN with a gateway, and then you config the gateway to block its internet traffic, but allow access between your camera vlan and some (or all) hosts on your other subnets/vlans.
    A decent VLAN capable switch will let you do this, and on the router side you just treat these VLANs as physically separate networks.

  • LemmyFeed@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    2 hours ago

    I have a full tplink omada network with an er605 router/gateway and self hosted omada controller which gives me a pretty broad SDN capabilities and makes vlan and other management pretty simple especially when trying to manage vlans across various waps and switches. I’d recommend it for sure.

    and for vlan and firewall acl planning I used AI for a lot of it and it was super helpful. I’m not a networking person but know enough to have an idea of what I wanted so AI was able to tell me how to configure everything I wanted in my omada controller to get the proper cross vlan communications.

    my default vlan is infra and management, so all the hypervisors and network gear. then I have vlan40 for servers, 20 for my end user devices with dedicated ssid, 30 for my son’s segregated network with dedicated ssid, and 69 for iot with it’s own ssid too.

    edit: I also have 8 poe cameras but they all run to a dedicated NVR and don’t use my network for any transmission so they’re already kinda in their own network already.

  • bagsy@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    5 hours ago

    Opnsense is a good option. You should be able to find a cheap, dual nic, mini computer on black friday for around $200. Opnnsense is WAAAYYYY easier that mikrotik that others are recommending.

    • jonzobot@lemmy.ca
      link
      fedilink
      English
      arrow-up
      5
      ·
      7 hours ago

      Can confirm. But the learning curve is steep. I did eventually get VLANs set up with RouterOS, but it wasn’t at all easy. Part of it is that RouterOS has different ways of setting up a VLAN, depending on bridge filtering, and it’s not super obvious which way is which.

      • non_burglar@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        3 hours ago

        That’s because mikrotik builds in IEEE and ISO standards, not what MS and Apple have deemed to be “DNS”, VLAN, etc.

        VLANs are a layer 2 feature, but most people cannot fathom decoupling subnets and routing from them.

        And don’t get me started on making old HP Procurve and Cisco switching play nice with vlans.

  • Great Blue@infosec.pub
    link
    fedilink
    English
    arrow-up
    7
    ·
    10 hours ago

    You can look into OpenWRT. Maybe your router model is supported.

    OpenWRT is capable of VLANs and if you get an OPNsense box later, you can use the router as an access point. You can also set up different SSID for your WLAN and tie each one to a different VLAN

    • lemmyvore@feddit.nl
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 hours ago

      I second OpenWRT.

      You might not even have to do actual VLANs. OpenWRT has very useful abstractions already set up: devices, interfaces, wireless AP, and firewall zones. You can tell it how to connect physical devices and wireless AP into networks, associate networks into firewall zones, and configure how the zones can talk to each other. It takes a moment to wrap your head around it but then it’s quite nice.

      It’s very simple to create a separate wifi AP that’s only for cameras and/or reserve a switch port for them, connect that AP/port to a separate network, assign it a firewall zone, and configure it to be accessible from other zones but to not be able to connect outside to other zones or WAN.

      The only time I’ve had to do an actual tagged VLAN was when I wanted to put a wired machine with a single Ethernet cable in multiple networks.

  • CompactFlax@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    4
    ·
    10 hours ago

    You need a router. Opnsense is a router. You could buy a different one but if you want to go the route of opnsense, why would you get a different one? It doesn’t need much power, unless you’re trying to route gigabits - and then any router will cost you.

    You also need a vlan aware switch or a second switch (and the router needs more than one local port). Just a switch won’t work; you need the firewall rules between vlans and internet to make it worthwhile.

    My opnsense has ports to WAN, LAN, and IOT (cameras). LAN connects to a switch. IOT connects to a different (poe) switch that runs the cameras. I have a firewall rule on IOT blocking all outbound traffic, and allowing inbound from LAN.

    • iamthetot@piefed.caOP
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      10 hours ago

      I have lots of stitches already, but what’s a specific “VLAN aware” switch?

      As for the opensense, the hardware I have seen recommended to run it is quite expensive right now due to AI shit. I’ve seen N100 or N150 devices recommended a lot. Add in ram and storage and building a whole device gets more expensive than a brand name router for now. For example, I can find Ubiquiti routers for a few hundred dollars.

      • CompactFlax@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        3
        ·
        9 hours ago

        Commonly a “Smart switch” or “layer 2”. Layer3 adds inter vlan routing in the switch which chances are more complexity than you want. Chances are your cameras won’t tag their own traffic and I would trust them to do that. So the switch needs to apply the tag to the port, or it needs to be a separate physical network (hence “virtual LAN”). I probably butchered that explanation.

        If you can find a UI router for less than opnsense, I’d go that route. Their switches aren’t the cheapest but they’re pretty affordable, and the integration is convenient. I run opnsense because I got a device for $50 - used. It’s an Atom processor circa 2012 and has 4GB RAM. I think it should handle a couple hundred mbps and that’s fine for me. Gigabit speed needs more processing horsepower as the speeds increase.

        “Someday” I’ll buy some UI access points, a switch, and a router.

      • Great Blue@infosec.pub
        link
        fedilink
        English
        arrow-up
        2
        ·
        9 hours ago

        A VLAN aware switch is probably a switch which can handle VLANs. If the switch does not, the behavior can vary from ignoring the VLAN-tag, stripping the tag or discarding the packet altogether.

        If your are looking for a switch, look for support for “802.1Q”, “dot1q” or similar. It’s the IEEE standard for VLANs.

      • kieron115@startrek.website
        link
        fedilink
        English
        arrow-up
        1
        ·
        9 hours ago

        use an old laptop to start, routing doesn’t take much until you start doing fancy flow control/quality of service like CAKE or FQ-CODEL. connect a dot1q-aware “smart” switch to it and you have what you need.

        • iamthetot@piefed.caOP
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          1
          ·
          8 hours ago

          I probably should have mentioned that I would like to achieve 1 gig speeds, which is why I believe building an opnsense machine would be more expensive at the moment.

          However, looking again, I’m finding some Topton machines on Aliexpress that might work for much less than last time I looked. Maybe black Friday sales.

          • kieron115@startrek.website
            link
            fedilink
            English
            arrow-up
            4
            ·
            8 hours ago

            Most routers come with simple ARM SOCs so any relatively modern laptop CPU should be more than capable of handling gigabit routing. I used an i7-6700HQ laptop as a router for a while and it was incredibly overkill.