<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[&quot;Register DHCP leases in DNS forwarder&quot; needs dnsmasq restarted after reboot]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">After each reboot of the router, I need to restart dnsmasq in order to add DHCP leases to /etc/hosts.</p>
<p dir="auto">There seem to be 2 bugs,</p>
<ol>
<li>Code is not run in right sequence at boot time</li>
<li>Code is run 3 times (or 3 threads?) at least when "restarting"</li>
</ol>
<p dir="auto">After boot:</p>
<pre><code class="language-java">[2.4.4-RELEASE][root@pfSense.lan]/root: cat /etc/hosts
127.0.0.1	localhost localhost.lan
::1	localhost localhost.lan
192.168.1.1	pfSense.lan pfSense
</code></pre>
<p dir="auto">After "restarting" dnsmasq (Services -&gt; DNS Forwarder -&gt; Save -&gt; Apply Changes), each host is then written (3 times!?) to /etc/hosts.</p>
<pre><code class="language-java">[2.4.4-RELEASE][root@pfSense.lan]/root: cat /etc/hosts
127.0.0.1	localhost localhost.lan
::1	localhost localhost.lan
192.168.1.1	pfSense.lan pfSense

# dhcpleases automatically entered
192.168.1.172	Apple-TV-4K.lan Apple-TV-4K		# dynamic entry from dhcpd.leases
192.168.1.102	Marks-iPhone-X.lan Marks-iPhone-X		# dynamic entry from dhcpd.leases
192.168.1.106	Marks-iPad-Pro.lan Marks-iPad-Pro		# dynamic entry from dhcpd.leases
192.168.1.183	MarksiPne6SPlus.lan MarksiPne6SPlus		# dynamic entry from dhcpd.leases
192.168.1.179	freebsd.lan freebsd		# dynamic entry from dhcpd.leases
192.168.1.171	Philips-hue.lan Philips-hue		# dynamic entry from dhcpd.leases
192.168.1.105	Samsung-Galaxy-S7-edge.lan Samsung-Galaxy-S7-edge		# dynamic entry from dhcpd.leases
192.168.1.180	tado.lan tado		# dynamic entry from dhcpd.leases
192.168.1.187	nuc.lan nuc		# dynamic entry from dhcpd.leases

# dhcpleases automatically entered
192.168.1.183	MarksiPne6SPlus.lan MarksiPne6SPlus		# dynamic entry from dhcpd.leases
192.168.1.172	Apple-TV-4K.lan Apple-TV-4K		# dynamic entry from dhcpd.leases
192.168.1.102	Marks-iPhone-X.lan Marks-iPhone-X		# dynamic entry from dhcpd.leases
192.168.1.106	Marks-iPad-Pro.lan Marks-iPad-Pro		# dynamic entry from dhcpd.leases
192.168.1.179	freebsd.lan freebsd		# dynamic entry from dhcpd.leases
192.168.1.171	Philips-hue.lan Philips-hue		# dynamic entry from dhcpd.leases
192.168.1.105	Samsung-Galaxy-S7-edge.lan Samsung-Galaxy-S7-edge		# dynamic entry from dhcpd.leases
192.168.1.180	tado.lan tado		# dynamic entry from dhcpd.leases
192.168.1.187	nuc.lan nuc		# dynamic entry from dhcpd.leases

# dhcpleases automatically entered
192.168.1.183	MarksiPne6SPlus.lan MarksiPne6SPlus		# dynamic entry from dhcpd.leases
192.168.1.172	Apple-TV-4K.lan Apple-TV-4K		# dynamic entry from dhcpd.leases
192.168.1.102	Marks-iPhone-X.lan Marks-iPhone-X		# dynamic entry from dhcpd.leases
192.168.1.106	Marks-iPad-Pro.lan Marks-iPad-Pro		# dynamic entry from dhcpd.leases
192.168.1.179	freebsd.lan freebsd		# dynamic entry from dhcpd.leases
192.168.1.171	Philips-hue.lan Philips-hue		# dynamic entry from dhcpd.leases
192.168.1.105	Samsung-Galaxy-S7-edge.lan Samsung-Galaxy-S7-edge		# dynamic entry from dhcpd.leases
192.168.1.180	tado.lan tado		# dynamic entry from dhcpd.leases
192.168.1.187	nuc.lan nuc		# dynamic entry from dhcpd.leases
</code></pre>
<p dir="auto">Coming from OpenWrt, I'm pretty used to just having dnsmasq solve DHCP-provided hostnames automatically without me having to maintain static mappings. I guess the feature is implemented externally (PHP) in pfSense because it uses dhcpd instead of dnsmasq for DHCP server.</p>
<p dir="auto">It's been a while since I touched any PHP, but I'm pretty sure I won't be able to solve this myself.</p>
]]></description><link>https://forum.netgate.com/topic/139030/register-dhcp-leases-in-dns-forwarder-needs-dnsmasq-restarted-after-reboot</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 03:54:19 GMT</lastBuildDate><atom:link href="https://forum.netgate.com/topic/139030.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 25 Dec 2018 20:45:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &quot;Register DHCP leases in DNS forwarder&quot; needs dnsmasq restarted after reboot on Wed, 26 Dec 2018 11:20:07 GMT]]></title><description><![CDATA[<p dir="auto">Right !</p>
<p dir="auto">I saw the same thing.<br />
After a clean boot - using dnsmasq : /etc/hosts seems ok - all my static DHCP are present.</p>
<p dir="auto">Restarting it, and ...</p>
<pre><code class="language-java">[2.4.4-RELEASE][admin@pfsense.brit-hotel-fumel.net]/root: cat /etc/hosts
127.0.0.1       localhost localhost.brit-hotel-fumel.net
::1     localhost localhost.brit-hotel-fumel.net
192.168.1.1     pfsense.brit-hotel-fumel.net pfsense
.......
2001:470:1f13:5c0:2::c4 Tactile1.brit-hotel-fumel.net Tactile1
2001:470:1f13:5c0:2::c5 Tactile2.brit-hotel-fumel.net Tactile2

# dhcpleases automatically entered
192.168.1.95    iPhonevanDiane.brit-hotel-fumel.net iPhonevanDiane              # dynamic entry from dhcpd.leases
192.168.1.94    iPhonevanPieter.brit-hotel-fumel.net iPhonevanPieter            # dynamic entry from dhcpd.leases
192.168.1.98    iPhonevebruiker.brit-hotel-fumel.net iPhonevebruiker            # dynamic entry from dhcpd.leases
192.168.2.148   Galaxy-J3.brit-hotel-fumel.net Galaxy-J3                # dynamic entry from dhcpd.leases
192.168.2.207   Galaxy-A5-2016.brit-hotel-fumel.net Galaxy-A5-2016              # dynamic entry from dhcpd.leases

# dhcpleases automatically entered
192.168.1.95    iPhonevanDiane.brit-hotel-fumel.net iPhonevanDiane              # dynamic entry from dhcpd.leases
192.168.1.94    iPhonevanPieter.brit-hotel-fumel.net iPhonevanPieter            # dynamic entry from dhcpd.leases
192.168.1.98    iPhonevebruiker.brit-hotel-fumel.net iPhonevebruiker            # dynamic entry from dhcpd.leases
192.168.2.148   Galaxy-J3.brit-hotel-fumel.net Galaxy-J3                # dynamic entry from dhcpd.leases
192.168.2.207   Galaxy-A5-2016.brit-hotel-fumel.net Galaxy-A5-2016              # dynamic entry from dhcpd.leases

# dhcpleases automatically entered
192.168.1.95    iPhonevanDiane.brit-hotel-fumel.net iPhonevanDiane              # dynamic entry from dhcpd.leases
192.168.1.94    iPhonevanPieter.brit-hotel-fumel.net iPhonevanPieter            # dynamic entry from dhcpd.leases
192.168.1.98    iPhonevebruiker.brit-hotel-fumel.net iPhonevebruiker            # dynamic entry from dhcpd.leases
192.168.2.148   Galaxy-J3.brit-hotel-fumel.net Galaxy-J3                # dynamic entry from dhcpd.leases
192.168.2.207   Galaxy-A5-2016.brit-hotel-fumel.net Galaxy-A5-2016              # dynamic entry from dhcpd.leases
</code></pre>
<p dir="auto">All my LAN network devices have static mapped IP's (all are trusted devices).<br />
Only devices that have no static DHCP map will multiply in the /etc/hosts file.</p>
<p dir="auto">I have found a work around : I'm using the default resolver (unbound) for the last 2 years ;)</p>
<p dir="auto">Btw : It's /usr/local/sbin/dhcpleases who is responsible for the host file updating.</p>
]]></description><link>https://forum.netgate.com/post/813378</link><guid isPermaLink="true">https://forum.netgate.com/post/813378</guid><dc:creator><![CDATA[Gertjan]]></dc:creator><pubDate>Wed, 26 Dec 2018 11:20:07 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;Register DHCP leases in DNS forwarder&quot; needs dnsmasq restarted after reboot on Tue, 25 Dec 2018 21:37:26 GMT]]></title><description><![CDATA[<p dir="auto">Yeah, so I couldn't help myself from cloning the repo and look at the code :-)</p>
<p dir="auto">In system_hosts_generate() at etc/inc/system.inc:569 I see this condition which I'm guessing could explain why it doesn't work at boot:</p>
<pre><code class="language-java">if (!platform_booting()) {
	system_dhcpleases_configure();
}
</code></pre>
<p dir="auto">Any idea why the condition is there? I'll look into the boot process of pfSense next time I have an hour to burn :-)</p>
<p dir="auto">I can also see that dhcpd.leases parsing is done by /usr/local/sbin/dhcpleases. I still can't figure out why it repeats 3 times though...</p>
]]></description><link>https://forum.netgate.com/post/813326</link><guid isPermaLink="true">https://forum.netgate.com/post/813326</guid><dc:creator><![CDATA[rosenstand]]></dc:creator><pubDate>Tue, 25 Dec 2018 21:37:26 GMT</pubDate></item></channel></rss>