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.
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
| Product | Used for | On Amazon |
|---|---|---|
| AVM FRITZ!Box 6690 Cable | Cable router (often rented from the provider) | Amazon Price on Amazon* |
| Mini PC | Firewall: mini PC with at least 2 Intel network ports, 8 GB RAM, SSD | any model |
| Netgear GS308E | Switch with VLAN support, 8 ports (2 in the example) | Amazon Price on Amazon* |
| TP-Link EAP720 | Wi-Fi access point with several networks | Amazon Price on Amazon* |
| PoE+ injector 802.3at | PoE+ injector (802.3at) if the switch provides no power | any model |
Server and DNS
| Product | Used for | On Amazon |
|---|---|---|
| Raspberry Pi 4 Model B | Small server for Pi-hole and monitoring | Amazon Price on Amazon* |
| Raspberry Pi 15W USB-C power supply | Official power supply for the Raspberry Pi 4 | Amazon Price on Amazon* |
| 2.5″ SSD + USB enclosure | SSD in a USB enclosure as storage for the Pi | any model |
| Synology NAS | NAS for data, Docker services and backups | any model |
| USB stick | USB stick of 4 GB or more as installation medium | any model |
Optional: smart home
| Product | Used for | On Amazon |
|---|---|---|
| SMLIGHT SLZB-06M | Zigbee coordinator with network port | Amazon Price on Amazon* |
| Homematic IP CCU3 | Hub for Homematic IP devices | Amazon 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.
| Network | VLAN | Address range | Who goes in | May reach |
|---|---|---|---|---|
| LAN | 1 | 192.168.1.0/24 | switches, access point, admin | everything (admin only) |
| MGMT | 10 | 192.168.10.0/24 | reserve | internet only |
| PRIVATE | 20 | 192.168.20.0/24 | computers, phones, printer | internet via VPN, own servers |
| SERVER | 30 | 192.168.30.0/24 | NAS, Pi-hole, Home Assistant | everything |
| IOT | 40 | 192.168.40.0/24 | TV, cameras, smart home | internet and DNS only |
| FAMILY | 50 | 192.168.50.0/24 | router of a second household | internet and DNS only |
| BACKUP | 60 | 192.168.60.0/24 | backup NAS | internet only |
| Remote access | – | 10.10.10.0/24 | phone and laptop on the go | everything |
- The firewall is .1 in every network, e.g. 192.168.40.1.
- Automatically assigned addresses are .100 to .199.
- Fixed addresses for servers and important devices are .2 to .99, always outside the automatic range.
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.
- Set up the router until the internet works. On a FRITZ!Box:
http://192.168.178.1. - Switch off the router's Wi-Fi. Wi-Fi will come from the access point.
- Connect the mini PC's first port (WAN) to a LAN port of the router.
- 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”.
- Only for remote access (step 10): set up dynamic DNS and a port forward of UDP 51820 to the mini PC.
- 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.
- Download the current image from opnsense.org (amd64, type “vga”) and write it to the USB stick with balenaEtcher.
- Boot the mini PC from the USB stick (usually F11 or F12 at power-on).
- Log in as
installer/opnsense, file system ZFS, target is the internal SSD. - Set a new root password and save it in your password manager right away. Reboot.
- In the console menu 1) Assign interfaces: WAN = port to the router, LAN = port to the switch.
- Connect a laptop by cable to LAN, open
https://192.168.1.1and run the wizard (hostname e.g.firewall, domaininternal). - 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):
- Interfaces → Devices → VLAN → +: parent = LAN port, tag
40, descriptionIOT. - Interfaces → Assignments: add the new VLAN.
- Open the new interface: tick “Enable interface”, name
IOT, static address192.168.40.1/24. - 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:
- U (untagged): a normal device is plugged in. It ends up in exactly one network.
- T (tagged): the port is an uplink (firewall, second switch, access point) and carries several networks with labels.
- PVID: the network a device without a label lands in on this port. Must match the U number.
- Open the switch interface, change the password, give it a fixed address in LAN (e.g.
192.168.1.2). - VLAN → 802.1Q → Advanced: enable “Advanced 802.1Q VLAN”.
- Create VLANs 10, 20, 30, 40, 50, 60 and set U or T for every port.
- Under PVID give every device port the matching number.
- 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.
- 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.
- Open its interface (the address is in the firewall's DHCP list), change the password.
- Wi-Fi 1: name, WPA2/WPA3 password, VLAN ID 20.
- 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.
- Services → Kea DHCP → Kea DHCPv4: enable, select all networks.
- Tab Subnets: one per network, e.g.
192.168.40.0/24, pool.100–.220. - Switch off “auto collect option data”. Enter by hand: gateway
192.168.40.1, DNS = both Pi-holes, domaininternal. - 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.
- Unbound on the firewall: enable Services → Unbound DNS, DNSSEC on, “use system nameservers” off.
- Install Pi-hole on the Raspberry Pi (one command, see pi-hole.net), fixed address in the SERVER network.
- A second Pi-hole on the NAS as a Docker container – if one fails, the other takes over.
- 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.
| Network | Allowed | Destination |
|---|---|---|
| IOT | DNS (TCP/UDP 53) | PIHOLES |
| IOT | everything | not OWN_NETWORKS (internet only) |
| PRIVATE | everything | OWN_NETWORKS (NAS, printer, smart home) |
| PRIVATE | everything | internet via VPN gateway (step 9) |
| SERVER | everything | any |
| FAMILY, BACKUP, MGMT | everything | not OWN_NETWORKS |
| Remote access | everything | any |
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.
- Get WireGuard credentials from your VPN provider.
- VPN → WireGuard: instance with “Disable routes”, peer with allowed IPs
0.0.0.0/0, keepalive 25. - Assign and enable it as an interface, create the gateway
VPN_GW, set outbound NAT to “Hybrid” with a rule for the tunnel. - In PRIVATE's internet rule choose
VPN_GWas gateway and set a tag, e.g.NO_WAN. - Kill switch: rule “block, WAN, outbound, tag matches NO_WAN” at the very top.
- 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.
- VPN → WireGuard → Instances: instance “Remote”, port
51820, tunnel address10.10.10.1/24, enable the interface. - WAN rule: allow UDP 51820 to the WAN address. Rule on the remote interface: allow everything.
- Use the peer generator to create a configuration per device: endpoint = dynamic DNS name, allowed IPs
0.0.0.0/0, DNS = Pi-holes. - 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.
- System → Trust → Authorities: internal CA “Home CA”, 10 years.
- System → Trust → Certificates: server certificate, valid 825 days at most, add every address you use to reach the device as an alternative name.
- Select it in the firewall under System → Settings → Administration; export it for the NAS and other devices and import it there.
- 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.
- 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 - Add monitors: ping for firewall and NAS, a DNS lookup for both Pi-holes, a ping to
1.1.1.1for the internet. - 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.
- Firewall: System → Configuration → Backups – after every change.
- Pi-hole: Settings → Teleporter → Export.
- Switches: save the configuration or take screenshots of the VLAN pages.
- Data: daily to a second NAS. If it only runs at night (e.g. 01:50–06:00), that saves power and malware cannot reach the backup during the day.
Final check
- All networks “up” in the firewall.
- A phone on the private Wi-Fi gets an address from 192.168.20.100–199.
- Ads are blocked, even with one Pi-hole switched off.
- The IoT Wi-Fi cannot reach the NAS.
- The private network goes through the VPN provider, the kill switch works.
- Remote access over mobile data works.
- No certificate warnings.
- Monitoring green, test message received.
- Current backup stored in two places.
When something doesn't work
| What you see | Cause | Fix |
|---|---|---|
| A whole network without internet | U and T mixed up on the switch | check the VLAN table port by port |
| Rules have no effect | interface not enabled | tick “Enable interface” |
| Two devices fail in turns | duplicate fixed address | check the list, move one |
| Private Wi-Fi without internet | VPN tunnel down, kill switch active | check WireGuard status, restart |
| VPN exception has no effect | rule is below the VPN rule | move the exception up |
| App says “no internet” | Pi-hole blocks an address | check the log, allow it in both |
| TV apps hang | TV stuck on the network | unplug for 30 seconds, connect by cable |
| Certificate warning on one address | address missing in the certificate | reissue with all addresses |
Golden rules for changes
- Back up first – every time.
- Change one thing at a time and test afterwards.
- Fixed addresses only outside the DHCP ranges.
- When a device moves, update every place that knows its address.
- Uplinks: all VLANs except 1 tagged.
- New interface: tick “enable”.
- Write every change into your overview straight away.
Last updated: November 2026