It's Time to learn networking properly

AI Disclosure:
I’ll probably use deepseek in one form or another to help me break down jargon and verbage, but that’s likely it. I enjoy the hands on approach to homelab.


project start

I have a rats nest of networking I realized I don’t understand the intricacies of, nor how to setup, secure, or manage properly. I’m going to demystify this one piece at a time, and build a more secure, functional, and managed network as a result, ideally repurposing the hardware I already own.

I have a ton going on, so let’s break this down by location

Location A: My house

  • Unifi UDM pro as router/firewall/VPN node. Connects site to site VPN to other locations, serves DNS, and routes all services to the servers in my rack.
  • Intel Nuc (Shafer Canyon) Active node for tailscale connections from mobile devices while abroad.

Location B: Parent’s house

  • Unifi gateway ultra as router/firewall/dhcp, connected via site-to-site to my udm pro.
  • Raspi 3 as DNS

Location C: In-laws House

  • Unifi gateway ultra as router/firewall/dhcp, connected via site to site to my udm pro.

The complications arise when we get to VPN, VLAN, and access.

The goals here:

  1. All external bound traffic goes out via VPN through Mullvad
  2. All traffic to my house is from approved clients on “Secure” VLANs
  3. All clients assigned to VLANs with only as much access as they need.
  4. Adblock network wide
  5. no unnecessary traffic from other sites routed through my house.
  6. Fully vet all firewall rules and understand why each is in place.

Additional Goals added mid-Project:

  1. Change port forwarding behavior for game server to tailscale user access to shared node.
  2. Move Site to site from Unifi’s proprietary control plane(Site-magic) to console based site-to-site
  3. Setup Offsite Backup in container lab and properly secure entire backup data path through network.
  4. Move the cluster monitoring stack OUT of the cluster itself.
8 Likes

First Progress update. Sat down tonight and walked through all my existing firewall and traffic rules, and adjusted all settings I could for privacy and security first. This included:

  • running encrypted DNS to Quad9 rather than my ISP
  • ensuring UPnP is off.
  • double checking IPS was on for all networks

I now have an audit doc of all existing rules, devices and IP’s, port forwards, and DNS directories.

The next step tomorrow will be pruning old, outdated, or deprecated rules, profiles, etc.

No changes yet to the two remote sites, just focusing on my local Router first.

Things I learned today:

  • UPnP(Universal Plug and Play): a seemingly well intentioned protocol that allows devices to request the router open a port for them without user involvement, which could obviously be easily taken advantage of by malware or malicious devices.
  • IPS( intrusion prevention system): essentially traffic inspection against a large database of known attacks. Fails when attack is novel in nature, or through encrypted traffic which cannot be inspected.
  • ISPs have so many methods of data collection. Like Wendell says “the average person has no idea the scale of the machinations against them”.
3 Likes

One thing to watch with all traffic going out through Mullvad: the site-to-site tunnels to your parents’ and in-laws’ places should stay outside it. If the VPN route grabs that traffic too, the links break in weird ways, so I’d set up the exceptions for those subnets first.

2 Likes

You should look into a software package called GNS3. It won’t help you emulate the UniFi systems but it does help with setting up networks and testing out different software and configurations. You can setup routers in VMs then build out a network with containers to test out VLANs and WAN type stuff.

4 Likes

This was one of my concerns, and why Im leaving the mullvad exit for last. Thanks for the pointer, should be able to get those rules in place shortly and test. Last thing I need is the In-Laws internet not working

1 Like

Progress update:

Finished the audit of existing rules, routes, and the Router/firewall devices. Found a ton of mostly minor issues, and am already feeling much better about my security posture.

firstly: Set up Unifi to be as strict as I could, same settings are setup as yesterday, and mirrored it to the gateways at both other sites. Removed the Pihole device from my parents place, replaced with Unifi handling local DNS and adblocking for consistency.

secondly: my subnets were a mess. My network has a bunch for IOT, cameras, servers, guest, untrusted, etc. My in laws is neatly divided into Default, guest, and secure (which is allowed access to the site to site connection), and my parents place just has default. Plan is to set theirs up to mirror the in-laws place for easier management, although they have a lot more devices to be allowed into the site to site connection, whereas the in laws is just a single Apple TV that has access to Jellyfin.

third: revised the ACL in tailscale to better fit our use case, deny all by default so access has to be permitted for each connection and user/tag, and now I’m ready to add more users and devices in future. Was cool to learn how easily configured that is. Also setup tailnet lock so even if tailscale is compromised theres no way a node can be added without my knowledge.

Things I learned today:

ACL (Access control lists): functions like a whitelist for permissions, traffic doesnt match the rules in the ACL is isnt permitted. Both the Unifi traffic rules and tailscales “grants” function in this way.

Clean your old rules out when you re-layout things. old VLANs, allows, blocks, groups, etc. There were so many rules I thought I had working that were referencing dead IP’s, and VLANs that no longer exist.

4 Likes

Since you’re redoing your parents’ subnets anyway, it’s a good moment to make sure none of the three sites share the same ranges. Site-to-site gets really confusing when two networks on different ends are both the default 192.168.1.0/24.

it turns out not only was there overlap, there was 3x overlap. But not too bad since it was wireguard VPN clients pool on 192.168.3.X for both my parents and my network, and the secure network for the in laws, so two empty pools most of the time now were using tailscale for remote access. Got that fixed pronto so everything is unique now.

Once you remove allow all in tailscale, it’s all deny by default. Grants are easy to setup, just create your groups or tags and grant permissions accordingly per asset or groups of assets. The documentation is pretty easy to understand.

Key to secure networking is network isolation and segmentation with block all rules with exclusions.

You can have more than one filter tech in place, though it makes it a bit more troublesome to troubleshoot. i.e. Unify and pihole can work hand in hand. You’re basically treating security as layers of defense, but that’s up to you for unification and simplicity.

2 Likes

Since tailscale took over remote access, it’s worth also removing the old wireguard configs and closing their port on the routers. An open VPN port that nobody uses anymore is an easy one to forget about.

2 Likes

Free CCNA…

Here’s this mornings update:

As suggested by others, the old wireguard VPNs are all gone. Both my parents and in laws places now follow the same subnet layout:

  • Secure: Has access to site to site, can initiate to IoT VLAN, has internet.
  • IoT: no access to site to site, cannot initiate to Secure ,no internet.
  • Guest: no access to either other network at all, has internet.

tested all blocks to make sure they work and the networks are now properly segmented. All other pre-existing rules, VLANs, and VPN setups are gone. (Except S2S)

Here at my place I added an admin subnet to further separate servers from client devices. The network now exists as

  • Muir(Servers, Tailscale node) Internet access, cannot initiate to Pinchot or Mather.
  • Roosevelt(IoT) No internet, Cannot Initiate to Muir, Pinchot, or Mather.
  • Pinchot(Cameras, NVR)No internet, Cannot Initiate to Muir, Roosevelt, or Mather.
  • Mather(Admin)Internet access, Full access to Muir, Pinchot, and Roosevelt.
  • Junior Rangers(Guest)Internet access, No interaction with any other subnet.

yes I have my VLANs named for conservationists, and my machines for national parks. I used to be outdoors a lot more.

I advertise both Muir and Pinchot on tailscale, and its host machine (Shafer Canyon) has an explicit access to the Pinchot network to facilitate that from Muir. However I only grant access to Pinchot for My partner and my devices in the “Household” group. When I add my parents devices they will be in a separate group on separate users that only has access to Muir. Tailscale ACLs are super friendly to setup.

I verified that I can access services and cameras remotely via tailscale, even through its across VLANs the Protect app still works! big win.

On an additional note, I have a small lab in a shipping container at the in laws place, I am hoping to set it up as an offsite backup target for both my NAS, as well as the one at my parents that backs up their devices. The hardware to do that arrives this weekend so I will add that to the list, and having a neat network before we begin is a great help.

Suggest to learn the OSI/Internet models of networking so you understand the concepts of layer 1-4, will really help you understand what’s going on and why with the network stack.

1 Like

Update!

Ensured all networks have DCHP guarding enabled, static IPs for anything that matters, and setup the tailscale grants for my parents devices to only point at the couple IPs they would actually need rather than an entire subnet.

Also got keepassXC setup for TOTP for my github login to further secure the tailnet.

Next steps are to do a bit of housekeeping on the in laws and my parents networks, and get my parents added to tailscale.

Things we learned today:

DCHP guarding: when a device joins a network it announces that it needs an IP from a dhcp host. Malicious or malfunctioning machines can interpose themselves into thst role over the intended host. This sets up trusted IP to allow DCHP from.

1 Like

Weekend-end update!

We are at the in laws place today so I took a break from software to get internet run to my container lab. The property is shale boulders in many places beneath the topsoil so trenching was simply not an option. That left a 300ft gap between my container and the house.

Unifi to the rescue! A single device bridge pro has taken care of that issue neatly for a resonable price (especially compared to trenching). Since I already have power in the container I got a PoE switch out there to provide PoE to the device bridge, ran it through a surge protector and a small hole out to the device bridge itself, and 5 minutes of tinkering with the orientation I now have reliable and sufficient internet in the container.

Was able to reuse an Asus Nighthawk router in AP mode to broadcast a wifi network for the container itself, so devices inside can be separate from nearby devices I dont wish them to share with. With that taken care of, an offsite backup server can now be assembled here!

I also ran the PoE runs for the cameras inside the container, still debating outside placement but theres plenty of PoE ports left on this switch. Going to see if I can get unifi protect to work across sites, and if not, give Frigate another test for the container camera system. I’m not expecting burglars here, but I’d like to see some cool night time critters.

Went through and did more network tidying at this point, labelled and assigned static IP’s to consistent devices, tested the in laws Jellyfin connection (very important) and made sure I had the ports and cabling to run a second AppleTV for them this christmas so they can watch Jellyfin in the bedroom as well as living room.

The DCHP guarding lesson was right on time, as the Asus router predictably tried to assume 192.168.1.1 and had to be reset, joined, and lobotomized into an AP.

Next steps will be figuring out how to have VLAN traffic for some of the devices over the bridge (servers, backup NAS, cameras) but also allow default network traffic so I can run another AP from there to father in laws shop next door.

1 Like

Good push to learn the stack. For gaming latency specifically: measure in-game RTT on Ethernet, separate bufferbloat from path RTT (Waveform), and only then experiment with tunnels — a VPN often adds hops unless traceroute shows a bad ISP path.Good push to learn the stack. For gaming latency specifically: measure in-game RTT on Ethernet, separate bufferbloat from path RTT (Waveform), and only then experiment with tunnels — a VPN often adds hops unless traceroute shows a bad ISP path.

1 Like

Update!

I got the Exit node setup properly today. I won’t go into details on my suffering but I forgot that I had “Use Tailscale DNS” unchecked and spent multiple hours troubleshooting why it wouldn’t resolve with the exit node enabled. Gotta love DNS.

No more choosing between encrypted egress traffic (mullvad) and access to home services (tailscale) when abroad, now I can have both all the time.

Setup using a container stack of Gluetun and Tailscale, with Quad9 as DNS resolver.

While my original plan included the server egress traffic exiting via mullvad, in hindsight that seems unnecessary. cleint devices with actual web traffic make sense, but the servers only ever fetch container images, and most dont even have internet access, so i scaled back the scope of the exit tunnel significantly.

I also had to solve some Casting nonsense. mDNS is the magic I was looking for. We have an apple TV we use to watch jellyfin and cast music/shows to, and its on the IoT VLAN with no internet. Had to enable mDNS proxy in Unifi, then also allow the Apple TV to the IP of the Jellyfin server on the server VLAN, and the Phones. This works because Unifi has the gateway listen for mDNS broadcasts from the IoT VLAN, then transmits them on the client device VLAN, and allows the phones to discover it via that allow rule.

Something else I stumbled upon through spending more time through tailscale and trying to embody Wendell’s excitement for it, was a solution to game servers.

Currently the only hole in my firewall is the port forwards to specific user IP’s with a route to the machine that hosts minecraft/valheim/other game servers. Most have static IP’s but that has always felt a bit unsafe to me.

I learned about Tailscale Shared Nodes today, and this makes a perfect use case. Rather than add 10+ users to my tailnet, pushing me into their paid commercial tier, and giving my friend more access than I’d like to my devices, I can instead share the game server as a node to their specific user outside my tailnet. Limit users to a specific game based port as well and its even further locked down. SInce it’s on its own individual VLAN by itself, if somehow someones tailscale was compromised and my hosting software was also compromised the blast radius is severely reduced, and I can close those port forward holes permanently.

Things I learned today:

mDNS: Multicast DNS, sends a query as a multicast packet to a group address so all devices in a network can answer, rather than querying a DNS server. Similar to Bonjour in function. Direct traffic is referred to as “Unicast” and is how the stream goes from the phone to the Apple TV post-discovery.

IGMP: Internet group management protocol: how a host tells the network they wish to receive multicast traffic from a group. IGMP snooping utilizes this to send multicast traffic only to those who request it, rather than flood the VLAN with it.

DNS-SD: DNS service discovery. works hand in hand with mDNS to define the queries that can be asked. iE: Airplay, googlecast, etc.

2 Likes

Update! Today I’m going to try and tackle the site to site link. Ive been avoiding it because of percieved complexity, but this whole project is about unmasking that.

When I initially set this up, i used Unifi site manager vis their website becuase my ISP does not provide a static WAN for less than $200 a month. Unifi site magic resolved this, and I was able to link both other sites to mine as the hub.

However, as many of you may note, doing site magic via site manager requires the remote access to be enabled for all gateways. This is a huge hole into my networks and while I like Unifi’s hardware, I don’t trust them to not crack under the assault of AI driven hacking and pen testing. I would prefer to be the sole holder of the keys to the kingdom.

So we’re going to do the site to site the “old fashioned” way. DDNS on my WAN, and the built in site to site vpn functions in the gateways, and after testing, disable remote access, and end site manager for good.

The other thing we can test is since my parents and Inlaws both have static WAN, my gateway can reach out to them to establish site to site, rather than them reaching out to me.

1 Like

Update: Got some bug this week, and have been unable to think enough to make any measurable progress. That said, I was able to think enough to add some stretch goals if I manage to accomplish Everything else. I will edit the initial post and add them, but I’m realizing having the monitoring stack (uptime kuma, grafana, ntfy) running in the k3s cluster with everything else is a serious complication. So they need to be migrated to a standalone device to observe the cluster from outside.

Other stretch goal is now that I have network connectivity to the container lab, and it can host an offsite backup target of some kind, I need to branch out from synology. I have some old spare desktop hardware so I think the best move here is build a machine of spare parts, setup either TrueNAS or Unraid and get a bit of experience outside synology-world. Given the other offsite to the Synology NAS at my parents place, this unit can be a bit more experimental without compromising data protection.