VLAN's and openHAB

I’ve decided to play around with VLAN’s. I’ve got these in my mind:

  • ‘trusted’ devices (laptops, phones)
  • IoT devices (Shelly, printer and whatnot)
  • ‘local’ devices (ESP32 etc.)
  • ‘guest’ devices (for guests, obviously)

But what to do with my openHAB server, which is by the way also one of my two Pi-hole servers annex DNS servers. Does that (Linux Mint) device belong in the ‘trusted’ VLAN? Or in the IoT VLAN? Or maybe in a 5th ‘servers’ VLAN?

(Less on-topic here, but I’ve got another Openmediavault (Debian derivative) device which acts as NAS, on which all my Docker containers (Jellyfin, Nextcloud, SWAG …) run, as wel as an LXC with my second Pi-hole annex DNS server. Not an openHAB question, but if anyone has some educated advise, also always welcome.)

Thanks for anyone’s advice!

I have 4 vlans in my home network.

1 is the default with my phones, tablets, laptops, switches, internet gateways
2 is for trusted iot devices like heatpump, energy meters, ventilation, knx, shellys, home connect devices etc
3 is for untrusted iot like alexa, tuya devices etc
4 is my guest vlan

my server is connected by default with vlan 1 and with virtual interfaces with vlan 2,3 and 4

on my server itself, everything is visualized. Means all my services, including openhab running as separate containers. Currently there are 34 containers in total. The underlying os does not matter. I can deploy my setup on suse leap 16, alma 10 and latest ubuntu. But currently I prefer suse, because I’m using it since 1995 and I’m feeling a bit nostalgic with it :slight_smile:

this is my setup

the most important part for me was that all your network devices, including your AP’s must be manageable to configure vlans there. most of them are from qnap (2.5GBit), microtick (1GBit & 2.5GBit) and ubiquity (flashed with openwrt and 2.5GBit). They are connected to each other with 10GBit, The gateway is a banana pi r4 with openwrt and 1 GBit fiber optic.

The key thing is that your openHAB server is going to have to be able to access the VLAN(s) where everything it integrates with is running (presumably the IoT VLAN and the local devices VLAN) as wellll as the VLAN where everything that needs to access openHAB is running (presumably the trusted devices VLAN).

The whole point of using VLANS like this is to make it so devices in one VLAN cannot see the devices in another VLAN. But openHAB needs to see devices in most of the VLANS so it needs to be on most of them.

This is the main reason I abandoned the whole concept. By the time it’s configured it ends up being super complicated and with so many holes aand bridges connecting the VLANS that I had to ask “what’s the point?” YMMV.

That was exactly my first question as well.
The only reason I could see for this kind of configuration was if you planned to put all home automation devices on one isolated VLAN as a attempt to reduce automation device communication and broadcast traffic from impacting any of your other local network traffic

My initial motivation was coming from my distrust of the companies behind Alexa and Tuya. I didn’t want these devices on the same network as my core home devices like the heating system, KNX control, and solar panels. Then, it was a small step towards the final concept.

I agree, it is more complicated, requires some initial planning, and needs good documentation about which port on the switches corresponds to which VLAN. Especially if you have more than one switch and a mix of tagged and untagged ports :slight_smile:

For small installations, it doesn’t make sense.

The OH server can easily participate in more than one VLAN (just tag multiple VLANs on its NIC). That way you don’t need bridges etc., but OH itself becomes a “security weakness” in the separation between the VLANs. I’d still think that’s the easiest way to do it in most cases. Alternatively, you need a firewall/router to manage access across the VLANs, so it will say what traffic is allowed and not.

However, using routing has one significant downside - multicast (/broadcast) packets don’t traverse routers by default (in theory it’s not true for multicast, but I’ve yet to see that actually work out of the box). Multicast packets have a TTL value that is supposed to be decremented by one for each router it traverses, so that you can decide when the packet is created how many routers it will traverse. Everything using multicast is then supposed to allow the user to configure the TTL value and in that way control how long it travels.

This must have been a pipe-dream by those who designed multicast, because the TTL is rarely configurable by software and devices using multicast, and most cheap routers don’t forward the packets at all.

So, in reality, it’s most practical to just see it as if “multicast doesn’t traverse routers”.

This matters because several discovery mechanisms used by OH relies on multicast, things like mDNS, UPnP, SDDP and probably also more binding specific “discovery protocols”. Having a router between OH and your devices thus means no autodiscovery for the devices, which, depending on the binding, might pose some challenges. If a binding is “properly made”, you can configure all the information acquired automatically yourself, but from what I’ve seen, this isn’t always the case.

If you instead let OH’s NIC be tagged on multiple VLANs, OH will have multiple IP addresses, one for each network in which it participates. This will allow things like mDNS etc. to function, but it undermines some of the “security” that the VLANs are supposed to provide, because I’m sure there are multiple ways to abuse the OH installation (either through OH or throught the underlying OS) to access the other VLANs. It’s still much better separation than no separation though.

Even if you go down this route, you will probably have some challenges. The Shelly binding comes to mind, where I have pointed out (and created a PR that addresses a little part of the problem) that it’s not really written to handle multiple subnets. In particular, it has the concept of “callback IP” that it sends to Shelly devices so that they should know how to contact OH. This system only allows having one “callback IP” for all devices, which means that it’s impossible for the binding to work with Shelly devices on multiple networks. Even if the binding can see them, they can’t contact OH from more than one of the networks.

My guess is that there are other, similar, limitations in other bindings. Most people just aren’t very good at understanding networking, or at bothering to do the extra work required to make it work in anything but the must simplified scenarios.

I would therefore perhaps “start small” and just create two VLANs, where you put the things you “trust less” on a dedicated VLAN. By moving one type of device at a time, you have the chance to experience whether the binding can handle it or not.

My openHAB server is on the IoT network. Running Pi-Hole on the same machine complicates that, so I would split them. I have a few devices (PCs and phones) on a trusted VLAN, anything else that may “phone home” is on IoT. My Pi-Hole is on my LAN, and I found that having IoT devices use Pi-Hole creates more problems than it solves (especially smart TVs etc). I put cameras on their own VLAN and they can’t leave the network. Depending on your router solution, a few simple firewall rules solve the DNS access. Since openHAB and (nearly all) devices run on IoT, there are no cross VLAN issues. A few niche issues pop up (like mirroring an iPad from trusted network to smart TV on IoT), but easily solved with a few firewall rules.

Network segmentation is always a good idea and an effective, base layer security measure. As a starting point, simply think about

  • type of devices
  • value (financial) of devices and their potential consequences in case of damages (e.g., what if someone from outside starts hundreds of times the blinds per minute, those motors does not like that and could be damaged by that)
  • threat vectors (e.g., avoid resp. limit lateral movement, etc.)
  • use cases and their communication need (by default, everything which is not explicitely allowed is forbidden)

Particularly, because IoT devices run longer than office IT equipment and have in parallel often outdated firmware versions (EoL) and/or less security features.

Please note: If I write VLAN (which is L2), then I mean also a corresponding IP subnet on L3. If Wifi is required, then there is own virtual AP for that subnet, too.

Examples:

  • 99% of my smart home devices are in a separate VLAN without internet connection. The residual 1% is my PV system and separated in an own VLAN.
  • For administration of my network devices, there is a separate Admin VLAN.
  • Entertainment IT (e.g., smart TV, etc.) are also separated in an own VLAN.
  • VPN as own VLAN.
  • Multiple “guest” VLANs, one for real guests (visitors), but also for home-office, etc.

In the end: I’d recommend to simply start with it and develope it further. Having 2 VLANs is better than everything in one and so forth.

But: As always … the chain is only as strong as the weakest link. The best network setup is useless, when unsecure PSK for wifi connections are used or network devices have outdated firmwares, etc. :wink:

This has really gone down as one of the most successful “propaganda operations” of all times, making people dead scared of not updating everything constantly. Conveniently, this also lets the manufacturers rewrite the rules at any time, take away possibilities and convert free services into paid ones etc.

I’m not saying that firmware updates never contain genuine “security enhancements”, but the idea that this applies to most updates is just… false. If you already have restricted what the devices can do to the minimum, and prevents attackers for reaching them, the consequences of running “outdated firmware” can be reduced almost to zero.

My Setup

VLANs

I have a rather complicated setup of these VLANs:

  • Management VLAN: network infrastructure administration, UniFi network console communication
  • DMZ VLAN: devices that are accessible from the internet through open ports in my firewall (file server)
  • LAN VLAN: “normal” devices, including Yamaha AVRs, TVs, laptops, mobile etc.
  • IoT Core: KNX router, Fronius inverter, Raspberries + ESPs for smart home
  • IoT Visu: wall-mounted tablets for openHAB access
  • IoT Outdoor: IoT devices that are installed outdoor

Policies

These rules are in place:

  • DMZ: only access internet
  • LAN: DMZ + internet
  • IoT Core: DMZ + other IoT nets + internet
  • IoT Visu: internet + openHAB + video surveillance server
  • IoT Outdoor: internet + video surveillance server

There are very few and specific device A in net 1 is allowed to communicate with device B and in net 2 rules.

openHAB etc.

openHAB is “multi-homing” in IoT Core & LAN, so it don’t have the hassle with most of the broadcast. In general, mDNS traffic is relayed between LAN, IoT Core & IoT Visu.
For my DoorBird’s event broadcast, I had it working for some time, but got fed up with maintaining its UDP broadcast relay rules, so I created a PR for the binding to support event triggering through webhooks.

Philosophy

The main reason for IoT Core is to protect its devices from “rogue” LAN devices, I consider my openHAB server trusted enough to get access to IoT Core. Luckily I have no IoT devices I’d consider outdated apart from AVRs and TVs, my IoT is basically KNX + well-maintained open-source.

IoT Outdoor only exists because I have devices outside that are connected to wired ethernet and they don’t support 802.1x authentication. In case someone removes them and plugs into the network, they shouldn’t be able to “attack” the house.

My Firewall

All routing, DNS, DHCP and of course firewalling is performed by a OPNsense hardware FW, also acting as internet router.

I also have a road warrior VPN setup, VPN clients are in their own network, but basically have the same rights as LAN clients.

Advice for Beginners

If I were to begin all that above (haha basically I had restructured a lot of things in the last week, added IPv6 support etc., so I had kind of a fresh start), I’d start like this:

  1. Put devices that are directly accessible from the internet into a DMZ. Whenever possible, try to avoid opening ports to the internet to reduce the attack surface. If you really have to, put the device into a DMZ – IMO the largest attack vector are devices that are reachable from the internet.
  2. When the attack surface from the internet has been minimised, you can start thinking about your local network. I’d split it between “normal use” and IoT.

I prefer not to open anything from the outside, but in instances where I do so (usually temporarily), I have sometimes created “dedicated DMZs”. The idea is that if one device in DMZ is compromised, it shouldn’t automatically be able to attack other devices in DMZ. Not having DMZ is my preferred solution though, it’s better to connect to OPNsense using VPN from the outside when you need to reach something on the inside.

I also use VLAN’s. My main router uses OpenWRT. In what relates to OH:

  • IOT vlan has almost all IoT devices, including the OH server. It’s a /24 range where only 192.168.129.192/26 has access to internet (all others do not). DHCP is enabled but all devices have IP reservations out of the DHCP range. A /24 range supports up to 254 devices, if I needed more I could have it defined as a /23 or even /22 range
  • Home vlan, where I have TV’s, PC’s, NAS, Plex, UrBackup, mobile phones, etc. Servers (Proxmox) are also in this vlan. OH has its own containner in one of them (as well as 2x Z2M, Mosquitto and others related to IoT). The firewall allows the OH server to access this vlan

I also have vlan’s for guest and lan. I did not find a way to allow OH discovery accross vlan’s. Please note that some Wi-Fi AP’s do not support more than 4 SSID’s (mine are Unifi).

I totally agree, but since I cannot send VPN configs to people I want to share a file with I need the open port …

As said above, the most “convenient” way to achieve this is to make OH multi-homed where it participates in both networks. It does however open the possibility that OH itself can be used to “circumvent the firewall” to get across to the other network, but I’m not sure that the risk is very high. It would require some sophistication on the side of the attacker to find a way to do this, you should be “protected” against automated scan and data collection etc.

This is also why I have to open a port. If it were not for needing to give access to extended family I’d totally make everything only available locally and require a VPN. And even now I only expose a couple services.

I don’t have a DMZ yet, but plan on configuring one when I can for these services. I have them isolated already in many ways but want better isolation. That’s the only reason I expect to reintroduce VLANS in the future.

I should note, openHAB is not one of the exposed services. :wink:

I’m gonna let my unifi-fanboy show.
When my home router was pf-Sense, vlans were too much cognitive load for me to bother
When I switched to Unifi, they were easier but still too much cognitive load

I always felt guilty that my home network was full of “potential rogues and spies”

The latest sets of Unifi releases made vlans, not trivial, but easy.

Unifi hardware is not cheap, but it’s

  • license free
  • unlimited by arbitrary tiers to charge you more for a license
  • can be 100% local

That’s amazing, given that VLANs aren’t really managed by the firewall at all. For pfSense, OPNsense or any other software firewall, VLANs are just network interfaces. You configure the VLANs in your NIC and switches, not in your firewall.

Don’t these contradict each other? If there’s no license, there are no tiers…

I don’t remember the details now, but that’s the opposite of my experience. When dealing with UniFi Protect some time ago, they had discontinued the local management system and basically forced you to use their cloud, as far as I remember. Seeing how even the software for locally managing APs appear to be “abandoned” in favor of “cloud management”, I decided there and then that there will be no more UniFi for me. Once a company starts pulling shit like this, they lose my trust forever - there’s no going back.

I think he means that there are no tiers that they can charge you for.

  • Everything mentioned here is software defined (even VLAN as it is a software-side solution to virtualize network infrastructure to cut the costs)
  • So, firmware updates (or patches) are closing vulnerabilities. By fixing vulnerabilities, a former defined security level will be reached again (that are no security enhancements)
  • The most successful initial access vectors are a) phishing and b) exploiting longtime-known vulns.
  • … and for public facing network devices, like firewalls/routers, this is missing critical.

I don’t follow your argument at all. What I’m saying is that most updates/patches aren’t closing vulnerabilities, that’s just something that is generally “slapped on” every update these days. Many patches/updated create new security holes as well.

I wasn’t talking about updating your firewall here, but your IoT devices. Believing that your TV that hasn’t been “updated” since 2017 because the manufacturer decided not to create new updates because they’d rather see you buy a new TV, is a security risk as a consequence, is in almost all cases seriously misguided.

I’m saying that if you restrict the access to and from your IoT devices to just what is needed for them to work, it’s exceedingly rare that a firmware update to any of those will make any difference to your “security risk”. That doesn’t mean that there never are situations where this matters, just that those are the exception, not the rule.