<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=2863&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / dhclient - how to never ask for prior address? [SOLVED]]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=2863</link>
		<description><![CDATA[The most recent posts in dhclient - how to never ask for prior address? [SOLVED].]]></description>
		<lastBuildDate>Sun, 19 May 2019 19:14:13 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16175#p16175</link>
			<description><![CDATA[<p>I have a good-enough solution. It involves <strong>A) some changes in router</strong> (dhcp server side) and <strong>B) some changes in laptop</strong> (dhcp client side).</p><p>A. In router (assuming you, like me, are using dnsmasq as the dhcp server):</p><div class="codebox"><pre><code># pkill dnsmasq
# rm /var/lib/misc/dnsmasq.leases
# echo &quot;dhcp-sequential-ip&quot; &gt;&gt; /etc/dnsmasq.conf
# dnsmasq</code></pre></div><p>B. In my Devuan ASCII laptop (which unfortunately uses network-manager, which runs dhclient when appropriate):</p><div class="codebox"><pre><code># vi /etc/init.d/network-manager
add this line under the &#039;start)&#039; line: rm /var/lib/NetworkManager/dhclient*
# service network-manager restart</code></pre></div><p>Now, even with the default dhclient settings in my Devuan laptop, DHCP is working in a way that seems intuitive. Namely:<br />1. router leases out the first available IP<br />2. router keeps track of leases and repeatedly gives a particular IP to a particular machine only during life of the lease <br />3. when network-manager starts or restarts on a client machine, dhclient cannot ask for an old IP because there is no record</p><p>Problem solved <img src="http://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>P.S. Since I know Head_on_a_Stick likes both Devuan and OpenBSD (I&#039;m <em>brudan</em> on daemonforums.org, by the way), for an OpenBSD laptop/desktop, part B is simply adding <span class="bbc">!rm /var/db/dhclient.leases.\$if</span> to the top of your <span class="bbc">/etc/hostname.if</span> file.</p>]]></description>
			<author><![CDATA[dummy@example.com (GNUser)]]></author>
			<pubDate>Sun, 19 May 2019 19:14:13 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16175#p16175</guid>
		</item>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16170#p16170</link>
			<description><![CDATA[<p>Informative, thx. I happen to have a similar problem, but on the wired side of the router (my desktop always gets the same IP address, changing it always fails, now I know why. solution is simple: disconnect the ethernet cable on booting so the timer times out and a new IP address is obtained.)</p>]]></description>
			<author><![CDATA[dummy@example.com (Dutch_Master)]]></author>
			<pubDate>Sun, 19 May 2019 14:17:28 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16170#p16170</guid>
		</item>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16169#p16169</link>
			<description><![CDATA[<p>I don&#039;t use NetworkManager, sorry.</p><p>You could try ifupdown instead, any connections listed in /etc/network/interfaces will be ignored by NM so dhclient.conf will then be honoured:</p><p><a href="https://wiki.debian.org/NetworkConfiguration#Using_DHCP_to_automatically_configure_the_interface" rel="nofollow">https://wiki.debian.org/NetworkConfigur … _interface</a></p><p>EDIT: wireless instructions:</p><p><a href="https://wiki.debian.org/WiFi/HowToUse#WPA-PSK_and_WPA2-PSK" rel="nofollow">https://wiki.debian.org/WiFi/HowToUse#W … d_WPA2-PSK</a></p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sun, 19 May 2019 13:19:29 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16169#p16169</guid>
		</item>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16168#p16168</link>
			<description><![CDATA[<p>Thank you, Head_on_a_Stick. It seems NetworkManager parses /etc/dhcp/dhclient.conf then appends a few lines, to produce /var/lib/NetworkManager/dhclient-wlan0.conf. The latter file already contains <span class="bbc">request;</span>. This is what the complete /var/lib/NetworkManager/dhclient-wlan0.conf looks like:</p><div class="quotebox"><blockquote><div><p># Created by NetworkManager<br /># Merged from /etc/dhcp/dhclient.conf</p><p># Configuration file for /sbin/dhclient.<br />#<br /># This is a sample configuration file for dhclient. See dhclient.conf&#039;s<br />#&#160; &#160; man page for more information about the syntax of this file<br />#&#160; &#160; and a more comprehensive list of the parameters understood by<br />#&#160; &#160; dhclient.<br />#<br /># Normally, if the DHCP server provides reasonable information and does<br />#&#160; &#160; not leave anything out (like the domain name, for example), then<br />#&#160; &#160; few changes must be made to this file, if any.<br />#<br />option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;<br />#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;<br />#send dhcp-lease-time 3600;<br />#supersede domain-name &quot;fugue.com home.vix.com&quot;;<br />#prepend domain-name-servers 127.0.0.1;<br />#require subnet-mask, domain-name-servers;<br />#timeout 60;<br />#retry 60;<br />#reboot 10;<br />#select-timeout 5;<br />#initial-interval 2;<br />#script &quot;/sbin/dhclient-script&quot;;<br />#media &quot;-link0 -link1 -link2&quot;, &quot;link0 link1&quot;;<br />#reject 192.33.137.209;<br />#alias {<br />#&#160; interface &quot;eth0&quot;;<br />#&#160; fixed-address 192.5.5.213;<br />#&#160; option subnet-mask 255.255.255.255;<br />#}<br />#lease {<br />#&#160; interface &quot;eth0&quot;;<br />#&#160; fixed-address 192.33.137.200;<br />#&#160; medium &quot;link0 link1&quot;;<br />#&#160; option host-name &quot;andare.swiftmedia.com&quot;;<br />#&#160; option subnet-mask 255.255.255.0;<br />#&#160; option broadcast-address 192.33.137.255;<br />#&#160; option routers 192.33.137.250;<br />#&#160; option domain-name-servers 127.0.0.1;<br />#&#160; renew 2 2000/1/12 00:00:01;<br />#&#160; rebind 2 2000/1/12 00:00:01;<br />#&#160; expire 2 2000/1/12 00:00:01;<br />#}<br />send host-name &quot;thinkpad&quot;; # added by NetworkManager</p><p>option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;<br />option ms-classless-static-routes code 249 = array of unsigned integer 8;<br />option wpad code 252 = string;</p><p>request; # override dhclient defaults<br />also request subnet-mask;<br />also request broadcast-address;<br />also request time-offset;<br />also request routers;<br />also request domain-name;<br />also request domain-name-servers;<br />also request domain-search;<br />also request host-name;<br />also request dhcp6.name-servers;<br />also request dhcp6.domain-search;<br />also request dhcp6.fqdn;<br />also request dhcp6.sntp-servers;<br />also request netbios-name-servers;<br />also request netbios-scope;<br />also request interface-mtu;<br />also request rfc3442-classless-static-routes;<br />also request ntp-servers;<br />also request ms-classless-static-routes;<br />also request static-routes;<br />also request wpad;</p></div></blockquote></div><p>Any idea what needs to be changed in order to achieve the desired behavior?</p>]]></description>
			<author><![CDATA[dummy@example.com (GNUser)]]></author>
			<pubDate>Sun, 19 May 2019 12:12:54 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16168#p16168</guid>
		</item>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16167#p16167</link>
			<description><![CDATA[<div class="quotebox"><cite>GNUser wrote:</cite><blockquote><div><p>What I really want is a way of telling dhclient <strong>not</strong> to try to reacquire the last address it had. Any idea how to accomplish this?</p></div></blockquote></div><p>Try adding this to /etc/dhcp/dhclient.conf:</p><div class="codebox"><pre><code>request;</code></pre></div><p>See the LEASE REQUIREMENTS AND REQUESTS section of dhclient.conf(5) for more on this.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sun, 19 May 2019 11:36:02 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16167#p16167</guid>
		</item>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16166#p16166</link>
			<description><![CDATA[<p>Alas, things are never as simple as they seem. Not only do we need <strong>1</strong>) dhcp server sequential ip flag and <strong>2</strong>) delete server&#039;s lease file, but there are also considerations on the client side.</p><p>It seems that dhclient is hardwired to ask for the last IP address it got. This from dhclient.conf&#039;s man page:</p><div class="quotebox"><blockquote><div><p>When the client is restarted, it first tries to reacquire the last address it had. This is called the INIT-REBOOT state. If it is still attached to the same network it was attached to when it last ran, this is the quickest way to get started. The reboot statement sets the time that must elapse after the client first tries to reacquire its old address before it gives up and tries to discover a new address. By default, the reboot timeout is ten seconds.</p></div></blockquote></div><p>I tried putting <span class="bbc">reboot 0;</span> in my computer&#039;s <span class="bbc">/etc/dhcp/dhclient.conf</span>, but it has no effect. So I had to do this:<br /><strong>3</strong>) <span class="bbc"># rm /var/lib/NetworkManager/dhclient*</span></p><p>With 1-3 above I <em>finally</em> got the expected behavior of my computer getting the lowest-available IP address from the router. </p><p>But I&#039;m not satisfied because step 3 is a hack. What I really want is a way of telling dhclient <strong>not</strong> to try to reacquire the last address it had. Any idea how to accomplish this?</p>]]></description>
			<author><![CDATA[dummy@example.com (GNUser)]]></author>
			<pubDate>Sun, 19 May 2019 04:08:45 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16166#p16166</guid>
		</item>
		<item>
			<title><![CDATA[Re: dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16162#p16162</link>
			<description><![CDATA[<p>The dnsmasq man page solved the mystery of dhcp always giving particular computers particular IP addresses:</p><div class="quotebox"><blockquote><div><p>Dnsmasq&#160; is&#160; designed&#160; to&#160; choose&#160; IP addresses for DHCP clients<br />using a hash of the client&#039;s MAC address. This normally allows a<br />client&#039;s&#160; address to remain stable long-term, even if the client<br />sometimes allows its DHCP lease to expire.</p></div></blockquote></div><p>The <span class="bbc">--dhcp-sequential-ip</span> flag causes dnsmasq&#039;s behavior to be what I expected. Hope this helps anyone who finds themselves doing some head-scratching as I was <img src="http://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (GNUser)]]></author>
			<pubDate>Sat, 18 May 2019 22:45:28 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16162#p16162</guid>
		</item>
		<item>
			<title><![CDATA[dhclient - how to never ask for prior address? [SOLVED]]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=16154#p16154</link>
			<description><![CDATA[<p>I&#039;m doing some network troubleshooting and am surprised that the machines on my wireless network always get the same &quot;random&quot; IP address from my router, even after I delete all the leases in <span class="bbc">/var/lib/misc/dnsmasq.leases</span>.</p><p>The router has a startup job that creates <span class="bbc">/tmp/dnsmasq.conf</span> and then launches dnsmasq with this command: <span class="bbc">dnsmasq -C /tmp/dnsmasq.conf</span>. This is what <span class="bbc">/tmp/dnsmasq.conf</span> looks like:</p><div class="codebox"><pre><code>listen-address=192.168.10.1
bind-dynamic
dhcp-range=192.168.10.100,192.168.10.200,255.255.255.0,24h
dhcp-option-force=option:router,192.168.10.1
dhcp-option-force=option:dns-server,192.168.10.1
dhcp-option-force=option:mtu,1500</code></pre></div><p>How come machines get the same IP addresses even after I manually delete <span class="bbc">/var/lib/misc/dnsmasq.leases</span> and reboot the router? All the machines are configured to use DHCP, not a static local ip. There must be a record of prior IP addresses somewhere. Does dnsmasq have some kind of IP address cache? Maybe the Devuan ASCII computers somehow remember their prior IP address and ask for the same address again during DHCP negotiation?</p><p>Bottomline: How do I purge all memory of prior IP addresses so that all machines in my wireless network get new addresses the next time they talk to the router?</p>]]></description>
			<author><![CDATA[dummy@example.com (GNUser)]]></author>
			<pubDate>Sat, 18 May 2019 17:17:14 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=16154#p16154</guid>
		</item>
	</channel>
</rss>
