I have a Raspberry Pi 4 model B running Openwrt with two additional USB Ethernet adapters . I have the onboard Ethernet port currently connected to the WAN. Wireguard is installed but not properly configured. I also have an HP Procurve 2824 switch and would like to create two VLANs on it.
What I was to achieve:
(1) I want the first USB Ethernet adapter to support a VLAN (VLAN1) on the switch than is only accessible via the WireGuard VPN server running on the Raspberry Pi. I would like to run my own DNS server on this VLAN and would also like it to be able to pull code from github.
(2) Secondly, I have a second USB adapter for my Pi for which I would like to establish a second VLAN on my switch.
I would like this VLAN (VLAN2) to make use of my static WAN IP address. My cheap ISP router current accepts traffic to the sole IP address I have for several subdomains. One meant for my Nextcloud server and another to my test machine. (e.g: nextcloud.mydomain.com and test.mydomain.com). I would like to configure the Pi to route traffic for Nextcloud to one port on my VLAN2 and traffic for test to another port on VLAN2). These will not sit behind the VPN but should be publicly accessible. Is a VLAN indeed needed for this part ? or can I simply give the machines static IP address and plug them into the Switch (I am not sure how this will work, will the Switch simply act as a hub if I do not create a VLAN ?)
Updated with the following on 27/1/23:
I have eth0 (the br-lan) as a dedicated connection to my cheap ISP provided Huawei router as I am not sure how you expect me to get internet traffic into the picture.
Are you proposing that I plug the ISP provided Huawei router directly into a switch port and to somehow tag it to provide internet access across both VLANs. If so how does my router control this ?
I currently have this in /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 'fd56:08f3:f438::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ip6assign '60'
option gateway '192.168.100.1'
list dns '1.1.1.1'
list ipaddr '192.168.100.253/24'
config device
option name 'eth0'
config device
option name 'phy0-sta0'
config device
option name 'eth1'
option acceptlocal '1'
config device
option type '8021q'
option ifname 'eth1'
option vid '10'
option name 'eth1.10'
option ipv6 '0'
config device
option type '8021q'
option ifname 'eth1'
option vid '20'
option name 'eth1.20'
option ipv6 '0'
config interface 'laan'
option proto 'static'
option device 'eth1.10'
option ipaddr '192.168.7.1'
option netmask '255.255.255.0'
config interface 'wan'
option proto 'dhcp'
option device 'eth1.20'
I believe the VLANs on the switch are working as openwrt shows traffic for eth1.10 and eth1.20 when a device is plugged into the switch for either of those VLANs and stops when removed.
I am just not sure exactly what I have and whether I'm going in the right direction.