Hi everyone,
this is mostly a follow up of my last post (Connecting to VLAN on trunked VLAN - #3 by fb96).
I am trying to figure out how to configure VLANs and am tragically failing at it.
I know VLAN is asked about a lot in this forum but often times the questions start with "I have 3 working VLANs and want to bridge them properly". I am stuck before that. If this is a duplicate, please redirect me.
My setup:
Internet
/\
|| WAN
OpenWRT (2Ports)
|| LAN (eth0 on OpenWRT / port 1 on switch)
\/
Managed Switch
| -- ethernet port 2 --> dumb Wifi-AP
| -- ethernet port 3--> more stuff
| -- ethernet port 4--> TV
My understanding is, that I can assign VLAN tags to specific ports on the switch to have all devices behind it be on a VLAN without ever knowing about it.
My initial least impact attempt was to just put my TV on a separate VLAN from the rest to understand how it works and how it needs to be configured.
I would like everything to use VLAN1 except my TV which would be VLAN2 (not very practical right now, but I want the TV to be accessible from home and guest VLAN in the end for example.
The OpenWRT default config came with my WAN on eth1
and my LAN on eth0
as a bridge device called br-lan
.
This is my /etc/config/network
:
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdef:a79f:a7db::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config device
option type '8021q'
option ifname 'br-lan'
option vid '1'
option name 'br-lan.1'
config device
option type '8021q'
option ifname 'br-lan'
option vid '2'
option name 'br-lan.2'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config rule
option in 'lan'
option src '192.168.1.0/24'
option out 'wan'
config interface 'HOME_VLAN'
option proto 'static'
option device 'br-lan.1'
option ipaddr '10.0.1.1'
option netmask '255.255.255.0'
config interface 'TV_VLAN'
option proto 'static'
option device 'br-lan.2'
option ipaddr '10.0.2.1'
option netmask '255.255.255.0'
config interface 'tailscale'
option proto 'none'
option device 'tailscale0'
config interface 'wan'
option device 'eth1'
option proto 'dhcp'
config interface 'wan6'
option device 'eth1'
option proto 'dhcpv6'
Both VLANs just use the same firewall zone as the original bl-lan
. I didn't want my attempts to be failing because I set up the firewall poorly. That means they all should have the same communication rules, am I right?
The default network without any VLAN attempts just sent everything over br-lan
.
According to this tutorial from TP-link, the switch vendor, I set the switch config like this:
To my understanding, everything going port 4 gets tagged as VLAN2. On any other port it incoming packets will be tagged as VLAN1.
Anything going out port 1 to the router will get the tag removed again?
This would separate the two networks (TV on port 4 and anything else) but wouldn't forward the tags to my router on port 1, am I right?
After this, all devices are still connected and get their addresses from the 192.168.1.xx pool. Which makes sense to me that packets without VLAN tag from the switch would be treated just like before on the router.
That's why I thought, I would need to set port 1 as tagged on the switch for all VLANs so that VLAN tags are actually sent out to the router.
That's however, when I lose connection to the router and need to reset the switch (or plug my machine directly into the router, I guess).
Thanks in advance