I also had:
/etc/init.d/dnsmasq restart
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: no lease, failing
and this was bothering me.
The problem was that udhcpc was trying to get an address on local interfaces, although it didn't need to. Here is my dump:
~ # tcpdump -i any port 67 or port 68 -vv
tcpdump: data link type LINUX_SLL2
tcpdump: listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
03:14:28.513915 br-lan Out IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 88:c3:97:c4:58:28 (oui Unknown), length 300, xid 0x54d7a547, Flags [none] (0x0000)
Client-Ethernet-Address 88:c3:97:c4:58:28 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message (53), length 1: Discover
MSZ (57), length 2: 576
Parameter-Request (55), length 7:
Subnet-Mask (1), Default-Gateway (3), Domain-Name-Server (6), Hostname (12)
Domain-Name (15), BR (28), NTP (42)
Vendor-Class (60), length 12: "udhcp 1.36.1"
Client-ID (61), length 7: ether 88:c3:97:c4:58:28
03:14:28.513924 lan2 Out IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 88:c3:97:c4:58:28 (oui Unknown), length 300, xid 0x54d7a547, Flags [none] (0x0000)
Client-Ethernet-Address 88:c3:97:c4:58:28 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message (53), length 1: Discover
MSZ (57), length 2: 576
Parameter-Request (55), length 7:
Subnet-Mask (1), Default-Gateway (3), Domain-Name-Server (6), Hostname (12)
Domain-Name (15), BR (28), NTP (42)
Vendor-Class (60), length 12: "udhcp 1.36.1"
Client-ID (61), length 7: ether 88:c3:97:c4:58:28
03:14:28.513935 lan1 Out IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 88:c3:97:c4:58:28 (oui Unknown), length 300, xid 0x54d7a547, Flags [none] (0x0000)
Client-Ethernet-Address 88:c3:97:c4:58:28 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message (53), length 1: Discover
MSZ (57), length 2: 576
Parameter-Request (55), length 7:
Subnet-Mask (1), Default-Gateway (3), Domain-Name-Server (6), Hostname (12)
Domain-Name (15), BR (28), NTP (42)
Vendor-Class (60), length 12: "udhcp 1.36.1"
Client-ID (61), length 7: ether 88:c3:97:c4:58:28
^C
3 packets captured
5 packets received by filter
0 packets dropped by kernel
In the end, I applied the following code change to /etc/init.d/dnsmasq
:
dhcp_check() {
local ifname="$1"
local stamp="${BASEDHCPSTAMPFILE_CFG}.${ifname}.dhcp"
local rv=0
# Exclude lan1, lan2, and br-lan from dhcp_check
if [ "$ifname" = "lan1" ] || [ "$ifname" = "lan2" ] || [ "$ifname" = "lan3" ] || [ "$ifname" = "lan4" ] || [ "$ifname" = "br-lan" ]; then
return 0
fi
[ -s "$stamp" ] && return $(cat "$stamp")
# If interface is down, skip it.
# The init script will be called again once the link is up
case "$(devstatus "$ifname" | jsonfilter -e @.up)" in
false) return 1;;
esac
udhcpc -n -q -s /bin/true -t 1 -i "$ifname" >&- && rv=1 || rv=0
echo $rv > "$stamp"
return $rv
}
Maybe I'm wrong, I don't understand anything about this, and the great GPT helped me.