Earl Woodhead← Home

Home network with separate networks – step by step

This guide builds a home network in which every group of devices has its own network and a firewall controls every path between them. It is written for beginners and based on a real, running setup.

All names, addresses and credentials are examples. Replace them with your own. Menu names follow the English OPNsense interface.

At a glance

The cable router now only provides internet. The firewall behind it splits it into separate networks, sends the private network through a VPN provider and lets your phone in from anywhere. The switches only carry the networks; every path from one network to another goes through the firewall.

Every path between networks goes through the firewallInternetCable routerWi-Fi off · UDP 51820 openFirewall (OPNsense)Rules, DHCP, DNS, certificatesGateway .1 in every networkVPN providerExit for PRIVATE, kill switchPhone on the goWireGuard via internetVLAN switchesUplinks tagged (T)Separate networks (VLANs), device ports untagged (U)LAN · 1Admin, switchesPRIVATE · 20Phones, PCs, printerSERVER · 30NAS, Pi-hole, serversIOT · 40internet + DNS onlyFAMILY · 50second householdBACKUP · 60backup NASMGMT · 10reserveAccess pointWi-Fi in PRIVATE + IOT

Think of a house with rooms: every network is a room and the firewall is the doorkeeper in the hallway. An insecure camera in the “IOT” room cannot reach your laptop in the “PRIVATE” room.

What you need

Plan two weekends for the basic setup and a third one for VPN, monitoring and backups. The products with an Amazon button are exactly the models used in the example setup.

Network

ProductUsed forOn Amazon
AVM FRITZ!Box 6690 CableCable router (often rented from the provider)Amazon Price on Amazon*
Mini PCFirewall: mini PC with at least 2 Intel network ports, 8 GB RAM, SSDany model
Netgear GS308ESwitch with VLAN support, 8 ports (2 in the example)Amazon Price on Amazon*
TP-Link EAP720Wi-Fi access point with several networksAmazon Price on Amazon*
PoE+ injector 802.3atPoE+ injector (802.3at) if the switch provides no powerany model

Server and DNS

ProductUsed forOn Amazon
Raspberry Pi 4 Model BSmall server for Pi-hole and monitoringAmazon Price on Amazon*
Raspberry Pi 15W USB-C power supplyOfficial power supply for the Raspberry Pi 4Amazon Price on Amazon*
2.5″ SSD + USB enclosureSSD in a USB enclosure as storage for the Piany model
Synology NASNAS for data, Docker services and backupsany model
USB stickUSB stick of 4 GB or more as installation mediumany model

Optional: smart home

ProductUsed forOn Amazon
SMLIGHT SLZB-06MZigbee coordinator with network portAmazon Price on Amazon*
Homematic IP CCU3Hub for Homematic IP devicesAmazon Price on Amazon*

Free software: OPNsense (opnsense.org), Pi-hole (pi-hole.net), Uptime Kuma, the WireGuard app, balenaEtcher. Plus a password manager of your choice.

* Affiliate link: As an Amazon Associate I earn from qualifying purchases. The price stays the same for you. Prices are only shown on Amazon on purpose, because they change daily. Links lead to Amazon Germany (amazon.de).

Planning the networks

Every group of devices gets its own network. The network number (VLAN) is the third number of the address, so you can tell at a glance where a device belongs.

NetworkVLANAddress rangeWho goes inMay reach
LAN1192.168.1.0/24switches, access point, admineverything (admin only)
MGMT10192.168.10.0/24reserveinternet only
PRIVATE20192.168.20.0/24computers, phones, printerinternet via VPN, own servers
SERVER30192.168.30.0/24NAS, Pi-hole, Home Assistanteverything
IOT40192.168.40.0/24TV, cameras, smart homeinternet and DNS only
FAMILY50192.168.50.0/24router of a second householdinternet and DNS only
BACKUP60192.168.60.0/24backup NASinternet only
Remote access–10.10.10.0/24phone and laptop on the goeverything

Keep a list of fixed addresses and check it before assigning a new one. In the example setup two devices once had the same address – both stopped working.

Step 1: Prepare the cable router

The provider's router is reduced to “modem with internet”. Many rented routers have no bridge mode; then you have two routers in a row (“double NAT”). That works fine.

  1. Set up the router until the internet works. On a FRITZ!Box: http://192.168.178.1.
  2. Switch off the router's Wi-Fi. Wi-Fi will come from the access point.
  3. Connect the mini PC's first port (WAN) to a LAN port of the router.
  4. Give the mini PC a fixed address in the router. FRITZ!Box: Home Network → Network → edit device → “Always assign this device the same IPv4 address”.
  5. Only for remote access (step 10): set up dynamic DNS and a port forward of UDP 51820 to the mini PC.
  6. Leave off: exposed host, UPnP forwarding, access to the router from the internet.

Also create a WireGuard access in the router for your phone. It ends before the firewall and is your emergency access if the firewall ever fails.

Step 2: Install the OPNsense firewall

OPNsense turns the mini PC into a firewall with a web interface. Installation takes about 30 minutes.

  1. Download the current image from opnsense.org (amd64, type “vga”) and write it to the USB stick with balenaEtcher.
  2. Boot the mini PC from the USB stick (usually F11 or F12 at power-on).
  3. Log in as installer / opnsense, file system ZFS, target is the internal SSD.
  4. Set a new root password and save it in your password manager right away. Reboot.
  5. In the console menu 1) Assign interfaces: WAN = port to the router, LAN = port to the switch.
  6. Connect a laptop by cable to LAN, open https://192.168.1.1 and run the wizard (hostname e.g. firewall, domain internal).
  7. System → Firmware → Updates: install everything. Then download a backup straight away.

It worked if the laptop on the LAN port reaches the internet and Interfaces → Overview shows WAN and LAN as “up”.

Step 3: Create the networks (VLANs)

A VLAN is a separate network that runs over the same cables as the others. Every data packet carries an invisible label with the network number. Example for IOT (VLAN 40):

  1. Interfaces → Devices → VLAN → +: parent = LAN port, tag 40, description IOT.
  2. Interfaces → Assignments: add the new VLAN.
  3. Open the new interface: tick “Enable interface”, name IOT, static address 192.168.40.1/24.
  4. Save, apply changes. Repeat for every other network.

Without “Enable interface” none of the rules will work later. This is the most common beginner's mistake.

Step 4: Set up the switches

The switch decides per port which network arrives there. This is where most mistakes happen, so take your time:

Device ports carry one network, uplinks carry allSwitch, media cabinetU1U2U3U4U5U6T7T8Switch, deskU1U2U3U4U5U6T7T8Uplink: VLAN 1 U, all others TPort 8 → firewallPort 8 → access pointColour = network (VLAN), U = device port, T = uplink1 LAN20 PRIVATE30 SERVER40 IOT50 FAMILY60 BACKUP
  1. Open the switch interface, change the password, give it a fixed address in LAN (e.g. 192.168.1.2).
  2. VLAN → 802.1Q → Advanced: enable “Advanced 802.1Q VLAN”.
  3. Create VLANs 10, 20, 30, 40, 50, 60 and set U or T for every port.
  4. Under PVID give every device port the matching number.
  5. Only at the very end move the uplink to the firewall.

Rule of thumb: uplinks = VLAN 1 untagged, all others tagged. Device ports = exactly one VLAN untagged. A single wrong box takes down a whole network.

Step 5: Wi-Fi with two networks

An access point broadcasts several Wi-Fi names at once, and each name ends up in a different network.

One access point, two Wi-Fi names, two separate networksSwitch1 U · 20 T · 40 TAccess pointWi-Fi “Home” · 5 GHzWi-Fi “Home-IoT” · 2.4 GHzPRIVATE · 20phones, laptopsIOT · 40cameras, plugs
  1. Connect the access point to a switch port with 1 U, 20 T, 40 T. Power it with a PoE+ injector if the switch has no PoE.
  2. Open its interface (the address is in the firewall's DHCP list), change the password.
  3. Wi-Fi 1: name, WPA2/WPA3 password, VLAN ID 20.
  4. Wi-Fi 2: name, password, VLAN ID 40, 2.4 GHz only.

Use the same names and passwords as your old Wi-Fi. Then all devices move over by themselves. For AirPlay and printers across networks install the OPNsense plugin mDNS repeater.

Step 6: Hand out addresses

The DHCP service gives every device its address, gateway and DNS server automatically. In OPNsense it is called Kea DHCP.

  1. Services → Kea DHCP → Kea DHCPv4: enable, select all networks.
  2. Tab Subnets: one per network, e.g. 192.168.40.0/24, pool .100–.220.
  3. Switch off “auto collect option data”. Enter by hand: gateway 192.168.40.1, DNS = both Pi-holes, domain internal.
  4. Tab Reservations: MAC address and desired address for every device with a fixed address.

You find MAC addresses under Services → Kea DHCP → Leases. On phones set the “private Wi-Fi address” for your own Wi-Fi to fixed.

Step 7: DNS with ad blocking

All devices first ask the ad blocker Pi-hole, Pi-hole asks the firewall, and the firewall resolves names itself – without Google, Cloudflare or your provider.

Every name lookup passes through the ad blockerDeviceasks: example.com?2 × Pi-holeblocks adsUnbound (firewall)resolves itself, DNSSECInternetAds, trackers → blocked
  1. Unbound on the firewall: enable Services → Unbound DNS, DNSSEC on, “use system nameservers” off.
  2. Install Pi-hole on the Raspberry Pi (one command, see pi-hole.net), fixed address in the SERVER network.
  3. A second Pi-hole on the NAS as a Docker container – if one fails, the other takes over.
  4. In both Pi-holes: upstream only 192.168.30.1, “Permit all origins”, copy settings with Teleporter.

Never enter the Pi-hole as a forwarder in Unbound – they would ask each other in circles. Always change lists in both Pi-holes.

Step 8: Firewall rules

Principle: anything not allowed is forbidden. You only allow what each network needs. The firewall checks from top to bottom, and the first matching rule wins.

Aliases (Firewall → Aliases) keep rules readable: OWN_NETWORKS = 192.168.0.0/16, PIHOLES = both DNS servers, WORK_DEVICES = devices without VPN.

NetworkAllowedDestination
IOTDNS (TCP/UDP 53)PIHOLES
IOTeverythingnot OWN_NETWORKS (internet only)
PRIVATEeverythingOWN_NETWORKS (NAS, printer, smart home)
PRIVATEeverythinginternet via VPN gateway (step 9)
SERVEReverythingany
FAMILY, BACKUP, MGMTeverythingnot OWN_NETWORKS
Remote accesseverythingany

To create “internet only”: choose OWN_NETWORKS as destination and tick “Invert” – meaning “everything except my own networks”.

It worked if a phone on the IoT Wi-Fi reaches the internet but not the NAS.

Step 9: VPN provider with kill switch

All devices in the private network go online through a VPN provider, without an app on the devices. If the tunnel fails, they have no internet at all instead of surfing unprotected.

If the tunnel fails, PRIVATE has no internetNormal operationPRIVATE · 20FirewallGateway VPN_GWVPN tunnelWireGuardInternetTunnel downPRIVATE · 20Firewall✕ Kill switch blocks WANWork devices: direct, without VPN
  1. Get WireGuard credentials from your VPN provider.
  2. VPN → WireGuard: instance with “Disable routes”, peer with allowed IPs 0.0.0.0/0, keepalive 25.
  3. Assign and enable it as an interface, create the gateway VPN_GW, set outbound NAT to “Hybrid” with a rule for the tunnel.
  4. In PRIVATE's internet rule choose VPN_GW as gateway and set a tag, e.g. NO_WAN.
  5. Kill switch: rule “block, WAN, outbound, tag matches NO_WAN” at the very top.
  6. Put exceptions (work devices) above the VPN rule.

Test: “what is my IP” shows the VPN provider's address. Disable the peer briefly: the private network now has no internet.

Step 10: Into your home network from anywhere

With WireGuard your phone is in your home network on the go as if you were at home – encrypted, and without any service exposed to the internet.

Encrypted into your home network from anywherePhonemobile dataInternetWireGuardCable routerUDP 51820Firewall10.10.10.1Home networkNAS, smart home
  1. VPN → WireGuard → Instances: instance “Remote”, port 51820, tunnel address 10.10.10.1/24, enable the interface.
  2. WAN rule: allow UDP 51820 to the WAN address. Rule on the remote interface: allow everything.
  3. Use the peer generator to create a configuration per device: endpoint = dynamic DNS name, allowed IPs 0.0.0.0/0, DNS = Pi-holes.
  4. Scan the QR code with the WireGuard app and enable “On demand” (on for mobile data and foreign Wi-Fi).

QR codes and keys are like house keys: never share them as screenshots or in chats. And never expose your NAS or smart home directly with a port forward.

Step 11: Your own certificates

With your own certificate authority the security warnings of the web interfaces disappear.

  1. System → Trust → Authorities: internal CA “Home CA”, 10 years.
  2. System → Trust → Certificates: server certificate, valid 825 days at most, add every address you use to reach the device as an alternative name.
  3. Select it in the firewall under System → Settings → Administration; export it for the NAS and other devices and import it there.
  4. Install the CA certificate on all your own devices and trust it (iPhone: also General → About → Certificate Trust Settings).

Step 12: Monitoring

A watchdog checks around the clock that everything is running and sends a message to your phone when something fails.

  1. Install Docker on the Raspberry Pi and start Uptime Kuma: docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data louislam/uptime-kuma:2
  2. Add monitors: ping for firewall and NAS, a DNS lookup for both Pi-holes, a ping to 1.1.1.1 for the internet.
  3. Notifications via the ntfy app with a long, random topic name.

A second watchdog on a small server on the internet also notices when power or internet fail at home – then the Pi itself cannot send anything.

Step 13: Backups

With just a few files the whole network can be rebuilt in an afternoon.

Final check

When something doesn't work

What you seeCauseFix
A whole network without internetU and T mixed up on the switchcheck the VLAN table port by port
Rules have no effectinterface not enabledtick “Enable interface”
Two devices fail in turnsduplicate fixed addresscheck the list, move one
Private Wi-Fi without internetVPN tunnel down, kill switch activecheck WireGuard status, restart
VPN exception has no effectrule is below the VPN rulemove the exception up
App says “no internet”Pi-hole blocks an addresscheck the log, allow it in both
TV apps hangTV stuck on the networkunplug for 30 seconds, connect by cable
Certificate warning on one addressaddress missing in the certificatereissue with all addresses

Golden rules for changes

  1. Back up first – every time.
  2. Change one thing at a time and test afterwards.
  3. Fixed addresses only outside the DHCP ranges.
  4. When a device moves, update every place that knows its address.
  5. Uplinks: all VLANs except 1 tagged.
  6. New interface: tick “enable”.
  7. Write every change into your overview straight away.

Last updated: November 2026