HP printer not getting IP address from openwrt dhcp

I have an HP Printer LaserJet M102w that I am trying to connect it to my openwrt router wifi. Wifi connection takes place and printer shows connected to wifi, however the printer still gets an APIPA address after all and not IP address from the router's IP address range.
So I decided to connect the printer to my phone hotspot and see if there is any difference. When the printer is connected to my phone hotspot, it takes proper IP address from my phone.
So I am thinking there must be something wrong on my openwrt that is causing my HP printer not to get an IP address from the dhcp server. BTW i have also AdGuardhome installed as per this article [How-To-Updated 2021] Installing AdGuardHome on OpenWrt [Manual and opkg method] - Community Builds, Projects & Packages - OpenWrt Forum

Any help to figure out why openwrt is not providing an IP address to my printer would be appreciated.

You run openwrt dhcp or agh dhcp?
Please connect to your OpenWrt device using ssh and 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:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall
opkg list-installed adguardhome
1 Like

ubus call system board

{
        "kernel": "5.15.162",
        "hostname": "OpenWrt-Bedrooms",
        "system": "ARMv7 Processor rev 5 (v7l)",
        "model": "Linksys WHW01",
        "board_name": "linksys,whw01",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.4",
                "revision": "r24012-d8dd03c46f",
                "target": "ipq40xx/generic",
                "description": "OpenWrt 23.05.4 r24012-d8dd03c46f"
        }
}

cat /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 'fd34:803a:0768::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

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 device
        option type 'bridge'
        option name 'br-wan'
        list ports 'eth2'
        option mtu '1500'
        option macaddr '30:23:03:D7:3B:49'

config interface 'wan'
        option proto 'dhcp'
        option device 'br-wan'
        option peerdns '0'
        list dns '1.1.1.1'
        list dns '1.0.0.1'

cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'platform/soc/a000000.wifi'
        option channel '1'
        option band '2g'
        option htmode 'HT20'
        option cell_density '0'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'WADDAH2'
        option encryption 'psk-mixed'
        option key '123456789'

config wifi-device 'radio1'
        option type 'mac80211'
        option path 'platform/soc/a800000.wifi'
        option channel '36'
        option band '5g'
        option htmode 'VHT80'
        option cell_density '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'WADDAH2-5Ghz'
        option encryption 'sae-mixed'
        option key '123456789'

cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '0'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option confdir '/tmp/dnsmasq.d'
        option port '54'
        list server '192.168.1.1'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '24h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        list dhcp_option '6,192.168.1.1'
        list dhcp_option '3,192.168.1.1'
        list dns 'fd34:803a:768::1'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

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

config host
        option name 'Reda-iPad'
        option ip '192.168.1.160'
        option mac '4C:AB:4F:4E:33:0B'

config host
        option name 'Talia-iPad'
        option ip '192.168.1.100'
        option mac '8C:FE:57:31:F4:6D'

config host
        option name 'ninetendo'
        option ip '192.168.1.215'
        option mac '98:41:5C:E1:20:B3'

cat /etc/config/firewall

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

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 rule
        option name 'allow_ssh'
        list proto 'tcp'
        option src 'wan'
        option dest_port '22'
        option target 'ACCEPT'

config rule
        option name 'allow_luciweb'
        list proto 'tcp'
        option src 'wan'
        option dest_port '80'
        option target 'ACCEPT'

config rule
        option name 'allow_adghtemp'
        list proto 'tcp'
        option src 'wan'
        option dest_port '3000'
        option target 'ACCEPT'

config rule
        option name 'allow_adgh'
        list proto 'tcp'
        option src 'wan'
        option dest_port '8080'
        option target 'ACCEPT'

opkg list-installed adguardhome - returns nothing

Don’t use PSK mixed (wpa1/wpa2). Just use wpa2.

And similarly don’t use sae-mixed. Use either wpa2 or wpa3. Mixed mode often causes problems.

And delete all these rules. These should never be exposed to the internet. If you need remote access, setup a vpn.

[quote="wshamroukh, post:3, topic:210022"]

config rule
        option name 'allow_ssh'
        list proto 'tcp'
        option src 'wan'
        option dest_port '22'
        option target 'ACCEPT'

config rule
        option name 'allow_luciweb'
        list proto 'tcp'
        option src 'wan'
        option dest_port '80'
        option target 'ACCEPT'

config rule
        option name 'allow_adghtemp'
        list proto 'tcp'
        option src 'wan'
        option dest_port '3000'
        option target 'ACCEPT'

config rule
        option name 'allow_adgh'
        list proto 'tcp'
        option src 'wan'
        option dest_port '8080'
        option target 'ACCEPT'

1 Like

Undo the changes you did to the DNS/DHCP configuration, try if it works, then add them back one by one, and see which one causes the issue.

I have just tried resetting the openwrt to default and just enabled wifi on it with no password. Still my printer gets an APIPA ip address.

However if I connect my printer to my phone hotspot, I can connect to it and it gets proper IP address

So there must be something wrong with the DHCP on openwrt.

Run tcpdump and capture dhcp request.

I have used this command to collect the attached network traces

tcpdump udp and port 67 or port 68 -i any -s 2000 -w /tmp/dhcp.pcap &

https://waddahs.blob.core.windows.net/rom/dhcp.pcap?sv=2023-01-03&st=2024-09-10T08%3A41%3A39Z&se=2024-09-20T08%3A41%3A00Z&sr=b&sp=r&sig=5gbQ57pgzqDEZwIKb41D8LbwDOG018g5ThfMWY6YPDY%3D
Appreciate it if you can look into it

Initially what I can see is that there is no DHCP ACK happening if I compare it with another device that connects successfully to the wifi of openwrt

You won't believe it. I downgraded the firmware from OpenWrt 23.05.4, to OpenWrt 23.05.3 and now my printer is taking a proper IP address from the openwrt

Upgrade and check again? You still have not specified if the problem is with OpenWRT or AGH blob dhcpp server.

I reset the router, so it should be back to default dhcp and no AGH involved after reset. So I don't think my issue was with AGH

Please grab dhcp request and renew packets from the device, then upgrade to .4 in place and do that again.

You need tcpdump?

Looked at your capture (wireshark) -
image
Looks like your printer cannot adapt to a new subnet, probably needing power push.

Interesting - this seems a lingering IP address from when I tried to connect the printer to my phone hotspot.
But after downgrading the firmware, the printer is taking an IP address from openwrt just fine

Probably needs wired/wireless in same subnet to feed its special requirements. Or a firmware update.

Yes, the pcap from working side would explain a lot - check the requested address attribute and the response to it. i.e what changed in OpenWRT responses that confuses printer.

The thing is that I have two openwrt linksys routers had the same issue, and they both had the latest firmware. On the one where I downgraded the firmware, the printer was able to get an IP address, while the openwrt linksys router with the latest firmware still has the same issue.