this post was submitted on 07 Apr 2025
47 points (96.1% liked)

Selfhosted

46265 readers
463 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 2 years ago
MODERATORS
 

Sorry for being such a noob. My networking is not very strong, thought I'd ask the fine folks here.

Let's say I have a Linux box working as a router and a dumb switch (I.e. L2 only). I have 2 PCs that I would like to keep separated and not let them talk to each other.

Can I plug these two PCs into the switch, configure their interfaces with IPs from different subnets, and configure the relevant sub-interfaces and ACLs (to prevent inter-subnet communication through the router) on the Linux router?

What I'm asking is; do I really need VLANs? I do need to segregate networks but I do not trust the operating systems running on these switches which can do L3 routing.

If you have a better solution than what I described which can scale with the number of computers, please let me know. Unfortunately, networking below L3 is still fuzzy in my head.

Thanks!

you are viewing a single comment's thread
view the rest of the comments
[–] nottelling@lemmy.world 4 points 2 weeks ago (1 children)

What you are asking will work. That's the whole point of subnets. No you don't need a VLAN to segregate traffic. It can be helpful for things like broadcast control.

However, you used the word "trust" which means that this is a security concern. If you are subnetting because of trust, then yes you absolutely do need to use VLANs.

[–] marauding_gibberish142@lemmy.dbzer0.com 1 points 2 weeks ago (2 children)

Could you elaborate why the question of trust invalidates using just subnets?

[–] possiblylinux127@lemmy.zip 2 points 2 weeks ago (1 children)

Subnets are on layer 3 not layer 2. You can easy access other devices on layer 3 by finding the right subnet on layer 2. ARP is used to resolve IP addresses into MAC addresses and vis versa.

[–] marauding_gibberish142@lemmy.dbzer0.com 1 points 2 weeks ago (2 children)

Thanks, but isn't ARP contained inside a subnet? I guess you could find everything if you inspected the MAC table of the main switch

[–] possiblylinux127@lemmy.zip 1 points 2 weeks ago (1 children)

ARP is in the broadcast domain (otherwise known as a lan)

Vlans create multiple lans

[–] nottelling@lemmy.world 1 points 2 weeks ago (2 children)

no. Arp bridges layer 1 and 2. It's switch local. With a VLAN, it becomes VLAN local, in the sense that 802.1q creates a "virtual" switch.

Sorry, I'm not sure what you mean by "ARP bridges L1 and L2". I'll have to read more about this. Other than that, I understand what you said.

[–] possiblylinux127@lemmy.zip 1 points 2 weeks ago

ARP is in a single broadcast domain which can span multiple switches.

[–] nottelling@lemmy.world 1 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

A VLAN is (theoretically) equivalent to a physically separated layer 2 domain. The only way for machines to communicate between vlans is via a gateway interface.

If you don't trust the operating system, then you don't trust that it won't change it's IP/subnet to just hop onto the other network. Or even send packets with the other network's header and spoof packets onto the other subnets.

It's trivially easy to malform broadcast traffic and hop subnets, or to use various arp table attacks to trick the switching device. If you need to segregate traffic, you need a VLAN.

Edit: Should probably note that simply VLAN tagging from the endpoints on a trunk port isn't any better than subnetting, since an untrusted machine can just tag packets however it wants. You need to use an 802.1q aware switch and gateway to use VLANs effectively.

Thank you for the great comment.

This line cleared it up for me:

802.1q aware switch and gateway to use VLANs effectively.

It is indeed as you say. VLANs on a trunk port wouldn't really work for security either. This is making me reconsider my entire networking infrastructure since when I started I wasn't very invested in such things. Thanks for giving me material to think about