I have a pfSense router with DHCP server. OpenWRT acts as an access point with LAN interface that has DHCP server disabled and Guest interface where DHCP server is running:
config interface 'loopback'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
option device 'lo'
config globals 'globals'
option ula_prefix 'fdef:08b5:67e5::/48'
config interface 'lan'
option _orig_ifname 'eth0 wlan0 radio1.network1'
option _orig_bridge 'true'
option proto 'static'
option ipaddr '192.168.1.98'
option netmask '255.255.255.0'
option device 'br-lan'
option gateway '192.168.1.1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'guest'
option proto 'static'
option ipaddr '192.168.2.1'
option netmask '255.255.255.0'
option type 'bridge'
option device 'br-guest'
config device
option name 'eth0'
config device
option type 'bridge'
option name 'br-guest'
option bridge_empty '1'
option ipv6 '0'
The issue is that while mobile phone receives DNS server that is pfSense router (192.168.1.1), which has openwrt DNS name configured to statically resolve to 192.168.1.98, I get 192.168.2.1 on my phone instead (which is OpenWRT's IP in Guest network).
It doesn't make any sense. In fact none of the local addresses from pfSense are resolving properly.
I'm confused. The only potential explanation I have is that my phone somehow gets IPv6 address fe80::b0b9:eb3e:c12c:ffdf/64 and strange DNS server for IPv6 ending with %wlan0, but since IPv6 is disabled everywhere, I don't think it actually works.
Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
config defaults
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option synflood_protect '1'
config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option masq '1'
config include
option path '/etc/firewall.user'
config zone
option name 'guest'
option output 'ACCEPT'
option forward 'REJECT'
list network 'guest'
option input 'REJECT'
config forwarding
option src 'guest'
option dest 'lan'
config rule
option name 'Guest DHCP'
list proto 'udp'
option src 'guest'
option dest_port '67-68'
option target 'ACCEPT'
config rule
option name 'Guest DNS'
option src 'guest'
option dest_port '53'
option target 'ACCEPT'
config rule
option name 'Block Guest Access to LAN'
list proto 'all'
option src 'guest'
option dest 'lan'
list dest_ip '192.168.1.0/24'
option target 'DROP'
The conclusion I have is that DHCPv6 was applied to LAN even though it is configured to be ignored there. Like if DHCPv6 lives its own life by its own rules.
So everything in your config files looks fine.... are you 100% certain that your phone didn't connect to the guest network? It would seem to me that the only way that it could get an address in 192.168.2.0/24 is if that happens.
I 100% SSHed into my phone while it is connected to normal LAN network and did ping openwrt, which resolved to 192.168.2.1, but, obviously, wasn't able to ping because that is a different network, my phone had IP address 192.168.1.3. Once I stopped odhcpd and reconnected openwrt started to resolve correctly to 192.168.1.98 as I expected initially.
Will probably create a bug report with this later.
oh... I see... so you're saying the phone had an IP on the correct network, but the issue is that DNS of "openwrt" was resolving to the IP that OpenWrt uses for the guest network? That is a bit odd... the only way I could see that happening is if the DHCP server was actually running on OpenWrt and so when your phone connected, the lease was actually issued by the OpenWrt device (which should have nominally been in a true dumb AP config with DHCP disabled). In this scenario, OpenWrt would point to itself as the DNS (and gateway).
Is it possible that you didn't restart the odhcpd process after setting the DHCP lan to ignore?
DHCP v4 is certainly from pfSense as in there I have a static lease 192.168.1.3 for my phone's IP address. DNS server was also issued correctly to be 192.168.1.1.
The only difference is that with odhcpd running, phone gets another DNS server in front of 192.168.1.1, which is IPv6 and apparently intercepts DNS queries. This implies odhcpd does act as DHCP v6 server on LAN, despite LAN being explicitly configured to not have DHCP. I have IPv6 disabled everywhere on the router and even tried switching some options on OpenWRT, but with no effect so far.