DHCP being stubborn? keep getting wrong subnet/IP even with a static lease set up

I've been sitting here a few hours now trying to troubleshoot something and i'm running out of ideas and needing to ask for help (something I do very reluctantly as I like to think I should be able to figure this out on my own). But at this point, i'm giving in and accepting the fact that i'm probably doing something stupid and missing/overlooking something probably simple..

I have a client on my network, my laptop, it has reachability issues trying to get to a host on another network. Or so i thought it was configured that way, see i figured out the issue is the laptop has the wrong subnet being set, and thinks the other host is on the same network. as if that wasn't a big enough facepalm...

So while I could manually set the right IP and subnet, but i'm trying to rely on DHCP and i cannot for the life of me figure out why my laptop keeps getting the wrong subnet (and also not the IP i have configured in the static lease).

things i've tried:

  • checking /etc/config/dhcp (included below)
  • releasing/renewing the DHCP lease on the laptop
  • removing the /tmp/dhcp.leases.lan file
  • rebooting the laptop
  • rebooting the router
  • lowering the client lease to 5m
  • lowering ALL leases times on that subnet to 2m
  • running tcpdump/dhcpdump both on the router and on the client (output below)

Still I keep getting the same IP (final octet being .218) and the wrong subnet mask appears to be configured on my laptop's interface. AND I can't figure out why!

I am not sure what to do next? this is an OpenWRT build SNAPSHOT r23935+13-c1206675a4 w/ kernel 6.1.53 - the mac is running macOS monterey 12.3.1

Here's the relevant bits of my /etc/config/dhcp file:

config dnsmasq 'lan_dns'                        
        option domainneeded '1'                 
        option localise_queries '1'             
        option rebind_protection '1'            
        option rebind_localhost '1'             
        option local '/lan.home.mydomain/'       
        option domain 'lan.home.mydomain'        
        option expandhosts '1'                  
        option cachesize '1000'           
        option authoritative '1'          
        option readethers '1'             
        option leasefile '/tmp/dhcp.leases.lan'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        list interface 'lan'                                   
        list notinterface 'loopback'                           
        list server '208.67.222.222'                           
        list server '208.67.220.220'                           
        list rebind_domain '/mydomain/'                         
        option localservice '1'                                
                                                               
config dhcp 'lan'                                              
        option instance 'lan_dns'                              
        option interface 'lan'                                 
        option start '100'                                     
        option limit '150'                                     
        option leasetime '2m'                                  
        option dhcpv4 'server'                                 
        option dhcpv6 'server'                                 
        option ra 'server'                                     
        list dhcp_option '15,lan.home.mydomain'                 
        list dhcp_option '119,lan.home.mydomain,mgmt.home.mydomain'
        list dhcp_option_force '1'                               
        list ra_flags 'managed-config'                           
        list ra_flags 'other-config'   

[...]

config host                                       
        option name 'aleksWorkMBP-docked'         
        option ip '10.22.20.20'                  
        option mac '8C:AE:4C:XX:XX:XX'            
        option dns '1'                            
        option duid 'XXXXX'
        option instance '1'                                    
        option hostid '00000001'                               
        option leasetime '5m'  

and /etc/config/network:

config interface 'lan'
        option device 'br-lan.2220'
        option proto 'static'
        option ipaddr '10.22.20.1'
        option netmask '255.255.255.0'
        option ip6assign '64'
        option ip6hint '2220'
        option ip6ifaceid '::'
        list ip6class 'wan_6'

And here's what the output of dhcpdump looks like:

  TIME: 2023-09-19 00:25:56.680
    IP: 0.0.0.0 (8c:ae:4c:xx:xx:xx) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 91b8a7d0
  SECS: 2
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:xx:xx:xx:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 12) Parameter Request List      1 (Subnet mask)
                                            121 (Classless Static Route)
                                              3 (Routers)
                                              6 (DNS server)
                                             15 (Domainname)
                                            108 (Swap Path)
                                            114 (URL)
                                            119 (Domain Search)
                                            252 (MSFT - WinSock Proxy Auto Detect)
                                             95 (LDAP)
                                             44 (NetBIOS name server)
                                             46 (NetBIOS node type)

OPTION:  57 (  2) Maximum DHCP message size 1500
OPTION:  61 (  7) Client-identifier         01:8c:ae:4c:xx:xx:xx
OPTION:  51 (  4) IP address leasetime      7776000 (12w6d)
OPTION:  12 ( 12) Host name                 aleksWorkMBP
---------------------------------------------------------------------------

  TIME: 2023-09-19 00:25:58.295
    IP: 10.22.20.1 (60:38:e0:xx:xx:xx) > 10.22.20.218 (8c:ae:4c:xx:xx:xx)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 91b8a7d0
  SECS: 0
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 10.22.20.218
SIADDR: 10.22.20.1
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:xx:xx:xx:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         2 (DHCPOFFER)
OPTION:  54 (  4) Server identifier         10.22.20.1
OPTION:  51 (  4) IP address leasetime      120 (2m)
OPTION:  58 (  4) T1                        60 (60s)
OPTION:  59 (  4) T2                        105 (1m45s)
OPTION:  28 (  4) Broadcast address         10.22.20.255
OPTION:   3 (  4) Routers                   10.22.20.1
OPTION:   6 (  4) DNS server                10.22.20.1
OPTION: 119 ( 25) Domain Search             036c616e04686f6d .lan.home...
OPTION:  15 ( 16) Domainname                lan.home.mydomain
---------------------------------------------------------------------------

  TIME: 2023-09-19 00:25:58.295
    IP: 10.22.20.1 (60:38:e0:xx:xx:xx) > 10.22.20.218 (8c:ae:4c:xx:xx:xx)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 91b8a7d0
  SECS: 2
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 10.22.20.218
SIADDR: 10.22.20.1
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:xx:xx:xx:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         2 (DHCPOFFER)
OPTION:  54 (  4) Server identifier         10.22.20.1
OPTION:  51 (  4) IP address leasetime      120 (2m)
OPTION:  58 (  4) T1                        60 (60s)
OPTION:  59 (  4) T2                        105 (1m45s)
OPTION:  28 (  4) Broadcast address         10.22.20.255
OPTION:   3 (  4) Routers                   10.22.20.1
OPTION:   6 (  4) DNS server                10.22.20.1
OPTION: 119 ( 25) Domain Search             036c616e04686f6d .lan.hom...
OPTION:  15 ( 16) Domainname                lan.home.mydomain
---------------------------------------------------------------------------

  TIME: 2023-09-19 00:25:59.305
    IP: 0.0.0.0 (8c:ae:4c:xx:xx:xx) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 91b8a7d0
  SECS: 5
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:xx:xx:xx:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  55 ( 12) Parameter Request List      1 (Subnet mask)
                                            121 (Classless Static Route)
                                              3 (Routers)
                                              6 (DNS server)
                                             15 (Domainname)
                                            108 (Swap Path)
                                            114 (URL)
                                            119 (Domain Search)
                                            252 (MSFT - WinSock Proxy Auto Detect)
                                             95 (LDAP)
                                             44 (NetBIOS name server)
                                             46 (NetBIOS node type)

OPTION:  57 (  2) Maximum DHCP message size 1500
OPTION:  61 (  7) Client-identifier         01:8c:ae:4c:xx:xx:xx
OPTION:  50 (  4) Request IP address        10.22.20.218
OPTION:  54 (  4) Server identifier         10.22.20.1
OPTION:  12 ( 12) Host name                 aleksWorkMBP
---------------------------------------------------------------------------

  TIME: 2023-09-19 00:25:59.305
    IP: 10.22.20.1 (60:38:e0:xx:xx:xx) > 10.22.20.218 (8c:ae:4c:xx:xx:xx)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 91b8a7d0
  SECS: 5
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 10.22.20.218
SIADDR: 10.22.20.1
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:xx:xx:xx:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         10.22.20.1
OPTION:  51 (  4) IP address leasetime      120 (2m)
OPTION:  58 (  4) T1                        60 (60s)
OPTION:  59 (  4) T2                        105 (1m45s)
OPTION:  28 (  4) Broadcast address         10.22.20.255
OPTION:   3 (  4) Routers                   10.22.20.1
OPTION:   6 (  4) DNS server                10.22.20.1
OPTION: 119 ( 25) Domain Search             036c616e04686f6d .lan.hom...
OPTION:  15 ( 16) Domainname                lan.home.mydomain
---------------------------------------------------------------------------



The ip .218 keeps coming back, repeatedly clearing /tmp/dhcp.leases* and restarting dnsmasq seems to have no effect.. rebooting either host has no effect.. It's like the macbook really wants this IP (but more importantly, the WRONG subnet) and i'm at my wit's end :-/

This needs to be lan_dns instead of 1. There’s a LuCI bug at the moment.

1 Like

ok i tried setting it to the instance name rather than the numeric (any details on which bug/issue it is in the code, so i can see if my source tree has it/or can keep track of when it's fixed?)..

so now i got the right IP assigned, but i'm still getting the wrong subnet on the client's interface it's configuring via DHCP :frowning: so original problem i've been wrestling..

i suspect as i'm not using the typical 192.168.1.x subnet, where the default subnet mask happens to be the right one (255.255.255.0) - i'm using a different one where the subnet mask is not 255.255.255.0 (what i want), instead i am ending up with the default for a much larger subnet mask than what i've configured on the interface..

i guess i could try to work-around this by explicitly adding an override subnet mask to the dhcp reply but i thought this was supposed to determine the subnet mask from the interface automatically (and i triple checked it's set to /24 there)

I compared your dhcp config to mine and noted one difference.

I have a "option force" in my config and you use a "list dhcp_option_force '1'" which I don't understand.

Matti

1 Like

Since it is all internal private IPs, why don’t you post these subnet details here? What you configured, what you actually get, and what you think it should be.

I don’t see anything wrong on the surface with what you’ve posted. The lan interface uses 255.255.255.0 mask.

2 Likes

fair point.. i'm probably needlessly trying to hide things that are already in a private address space anyway.

with details:

so i have three adjacent vlans.. 2222, 2220, and 2020 (you can tell what my fav number is).

vlan 2222 is for management, my most security-sensitive hosts, and i only set up two IPs here, my router and my switch.. so this gets a subnet mask of /30 and the IPv4 range is 172.22.22.20-24 (usable ip .21 and .22, the latter being the main openwrt instance that i wish to be able to only admin (reach http/https/ssh on - that is a TBD after this problem is fixed)
vlan 2220 is for what i call the regular lan, still somewhat sensitive but not as sensitive as vlan 2222, it's for my server and any other network gear that has an administrative interface here.. the IPv4 range is 172.22.20.0/24 and so that subnet SHOULD be 255.255.255.0 (but my laptop which i plug in here when docked keeps gettin a 255.255.0.0, which means it thinks it ends up OVERLAPPING the IPs on vlan 2222 and hence they try to arp thinking they're on the same layer 3 domain, instead of going through the gateway and doing routing to the other network

finally i also have vlan 2020 which i intended to be where i have wifi devices connected, and would only be able to reach vlan 2220 but not vlan 2222.. this one has an IPv4 range of 172.20.20.0/23

so i realize recently (few hours ago this morning after a good sleep on it) that i accident set the vlan 2020 netmask as /22 (255.255.252.0), which inadvertantly overlapped both 2220 and 2222 (doh!) but since have corrected it to 255.255.254.0 (the right one for a /23) - and restarted dnsmasq, rebooted the router several times, and prayed and cursed several times since..

here's what /etc/config/network looks like:

config interface 'mgmt'
        option proto 'static'
        option device 'br-lan.2222'
        option ipaddr '172.22.22.22'
        option netmask '255.255.255.252'

config interface 'lan'
        option device 'br-lan.2220'
        option proto 'static'
        option ipaddr '172.22.20.1'
        option netmask '255.255.255.0'

config interface 'home'
        option proto 'static'
        option device 'br-lan.2020'
        option ipaddr '172.20.20.1'
        option netmask '255.255.254.0'

contents of /etc/config/dhcp:

config dnsmasq 'lan_dns'
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan.home.mydomain/'
        option domain 'lan.home.mydomain'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases.lan'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        list interface 'lan'
        list notinterface 'loopback'
        list server '208.67.222.222'
        list server '208.67.220.220'
        list rebind_domain '/mydomain/'
        option localservice '1'

config dhcp 'lan'
        option instance 'lan_dns'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '2m'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list dhcp_option_force '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        list dhcp_option '1,255.255.255.0'
        list dhcp_option '15,lan.home.mydomain'
        list dhcp_option '119,lan.home.mydomain,mgmt.home.mydomain'

config host
        option name 'aleksWorkMBP-docked'
        option ip '172.22.20.20'
        option mac '8C:AE:4C:DE:0C:20'
        option dns '1'
        option duid '000100012c4a8fc6bcd074adbfc7'
        option instance 'lan_dns'
        option hostid '00000001'
        option leasetime '2m'


config dnsmasq 'home_dns'
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/wifi.home.mydomain/'
        option domain 'wifi.home.mydomain'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases.home'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        list interface 'home'
        list notinterface 'loopback'
        list server '208.67.222.222'
        list server '208.67.220.220'
        list rebind_domain '/mydomain/'
        option localservice '1'

config dhcp 'home'
        option instance 'home_dns'
        option interface 'home'
        option start '100'
        option limit '150'
        option leasetime '2m'
        option ra 'server'
        option dhcpv6 'server'
        list dhcp_option_force '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        list dhcp_option '1,255.255.254.0'
        list dhcp_option '15,wifi.home.mydomain'
        list dhcp_option '119,wifi.home.mydomain,lan.home.mydomain'

i've also realized that my wifi network (vlan 2020) ALSO is getting a 255.255.0.0 subnet mask (same issue, same client, different interface)..

and i've even gone so far to set the subnet-mask override option in openwrt for network-interfaces / interface-edit / dhcp-server / advanced tab AS WELL AS setting dhcp-option 1 (subnet) AND verifying it appears in the output of /tmp/etc/dnsmasq*

root@router-main:/etc/config# grep 255 /tmp/etc/dnsmasq.conf.*
/tmp/etc/dnsmasq.conf.home_dns:dhcp-range=set:home,172.20.20.100,172.20.20.249,255.255.254.0,2m
/tmp/etc/dnsmasq.conf.home_dns:dhcp-option=home,1,255.255.254.0
/tmp/etc/dnsmasq.conf.lan_dns:dhcp-range=set:lan,172.22.20.100,172.22.20.249,255.255.255.0,2m
/tmp/etc/dnsmasq.conf.lan_dns:dhcp-option=lan,1,255.255.255.0
/tmp/etc/dnsmasq.conf.mgmt_dns:dhcp-range=set:mgmt,172.22.22.21,172.22.22.21,255.255.255.252,12h
/tmp/etc/dnsmasq.conf.mgmt_dns:dhcp-option=mgmt,1,255.255.255.252

so i suspect the issue is that for some reason my macbook is only considering this a classful network (e.g. a /16 for the 172.16.0.0/12 rfc1918 address space).. which is weird because the dhcpdump responses all say what the broadcast is but they are NOT providing a subnet mask in their response..

  TIME: 2023-09-19 12:22:01.514
    IP: 0.0.0.0 (8c:ae:4c:ab:cd:20) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 8d746987
  SECS: 0
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:ab:cd:20:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 12) Parameter Request List      1 (Subnet mask)
                                            121 (Classless Static Route)
                                              3 (Routers)
                                              6 (DNS server)
                                             15 (Domainname)
                                            108 (Swap Path)
                                            114 (URL)
                                            119 (Domain Search)
                                            252 (MSFT - WinSock Proxy Auto Detect)
                                             95 (LDAP)
                                             44 (NetBIOS name server)
                                             46 (NetBIOS node type)

OPTION:  57 (  2) Maximum DHCP message size 1500
OPTION:  61 (  7) Client-identifier         01:8c:ae:4c:ab:cd:20
OPTION:  51 (  4) IP address leasetime      7776000 (12w6d)
OPTION:  12 ( 12) Host name                 aleksWorkMBP
---------------------------------------------------------------------------

  TIME: 2023-09-19 12:22:01.514
    IP: 172.22.20.1 (60:38:e0:c2:bd:10) > 172.22.20.20 (8c:ae:4c:ab:cd:20)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 8d746987
  SECS: 0
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 172.22.20.20
SIADDR: 172.22.20.1
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:ab:cd:20:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         2 (DHCPOFFER)
OPTION:  54 (  4) Server identifier         172.22.20.1
OPTION:  51 (  4) IP address leasetime      120 (2m)
OPTION:  58 (  4) T1                        60 (60s)
OPTION:  59 (  4) T2                        105 (1m45s)
OPTION:  28 (  4) Broadcast address         172.22.20.255
OPTION:   3 (  4) Routers                   172.22.20.1
OPTION:   6 (  4) DNS server                172.22.20.1
OPTION: 119 ( 25) Domain Search             036c616e04686f6d .lan.hom...
OPTION:  15 ( 16) Domainname                lan.home.mydomain
---------------------------------------------------------------------------

  TIME: 2023-09-19 12:22:02.525
    IP: 0.0.0.0 (8c:ae:4c:ab:cd:20) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 8d746987
  SECS: 1
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:ab:cd:20:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  55 ( 12) Parameter Request List      1 (Subnet mask)
                                            121 (Classless Static Route)
                                              3 (Routers)
                                              6 (DNS server)
                                             15 (Domainname)
                                            108 (Swap Path)
                                            114 (URL)
                                            119 (Domain Search)
                                            252 (MSFT - WinSock Proxy Auto Detect)
                                             95 (LDAP)
                                             44 (NetBIOS name server)
                                             46 (NetBIOS node type)
                                            
OPTION:  57 (  2) Maximum DHCP message size 1500
OPTION:  61 (  7) Client-identifier         01:8c:ae:4c:ab:cd:20
OPTION:  50 (  4) Request IP address        172.22.20.20
OPTION:  54 (  4) Server identifier         172.22.20.1
OPTION:  12 ( 12) Host name                 aleksWorkMBP
---------------------------------------------------------------------------

  TIME: 2023-09-19 12:22:02.525
    IP: 172.22.20.1 (60:38:e0:c2:bd:10) > 172.22.20.20 (8c:ae:4c:ab:cd:20)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: 8d746987
  SECS: 1
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 172.22.20.20
SIADDR: 172.22.20.1
GIADDR: 0.0.0.0
CHADDR: 8c:ae:4c:ab:cd:20:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         172.22.20.1
OPTION:  51 (  4) IP address leasetime      120 (2m)
OPTION:  58 (  4) T1                        60 (60s)
OPTION:  59 (  4) T2                        105 (1m45s)
OPTION:  28 (  4) Broadcast address         172.22.20.255
OPTION:   3 (  4) Routers                   172.22.20.1
OPTION:   6 (  4) DNS server                172.22.20.1
OPTION: 119 ( 25) Domain Search             036c616e04686f6d .lan.hom..
OPTION:  15 ( 16) Domainname                lan.home.mydomain

For my benefit (since I don’t use Mac OS), where is it showing the /16 mask?

output of ifconfig en8 (the docked interface):

en8: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        options=6467<RXCSUM,TXCSUM,VLAN_MTU,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
        ether 8c:ae:4c:xx:xx:20 
        inet 172.22.20.20 netmask 0xffff0000 broadcast 172.22.255.255
        media: autoselect (1000baseT <full-duplex>)
        status: active

Note the 0xffff0000 , this translates to 255.255.0.0 :frowning:

what i am finding most strange is that dnsmasq, even though configured to (in /tmp/etc/dnsmasq.conf.lan:

dhcp-range=set:lan,172.22.20.100,172.22.20.249,255.255.255.0,2m
dhcp-option=lan,1,255.255.255.0
dhcp-option=lan,15,lan.home.mydomain
dhcp-option=lan,119,lan.home.mydomain,mgmt.home.mydomain
dhcp-option-force=lan,1

and yet it does NOT provide a subnet in its response (see above for the dhcpdump output)

i think it stands to reason that is the reason my subnet is being calculated incorrectly on the macos side, but i'm completely clueless as the cause of no subnet-mask being provided in the dhcp response from dnsmasq

I had a feeling this is related to the multiple dnsmasq instances, as that's the last major change i did before having the correct subnet-mask stopped working correctly..

so i rolled back to the single-instance dnsmasq and now get the right subnet mask.. but now i am forced to use the same domain for all my vlans (the reason i switched to multi-instance of dnsmasq)

i can clearly see a subnet-mask as part of the response from dnsmasq in tcpdump w/ the single-instance dnsmasq (that was lacking when i was doing multi-instance):

13:47:23.342651 60:38:e0:xx:xx:10 > 8c:ae:4c:xx:xx:20, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 8691, offset 0, flags [none], proto UDP (17), length 328)
    172.22.20.1.67 > 172.22.20.20.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0x8d7469db, secs 36, Flags [none] (0x0000)
          Your-IP 172.22.20.20
          Server-IP 172.22.20.1
          Client-Ethernet-Address 8c:ae:4c:xx:xx:20
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: ACK
            Server-ID Option 54, length 4: 172.22.20.1
            Lease-Time Option 51, length 4: 43200
            RN Option 58, length 4: 21600
            RB Option 59, length 4: 37800
            Subnet-Mask Option 1, length 4: 255.255.255.0
            BR Option 28, length 4: 172.22.20.255
            Default-Gateway Option 3, length 4: 172.22.20.1
            Domain-Name-Server Option 6, length 4: 172.22.20.1
            Domain-Name Option 15, length 3: "lan"
            END Option 255, length 0
            PAD Option 0, length 0, occurs 3

where as before, previously with multi-dnsmasq instance:

13:44:46.064691 60:38:e0:xx:xx:10 > 8c:ae:4c:xx:xx:20, ethertype IPv4 (0x0800), length 373: (tos 0xc0, ttl 64, id 39706, offset 0, flags [none], proto UDP (17), length 359)
    172.22.20.1.67 > 172.22.20.20.68: [udp sum ok] BOOTP/DHCP, Reply, length 331, xid 0x8d7469d9, Flags [none] (0x0000)
          Your-IP 172.22.20.20
          Server-IP 172.22.20.1
          Client-Ethernet-Address 8c:ae:4c:xx:xx:20
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: Offer
            Server-ID Option 54, length 4: 172.22.20.1
            Lease-Time Option 51, length 4: 120
            RN Option 58, length 4: 60
            RB Option 59, length 4: 105
            BR Option 28, length 4: 172.22.20.255
            Default-Gateway Option 3, length 4: 172.22.20.1
            Domain-Name-Server Option 6, length 4: 172.22.20.1
            T119 Option 119, length 25: 3.108.97.110.4.104.111....
            Domain-Name Option 15, length 16: "lan.home.mydomain"
            END Option 255, length 0

i'm officially stumped.. bug in dnsmasq?

I think you would need to also supply the option value. So in this case, you are forcing a blank subnet mask. Try removing it completely, as well as the explicit subnet dhcp-option=lan,1,255.255.255.0

2 Likes

HALLELUJIAH!! that was it!!

i would have never ended up figuring this out.. i even just posted to the dnsmasq-discuss mailing list.. let me go let them know we (you) figured it out.

some background on how i came to this config - i had put the force tag in there because i thought it would speed up the dnsmasq restart time (i had been hanging for a few seconds for each interface with udhcpc: no lease, failing message, which i learned was because it was trying to detect if any other dhcp server were there, though i knew they weren't so i thought the force would bypass that check.. without realizing it would introduce this strange subnet-mask eliminating side-effect

a thousand thanks!!

1 Like

The force option in the dhcp lan section should prevent the check. The dhcp_option_force list parameter is what tripped things up.

3 Likes

DOH! seems i just used the wrong parameter due to a very similar name then (even if for the right reason) and ended up shooting myself in the foot :-/

2 Likes

(not putting the right instance value in /etc/config/dhcp)

found this PR from yesterday, as an answer to my own question, in case anyone come across this.

1 Like

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