No internet access on VLANs with pihole

I have an openWRT router with multiple VLANs, and a pihole used as a DNS running on a container on proxmox. The pihole (static ip) is on the LAN and every client on the LAN can access the internet with ads blocked, but clients on the VLANs do not have internet access.

I used DHCP option 6 to point LAN+VLANs interfaces to pihole.

VLANx can forward traffic to/from LAN

Pihole is configured to allow all queries (permit all origins).

Did I miss something?:grimacing:

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall

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 ''

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.1'

config interface 'lan'
	option proto 'static'
	option ipaddr '192.168.8.15'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option gateway '192.168.8.1'
	option device 'br-lan'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'
	option peerdns '0'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '0 1t 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '1t 3 6t'

config switch_vlan
	option device 'switch0'
	option vlan '10'
	option ports '1t 2t 6t'

config device
	option vid '10'
	option type '8021q'
	option name 'eth0.10'
	option ifname 'eth0'

config device
	option name 'wlan0'

config device
	option name 'wlan0-1'

config device
	option type 'bridge'
	option name 'wifi'
	list ports 'eth0.10'
	option bridge_empty '1'

config switch_vlan
	option device 'switch0'
	option vlan '11'
	option ports '1t 6t'

config device
	option type '8021q'
	option ifname 'eth0'
	option vid '11'
	option name 'eth0.11'

config interface 'VLAN11'
	option proto 'static'
	option ipaddr '192.168.11.1'
	option netmask '255.255.255.0'
	option device 'BrVl11'

config interface 'wifi_guest'
	option device 'wifi'
	option proto 'static'
	option ipaddr '192.168.10.1'
	option netmask '255.255.255.0'

config device
	option type 'bridge'
	option name 'BrVl11'
	list ports 'eth0.11'
	option bridge_empty '1'

config switch_vlan
	option device 'switch0'
	option vlan '12'
	option ports '1t 6t'

config device
	option type '8021q'
	option ifname 'eth0'
	option vid '12'
	option name 'eth0.12'

config interface 'VLAN12'
	option proto 'static'
	option device 'eth0.12'
	option ipaddr '192.168.12.1'
	option netmask '255.255.255.0'

DHCP

config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'
	option limit '100'
	list dhcp_option '6,192.168.8.208'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'
	list ra_flags 'none'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dhcp 'VLAN11'
	option interface 'VLAN11'
	option start '100'
	option limit '150'
	option leasetime '12h'
	list ra_flags 'none'

config dhcp 'wifi_guest'
	option interface 'wifi_guest'
	option start '100'
	option leasetime '12h'
	option limit '150'
	list ra_flags 'none'

config dhcp 'VLAN12'
	option interface 'VLAN12'
	option start '100'
	option limit '150'
	option leasetime '12h'
	list dhcp_option '6,192.168.8.208'
	list ra_flags 'none'

firewall

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

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

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

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 src_ip ''
	option dest_ip ''
	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 ''
	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 rule
	option name 'Support-UDP-Traceroute'
	option src 'wan'
	option dest_port '33434:33689'
	option proto 'udp'
	option family 'ipv4'
	option target 'REJECT'
	option enabled '0'

config include
	option path '/etc/firewall.user'

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

config forwarding
	option src 'G_LanWifi'
	option dest 'wan'

config forwarding
	option src 'lan'
	option dest 'G_LanWifi'

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

config forwarding
	option src 'lan'
	option dest 'VLAN11'

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

config forwarding
	option src 'VLAN12'
	option dest 'wan'

config forwarding
	option src 'VLAN11'
	option dest 'lan'

config forwarding
	option src 'VLAN12'
	option dest 'lan'

config forwarding
	option src 'lan'
	option dest 'VLAN12'

pihole ip: 192.168.8.208
clients on VLAN12 do not have internet access when using pihole.

Any help here? :smiling_face_with_tear:

Enable masquerading on the lan firewall zone.

Wow it woks! Thank you so much!!
Could you please explain the solution?

The reason this works is that your OpenWrt router is not the main router. Therefore, the upstream connection is via the main LAN (192.168.8.15, with the main gateway at 192.168.8.1).

IPv4 masquerading is normally used on the WAN to share a single ISP issued IP address with many devices in a network. In your case, you're not using the WAN of the OpenWrt router, so you need to do a similar thing with IPv4 NAT masquerading since your OpenWrt is setup to route other networks.

There is an alternative way to handle this... if your main router supports static routes, you can set static routes for 192.168.10.0/24, 192.168.11.0/24 and 192.168.12.0/24 via 192.168.8.15. Then you can disable masquerading on the lan zone.

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.

You are right, I have my ISP router (Huawei 5g) on bridge mode connected to a tp-link router flashed with openwrt.

Thank you so much for your help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.