[Solved] Forwarding between VLANs

I'm running OpenWrt in a VM on a Proxmox server. I'm trying to migrate my config from my old router and need help configuring the VLANs.

  • LAN
    • 10.1.0.0/16
  • VLAN 20 (iot-no-net)
    • 10.20.0.0/16
    • Allow access from LAN → VLAN 20
    • Allow access from VLAN 20 → LAN for DNS (running on a separate server) and DHCP (on OpenWrt)
    • Deny access from VLAN 20 → everything else on the LAN
    • Deny access from VLAN 20 → WAN
  • VLAN 30 (iot-net)
    • 10.30.0.0/16
    • The same as VLAN 20 except it allows access to the WAN

I need help getting the configuration exactly right.

Right now, I'm only trying to get VLAN 20 working. I'm having trouble pinging devices in VLAN 20 from the LAN.

/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 'fdc7:ff6a:262b::/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'
        list dns '10.1.4.2'
        list dns '10.1.5.2'
        list ipaddr '10.1.0.1/16'

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth1'
        option proto 'dhcpv6'

config device
        option type '8021q'
        option ifname 'br-lan'
        option vid '20'
        option name 'iot-no-net'
        option ipv6 '0'

config device
        option type '8021q'
        option ifname 'br-lan'
        option vid '30'
        option name 'iot-net'

config interface 'iot_no_net'
        option proto 'static'
        option device 'iot-no-net'
        option ipaddr '10.20.0.1'
        option netmask '255.255.0.0'

config interface 'iot_net'
        option proto 'static'
        option device 'iot-net'
        option ipaddr '10.30.0.1'
        option netmask '255.255.0.0'
        option ip6assign '64'

/etc/config/firewall:

config defaults
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'
        option flow_offloading '1'
        option flow_offloading_hw '1'

config zone
        option name 'lan'
        list network 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'

config zone
        option name 'wan'
        list network 'wan'
        list network 'wan6'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Plex'
        list proto 'tcp'
        option src 'wan'
        option src_dport '34321'
        option dest_ip '10.1.1.12'
        option dest_port '32400'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Server02'
        option src 'wan'
        option src_dport '80'
        option dest_ip '10.1.1.12'
        option dest_port '8880'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Server02_HTTPS'
        option src 'wan'
        option src_dport '443'
        option dest_ip '10.1.1.12'
        option dest_port '4443'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'SyncThing'
        option src 'wan'
        option src_dport '22000'
        option dest_ip '10.1.1.12'
        option dest_port '22000'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'SyncThing_Discovery'
        option src 'wan'
        option src_dport '21027'
        option dest_ip '10.1.1.12'
        option dest_port '21027'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Pi_SSH'
        option src 'wan'
        option src_dport '36153'
        option dest_ip '10.1.1.1'
        option dest_port '22'
        list proto 'tcp'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'DanHome_WireGuard'
        option src 'wan'
        option src_dport '46421'
        option dest_ip '10.1.1.12'
        option dest_port '46421'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Borgserver_SSH'
        list proto 'tcp'
        option src 'wan'
        option src_dport '36152'
        option dest_ip '10.1.1.15'
        option dest_port '22'

config zone
        option name 'iot_no_net'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'iot_no_net'

config zone
        option name 'iot_net'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        list network 'iot_net'

config rule
        option name 'test1'
        option dest 'iot_no_net'
        option target 'ACCEPT'
        option src 'lan'

config rule
        option name 'test'
        option src 'iot_no_net'
        option dest 'lan'
        option target 'ACCEPT'

config forwarding
        option src 'lan'
        option dest 'iot_no_net'

Thanks!

This rule is unnecessary and can be deleted:

the forwarding rule for lan > iot_no_net should allow your devices on the lan to reach the other network (and not vice versa).

You'll create a similar forward for the iot_net zone, and also the forward to the wan:

config forwarding
        option src 'lan'
        option dest 'iot_net'

config forwarding
        option src 'iot_net'
        option dest 'wan'

What is the address of your DNS server?

1 Like

Also, I'm noticing that this has input = reject. That's fine (and generally good practice for untrusted networks), but you'll need to add a rule to accept DHCP traffic. You may also want to add a DNS hijacking rule if you want to ensure that the iot_net always uses your desired DNS and no others.

1 Like

Thanks for your replies @psherman! I think I've got it working the way I want.

Do you know what I need to do to allow IPv6 autoconfiguration (SLAAC) on iot-net? Devices on iot-net are only getting an IPv4 address but I want them to get an IP from the range I get from my ISP - same as how I have my regular LAN configured. I assume I need to allow something through the firewall but I'm not sure what.

I am not an expert on IPv6. Hopefully someone else can answer that.

That said, when you are ready:

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

I solved it: I had to allow DHCPv6 (UDP port 547, IPv6) and ICMPv6 (ICMP, IPv6) from iot_net to this device (input). Now it's working!