Forums

Resolved
0 votes
Recent install of ClearOS 7 using the dnsmasq DHCP server has been giving me problems when trying to set up the TFTP server for Cisco VoIP phones (specifically, the SPA-303).

This ClearOS question is possibly related.

In spite of specifying the TFTP IP address in the COS DHCP setup for the interface, the phone simply wasn't recognising any option 66 setting at all.

I checked the /etc/dnsmasq.d/dhcp.conf file and it had what looked like the correct value, specified within quotes as normally required. The only odd thing about this is that the dnsmasq man page I was looking at (here) said nothing about a dhcp.conf and seemed to imply that all options should be in /etc/dnsmasq.conf. Content of these two files were:

/etc/dnsmasq.d/dhcp.conf:
bogus-priv
cache-size=5000
conf-dir=/etc/dnsmasq.d
dhcp-authoritative
dhcp-lease-max=1000
domain-needed
domain=zzzzzzzz.co
expand-hosts
no-negcache
port=53
resolv-file=/etc/resolv-peerdns.conf
strict-order
user=nobody



dnsmasq.d/dhcp.conf: (enp3s0 - enp6s0 are four ethernet adaptors)
dhcp-option=enp3s0,1,255.255.255.0
dhcp-option=enp3s0,28,10.10.24.255
dhcp-option=enp3s0,3,10.10.24.5
dhcp-option=enp3s0,6,10.10.24.5
dhcp-option=enp4s0,1,255.255.255.0
dhcp-option=enp4s0,28,192.168.0.255
dhcp-option=enp4s0,3,192.168.0.5
dhcp-option=enp4s0,6,192.168.0.5
dhcp-option=enp4s0,66,"192.168.0.5"
dhcp-range=enp3s0,10.10.24.100,10.10.24.254,24h
dhcp-range=enp4s0,192.168.0.10,192.168.0.99,24h
read-ethers


I tried without the quotes, which made no difference in that it still didn't work, although the phone was getting a bogus IP address for TFTP rather than nothing at all. This is a clue that all is not well with TFTP, but ok with DHCP generally since the client was getting DNS and host IP addresses.

Anyway, I resorted to tcpdump and looking at the DHCP traffic I could see that in the DHCP packet the option 66 string was preceded by a length of 12 followed by text 192.168.0.5 followed by a 0x00 byte. That didn't look good, RFC-2132 for DHCP isn't very specific but it never talks about null-terminated strings.

After some more dickering about I found that the same option 66 could be put into the dnsmasq.conf file and in there it works fine. Trouble is, if I change anything in the COS configuration for DNS or DHCP, I lose this setting. Don't want that - this box is headed for a small business and possibly out of my hands. I also don't know where /etc/dnsmasq.d/dhcp.conf comes into the picture. It isn't mentioned in any of the man pages or other documentation I can find. Maybe it's a ClearOS thing. Who knows, but it sure ain't workin' right.

I suspect many DHCP clients won't care about the null character at the end of the string, so it hasn't come to light before now. I'd be keen to know if this is a ClearOS or a dnsmasq bug. I'm even ok about fixing it myself if anyone cares to point me in the right direction.

Thanks.
Sunday, August 28 2016, 01:57 PM

Location [ View Larger Map ]

http://maps.googleapis.com/maps/api/staticmap?center=-43.7542275,171.16372449999994&language=en&maptype=roadmap&zoom=5&size=450x300&sensor=true&markers=color:red|label:S|-43.7542275,171.16372449999994
Share this post:
Responses (2)
  • Accepted Answer

    Tuesday, September 06 2016, 07:32 AM - #Permalink
    Resolved
    0 votes
    Thanks Nick, that heads me down the right path.

    Just for the record, what I ended up doing is removing the dhcp-option=enp4s0,66,"192.168.0.5" line, and adding another config file to /etc/dnsmasq.d, containing the same thing but for port 150 which the phone also will accept. Option 150 works fine

    dnsmasq, it turns out reads all config files in dnsmasq.d so with a different name ClearOS won't overwrite it.
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, August 28 2016, 05:14 PM - #Permalink
    Resolved
    0 votes
    I'm away from my system for a while so I can't check, but you may find that the dnsmasq start up uses /etc/dnsmasq.conf and any files it finds in /etc/dnsmasq.d/. This would allow you to create your own file there with your own options. I also think ClearOS leaves /etc/dnsmasq.conf pretty much alone so changes there are also safe.

    Your null string may be a dnsmasq bug.
    The reply is currently minimized Show
Your Reply