Cameras and IoT Devices: Why Isolate Them on a Separate Network
Typical risks of IoT devices, dedicated VLANs and SSIDs, firewall rules between LAN, IoT and cameras, cameras with no Internet and an NVR, DNS and NTP from the firewall, mDNS and SSDP discovery, UPnP disabled, updates, passwords and inventory, an example with OPNsense and a managed switch, common mistakes.
At home and in small offices the network fills up with objects: IP cameras, smart TVs, smart plugs, voice assistants, printers, thermostats. They almost always end up on the same network as the PCs and the NAS. A camera running five-year-old firmware, or still using its factory password, is enough to give an attacker a foothold inside the network. Let us see why these devices should be isolated, how to design a separate IoT network with VLANs and firewall rules, how to handle cameras and the recorder, and which services, such as automatic discovery and UPnP, need careful handling.
The problem: old firmware on the same network as the PCs
An IoT (Internet of Things) device is a small computer: it has an operating system, often Linux, a web server for configuration, sometimes a Telnet or SSH service, and an application that talks to the manufacturer's servers. Unlike a PC, however, nobody updates it regularly, and many models stop receiving updates after a few years.
If the entrance camera sits on the 192.168.1.0/24 network together with the computers, whoever manages to control it finds themselves on the same layer 2 network as the PCs. They can scan addresses, look for shared folders, try the credentials of other devices, and intercept unencrypted traffic. The firewall does not even see it: traffic between the camera and the PC goes through the switch and never crosses the firewall.
This is not a theoretical scenario. In 2016 the Mirai botnet infected hundreds of thousands of cameras and video recorders by trying a list of default credentials over Telnet, and used them for large-scale denial-of-service attacks. Since then the European standard ETSI EN 303 645 has asked manufacturers of consumer IoT devices, among other things, not to use universal default passwords and to provide security updates for a declared period.
Typical risks of IoT devices
- Outdated firmware: known, public vulnerabilities stay open for years, especially on cheap or discontinued models.
- Default credentials: factory usernames and passwords, such as admin/admin, printed in the manual and therefore known to everyone.
- Exposed services: a web panel without HTTPS, Telnet or SSH enabled, RTSP video streams without authentication, open ports that nobody uses.
- Connections to the manufacturer's cloud: many devices keep permanent connections open to external servers, for the smartphone app or for remote viewing. This is traffic you do not control, and it depends on the security of the manufacturer's service.
- Automatic port opening: with UPnP enabled on the router, a device can publish itself on the Internet without anyone noticing.
These risks cannot all be eliminated, because the firmware is written by the manufacturer. What can be limited is what a compromised device is able to reach. It is the same segmentation principle described in the article on VLANs, security and organisation.
The design: three networks instead of one
A balanced solution for a home or a small office uses three VLANs, each with its own subnet and its own gateway on the firewall:
- VLAN 10, LAN (192.168.10.0/24): PCs, laptops, the NAS, people's smartphones;
- VLAN 50, IoT (192.168.50.0/24): smart TVs, plugs, voice assistants, thermostats, budget printers; it reaches the Internet only when needed;
- VLAN 40, cameras (192.168.40.0/24): IP cameras and the network video recorder (NVR); no Internet access.
Wi-Fi devices join the IoT VLAN through a dedicated SSID, for example “IoT”, mapped to VLAN 50 on the access point. Many inexpensive devices only work at 2.4 GHz and with WPA2: that is why a separate SSID from the one people use is worthwhile, with compatible settings and its own password. The mechanism is the same as for the guest network, described in the article on guest Wi-Fi that is really separate: an SSID mapped to a VLAN, 802.1Q trunk ports up to the firewall, its own subnet and DHCP.
The cameras are powered by the switch using Power over Ethernet (IEEE 802.3af and 802.3at): a single cable for data and power, and one VLAN 40 access port for each camera. Device ports are untagged access ports; the trunk to the firewall carries the three VLANs with the 802.1Q tag.
The firewall rules
Separating the VLANs only helps if the firewall, which routes between them, applies precise rules. Rules are evaluated from top to bottom and the first match wins, as explained in the article on how a firewall rule works. There is a single principle: the less trusted side does not open connections towards the more trusted side.
- IoT → LAN: denied. An IoT device has no reason to open connections to the PCs.
- IoT → Internet: only when needed. A smart TV needs streaming services; a smart plug managed locally by a home automation hub can do without.
- Cameras → anywhere: denied, except DNS and NTP provided by the firewall. The cameras only talk to the NVR, which sits in their own VLAN.
- LAN → IoT and LAN → cameras: only to the ports needed, for example the NVR web interface over HTTPS on port 443.
The firewall is stateful: when the PC opens a connection to the NVR, the NVR's replies pass thanks to the state table, with no need for a rule in the opposite direction. The mechanism is described in the article on the stateful firewall and the state table. That is why the “cameras → LAN denied” rule does not prevent you from watching recordings from the PC.
Cameras with no Internet and an NVR
Cameras are the most sensitive devices: they film the home or the office, and many models send video to a cloud service for remote viewing. The most cautious setup is a network with no Internet access at all, where the cameras record to an NVR (Network Video Recorder) in the same VLAN, usually via the RTSP protocol (RFC 7826) or the ONVIF standard.
- the cameras send video to the NVR, which sits in VLAN 40: traffic stays on the switch and does not cross the firewall;
- the PC accesses the NVR through the firewall, with a rule limited to its web interface;
- from outside the home, the NVR is reached through a VPN, as described in the article on WireGuard, not through the manufacturer's P2P service nor through port forwarding.
Some NVRs have built-in PoE ports and create a small network for the cameras on their own. It is a valid solution, provided you know that the NVR becomes a router between the two networks: it must be updated and configured with the same care, and it must not forward traffic between its ports and the LAN.
Without the Internet, the cloud features of the manufacturer's app, such as notifications or remote viewing, stop working: it is a deliberate choice, in exchange for a camera that talks to nobody outside the network.
DNS and NTP provided by the firewall
Even an isolated network needs two services. NTP (RFC 5905) keeps the clock correct: without the right time, recordings carry wrong dates and HTTPS certificates appear to have expired. DNS is needed by devices that use names, for example to reach the time server. Both are provided by the firewall, at the gateway address of each VLAN, for example 192.168.40.1 for the cameras; DHCP hands out the same address as the DNS server and, where the device supports it, as the NTP server (option 42).
Using the firewall's DNS has a further advantage: the query log shows which services the IoT devices try to reach, and it is an excellent inventory tool. How resolution works is explained in the article on DNS. Some devices use a public DNS server hard-coded in the firmware: you can block port 53 towards the outside, or redirect it to the firewall's resolver with a NAT rule. Redirection does not work with encrypted DNS (DNS over HTTPS), which travels on port 443 like ordinary web traffic.
Device discovery: mDNS and SSDP
After the separation there is often a surprise: the smartphone no longer “sees” the smart TV, the printer or the speakers. The reason is technical. Many devices announce themselves with two discovery protocols that use local multicast:
- mDNS (RFC 6762, with DNS-SD, RFC 6763): address 224.0.0.251, UDP port 5353, used by AirPlay, Chromecast, printers and many others;
- SSDP, part of UPnP: address 239.255.255.250, UDP port 1900, used by many smart TVs and media players.
These messages stay within their own layer 2 segment, and the firewall does not route them from one VLAN to another. From a security point of view this is a good thing: the LAN does not receive the IoT devices' announcements, and vice versa.
When it is really needed, for example to cast from the smartphone to the TV, there are two ways. The simplest is to keep the devices that must see each other on the same network, if the risk is acceptable. The alternative is an mDNS reflector on the firewall, which repeats announcements between the chosen VLANs: OPNsense has a dedicated plugin, and other tools also repeat SSDP; names and availability depend on the version. The reflector makes announcements visible, but the actual traffic goes through the firewall: you need rules that allow the LAN to open connections to the TV only on the ports needed. Never the other way round.
UPnP disabled
UPnP IGD (Internet Gateway Device), like the NAT-PMP (RFC 6886) and PCP (RFC 6887) protocols, allows a device on the network to ask the router to open a port towards the Internet. For a games console it is convenient; for a camera it means publishing itself on the Internet, without anyone deciding to. Many home routers have it enabled out of the box. In OPNsense, UPnP is a separate plugin and is not active unless you install and configure it.
The rule is simple: UPnP disabled on the firewall and, where possible, on the devices too. Ports towards the Internet are opened by hand, only when needed, as described in the article on NAT and port forwarding. For cameras the right answer remains the VPN.
Updates, passwords and inventory
A separate network limits the damage, but it does not prevent it. Three habits remain essential:
- change the default passwords on first start-up, with a different password for each device, and disable unused services, such as Telnet, the P2P cloud or the device's own UPnP;
- update the firmware from the manufacturer's website or app, checking every few months; a device that no longer receives updates should be replaced or isolated even further;
- keep an inventory, with a DHCP reservation for each device, so that an IP address always identifies the same device in the rules and in the logs.
A few columns are enough for the inventory: name, MAC address, IP address, VLAN, firmware version, date of the last check, end of support declared by the manufacturer and need for Internet access. A spreadsheet will do, or the descriptions of the DHCP reservations, for example “NVR, firmware updated on 15/10, no Internet access”.
Example with OPNsense and a managed switch
Let us go back to the network in Figure 1: an OPNsense firewall, an 8-port managed PoE switch, an access point with the “IoT” SSID. Menu names are indicative: they may vary with the version of OPNsense and with the switch model.
- VLANs: in Interfaces › Devices › VLAN (in older versions Interfaces › Other Types › VLAN) create VLANs 10, 40 and 50 on the physical interface connected to the switch.
- Interfaces: in Interfaces › Assignments assign them as LAN, CAMERAS and IOT, with the addresses 192.168.10.1/24, 192.168.40.1/24 and 192.168.50.1/24.
- DHCP: a range for each network and a reservation for each IoT device; as DNS and NTP server, the firewall's address in the same network.
- Services: the DNS resolver (Unbound) and the NTP service listening on the CAMERAS and IOT interfaces too.
- Aliases: in Firewall › Aliases create NVR (host 192.168.40.10), HUB_IOT (host 192.168.50.5), IOT_CLOUD (the IoT hosts that really need the Internet) and PRIVATE_NETS (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). Aliases keep the rules readable, as explained in the article on aliases in OPNsense.
- Rules: the ones below, interface by interface.
Firewall › Rules › IOT (evaluation order: top down)
# Action Proto Source Destination Port Description
1 Pass TCP/UDP IOT net IOT address 53 firewall DNS
2 Pass UDP IOT net IOT address 123 firewall NTP
3 Block any IOT net This Firewall any no management
4 Block any IOT net PRIVATE_NETS any no internal networks
5 Pass TCP IOT_CLOUD any 443 Internet only where needed
(everything else: blocked by the default rule)
Firewall › Rules › CAMERAS
1 Pass TCP/UDP CAMERAS net CAMERAS address 53 firewall DNS
2 Pass UDP CAMERAS net CAMERAS address 123 firewall NTP
(no other rules: LAN and Internet blocked)
Firewall › Rules › LAN (above the rule that allows the Internet)
1 Pass TCP LAN net NVR 443 NVR web interface
2 Pass TCP LAN net HUB_IOT 443 home automation panel
3 Block any LAN net CAMERAS net any the rest of the cameras
4 Block any LAN net IOT net any the rest of IoT
5 Pass any LAN net any any Internet
New interfaces in OPNsense have no rules, so they block everything until rules are added: CAMERAS and IOT start closed. Explicit block rules can be added at the bottom, towards the LAN and towards the Internet, with logging enabled: that way the attempts show up in the logs. If a device in the IOT_CLOUD list does not work with port 443 alone, the firewall log shows what is being blocked, and you add only what is needed. On the switch the ports are configured as follows:
| Switch port | Connected to | Mode | VLAN | PoE |
|---|---|---|---|---|
| 1 | PC | access | 10 untagged | no |
| 2 | Access point | trunk | 10 untagged (management); 50 tagged | yes |
| 3 | NVR | access | 40 untagged | no |
| 6 and 7 | Cameras | access | 40 untagged | yes |
| 8 | Firewall | trunk | 10, 40 and 50 tagged | no |
Management of the switch and the access point stays in the LAN, or better in a dedicated management VLAN, never in the IoT and camera VLANs. Unused ports are disabled.
To verify, connect a laptop to a VLAN 40 port in place of a camera and try to reach the PC and the Internet:
C:\> ipconfig
IPv4 Address. . . . . . . . . . . : 192.168.40.50
Default Gateway . . . . . . . . . : 192.168.40.1
C:\> ping -n 2 192.168.10.20
Pinging 192.168.10.20 with 32 bytes of data:
Request timed out.
Request timed out.
C:\> ping -n 2 www.example.com
Pinging www.example.com [192.0.2.80] with 32 bytes of data:
Request timed out.
Request timed out.
The name is resolved by the firewall's DNS, but neither the PC nor the Internet answers: this is the intended behaviour. Then, from the PC in the LAN, check that the NVR answers on port 443 and not on the others:
PS C:\> Test-NetConnection 192.168.40.10 -Port 443 | Select-Object RemotePort, TcpTestSucceeded
RemotePort TcpTestSucceeded
---------- ----------------
443 True
PS C:\> Test-NetConnection 192.168.40.10 -Port 23 | Select-Object RemotePort, TcpTestSucceeded
WARNING: TCP connect to (192.168.40.10 : 23) failed
WARNING: Ping to 192.168.40.10 failed with status: TimedOut
RemotePort TcpTestSucceeded
---------- ----------------
23 False
If logging is enabled on the block rules, the attempts appear in Firewall › Log Files › Live View. It is worth looking at it for a few days after commissioning: you often discover that a device tries to connect to unexpected services.
Common mistakes
- VLANs without rules: the networks are separated on the switch, but the firewall has an “any → any” rule copied from the LAN, and the IoT devices reach the PCs again.
- Cameras in the IoT VLAN, with Internet access: precisely the most sensitive devices talk to the outside world.
- Discovery exceptions that are too broad: to make casting work, “IoT → LAN any” is allowed, cancelling the separation.
- UPnP enabled on the router or the firewall: the camera opens a port on the Internet by itself.
- Port forwarding to the NVR to view it from outside, instead of a VPN.
- Switch or AP management in the IoT VLAN: a compromised device reaches the administration page of the network equipment.
- Factory passwords and firmware never updated, in the belief that the VLAN is enough on its own.
- No inventory: after a year nobody knows what the address 192.168.50.37 is any more.
Conclusions
An IoT device is a computer that does not update itself and whose software you do not control. Isolating it does not make it secure, but it prevents one of its flaws from becoming a problem for the whole network. In practice:
- create an IoT VLAN with a dedicated SSID and a separate VLAN for cameras and the NVR;
- on the firewall, deny IoT → LAN, allow the Internet only to the devices that need it, and close the Internet to the cameras;
- allow from the LAN only the ports needed, for example the NVR on port 443;
- provide DNS and NTP from the firewall to all networks;
- disable UPnP and use a VPN for remote access;
- enable an mDNS reflector only when needed, and only between the VLANs concerned;
- change the passwords, update the firmware and keep an inventory of the devices.
To study VLANs, firewall rules and OPNsense configuration in more depth with complete examples, the books and courses listed below are a useful next step.
The video
Further reading
- Book: LOCAL AREA NETWORKS (LAN) — Volume 3: Switching, VLANs, and Business Networks (English edition)
- Book: LOCAL AREA NETWORKS (LAN) — Volume 5: LAN Security and Integration (English edition)
- Book: OPNsense® in Practice — Volume 1: The Foundations of a Professional Journey (English edition)
- Video course: VLAN con OPNsense®: progettazione e configurazione (video course in Italian)
- Video course: Capire i Firewall con OPNsense (video course in Italian)
- Related article: VLANs: Why Separating Networks Improves Security and Organisation
- Related article: Guest Wi-Fi: How to Really Separate It from the Business Network
- Related article: How a Firewall Rule Works
- Related article: Stateful Firewalls: Why Replies Get Through Without a Rule
- Related article: Aliases in OPNsense: Clearer Firewall Rules That Are Easier to Maintain
- Related article: DNS: How a Name Becomes an IP Address
- Related article: PoE: Powering Access Points and Cameras over the Network Cable
- Related article: WireGuard VPN: Secure Access to the Office Network
- Related article: NAT and Port Forwarding: How a Private Network Talks to the Internet
- Specialization: Firewalls & Network Security
Technical sources
- IEEE 802.1Q — Bridges and Bridged Networks — VLANs and the 4-byte tag in the Ethernet frame, untagged access ports and trunk ports carrying several tagged VLANs.
- ETSI EN 303 645 — requisiti di base di sicurezza per i dispositivi IoT di consumo — Baseline requirements for consumer IoT devices: no universal default passwords, software updates, a declared support period, a reduced set of exposed services.
- RFC 6762 e RFC 6763 — Multicast DNS e DNS-Based Service Discovery; UPnP Device Architecture (SSDP) — mDNS on 224.0.0.251 and UDP port 5353, limited to the local link; SSDP on 239.255.255.250 and UDP port 1900 for UPnP device discovery.
- UPnP Internet Gateway Device, RFC 6886 (NAT-PMP) e RFC 6887 (PCP) — Protocols through which a device on the network asks the router to open ports towards the Internet without the administrator's involvement.
- RFC 5905 — Network Time Protocol Version 4; RFC 7826 — Real-Time Streaming Protocol 2.0 — NTP for the correct time on cameras and recordings; RTSP for video streams between cameras and the NVR.
- IEEE 802.3af e IEEE 802.3at — Power over Ethernet — Powering cameras and access points through the network cable, from the PoE switch.
- RFC 1918, RFC 5737 e RFC 2606 — Private networks 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, used in the examples and in the PRIVATE_NETS alias; 192.0.2.0/24, 203.0.113.0/24 and example.com reserved for documentation.
- Documentazione ufficiale di OPNsense — VLAN, Firewall Rules, Aliases, Unbound DNS, Network Time, plugin — Creating and assigning VLANs, per-interface rules evaluated top down, aliases, the DNS resolver and the NTP service, plugins for UPnP and for mDNS repetition; menus and options depend on the version.
Standards and official documentation available from the respective organisations.