this post was submitted on 20 Aug 2023
71 points (92.8% liked)

Selfhosted

40201 readers
914 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I’m setting up DHCP reservations on my home network and came up with a simple schema to identify devices: .100 is for desktops, .200 for mobiles, .010 for my devices, .020 for my wife’s, and so on. Does anyone else use schemas like this? I’ve also got .local DNS names for each device, but having a consistent schema feels nice to be able to quickly identify devices by their IPs.

you are viewing a single comment's thread
view the rest of the comments
[–] Oisteink@feddit.nl 35 points 1 year ago (1 children)

TLDR; don’t reserve IP’s

We all did back in the 90’s. But this is kinda counter to the idea of dynamic leasing of IP addresses.
The only reason I see for reserving IP’s would be to do some based on cidr ranges (bad practice) or because you need some shitty software that only handle IP’s and not hostnames.

Just liberate yourself and get used to not having control over IP. It will prepare you for ipv6 where dynamic addresses are part of the spec.

Your local dns server should be set up to register devices on ip lease - something all dns servers I’ve worked with last 20 years can manage. With properly set ip search domains this means that you can reach your devices by hostname, or by fqdn if you’d want that.

Also note that .local is a special tld reserved for mdns/zeroconf. Do not set up your dns server to serve this. You’d be better off using something like .LAN - this means that mdns/zeroconf can co-exist nicely on your lan.

Regarding vlans: this is something completely different as this is level 2 in osi. Each vlan is like a separate network - there needs to be routing to reach one from the other. I would agree that vlans are nice when used properly - to section and separate devices. One vlan for IoT devices - to keep them out of your safe home network - is a fairly common thing. A separate vlan for servers, one for management perhaps, one for guest-network and one for your normal home devices.

I use 4 vlans at home each with a /16 network from the 10/8 range. And the only static (not reserved dhcp) that I use are for dns and gateway. At work I still set up some sites where infrastructure like switches/routers etc are on static - and take this into account when I set up the ip pool(s). I’m those cases I’ll exclude the top end of the network and put the rest in the pool. Some like to do the opposite end, and some don’t care and just use all as pool and count on arp/ping to avoid conflicting leases (bad practice).

[–] dream_weasel@sh.itjust.works 7 points 1 year ago (3 children)

I like your funny words magic man.

As a total novice for networking (setting up 4 hat rules for my pihole was... tough), how bad are vlans to set up?

[–] farcaller@fstab.sh 4 points 1 year ago

Look at them like this: VLANs are like running several cables between two spots that you can configure independently. In the very end it comes down to this: what virtual LAN number you have on the cable.

Your backbone devices (router and switches) can be configured to accept tagged traffic―your switch will send a packet prefixed with a VLAN index and your router will trust that the packet actually came from that VLAN on the switch port, or to tag traffic―like when you have some port on your switch where your PC is plugged in and the switch will tag those packets with some VLAN when it forwards them (to the router).

Once you grasp that, everything else pretty much boils down to managing several isolated networkd and how they cross-talk. You run a dhcp server over each network, its own set of other services and whatnot.

Oftentimes the “home” hardware will expect a single network and use some means of packets broadcast to reach each other. That's how your phone can find all google homes on the network and apple homekit knows where your smart lights are. For that traffic to cross VLANs you’ll have to use some special software like mdns repeaters, but you can still isolate them.

Wrapping up, VLANs basically allow you the physical level isolation over a single cable. Mind that there are, of course, some bugs, e.g. I once found an issue with Unifi access points that allowed a well crafted packet to escape into VLAN 1 no matter what it was supposed to be tagged with. So don’t treat them as physically separate links.

[–] AFLYINTOASTER@lemmy.world 4 points 1 year ago

Not bad. Hugely depends on what software, hardware, and firmware you use though.

I used a guide by HomeNetworkingGuy to fully set my network up in OPNSense, my software, running on a Protecli Vault, my hardware, using FreeBSD, my firmware/bios. It took me a full day start to finish. VLANs were maybe 30-60mins of that time tops.

[–] Oisteink@feddit.nl 3 points 1 year ago

They are not hard once you grasp the idea. They are like separate networks on layer 2(link) - layer 1 (physical) can be shared.
So you get several separate networks for the price (and equipment) of one. If you want to reach a device on one vlan from another it needs to be forwarded by something.

It gets a bit complicated here - as your idea of the network is on layer 4 where tcp and udp and other protocols live. As you don’t want to connect one vlan to the other - you want something that has access to both vlans to forward your layer 3 data (IP) between the links. This is your router. It will have a virtual network card on each vlan. You can tell your router to send data from one network card to the other to forward the data.

I suck at explaining- so you probably better off doing an Udemy network primer or read up a little bit. Good things to understand are the first 4 layers of osi model and routing.

It’s not hard and you can learn how to use it by poking stuff and googling a bit. Just imagine each vlan as a “copy” of your equipment (layer 1) cables and all. Your switch will have to support it, and if you want to trunk (run several vlans though one link) you need support on the other end as well.

/endwalloftext