<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Local Loop &#187; static ip fallback</title>
	<atom:link href="http://localloop.co.za/tag/static-ip-fallback/feed/" rel="self" type="application/rss+xml" />
	<link>http://localloop.co.za</link>
	<description>Internet and Networking in South Africa</description>
	<lastBuildDate>Wed, 18 Apr 2012 12:27:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Linux home networking part 1: Static IP fall-back</title>
		<link>http://localloop.co.za/2009/02/linux-home-networking-part-1-static-ip-fall-back/</link>
		<comments>http://localloop.co.za/2009/02/linux-home-networking-part-1-static-ip-fall-back/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 07:58:42 +0000</pubDate>
		<dc:creator>Simeon Miteff</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[home networking]]></category>
		<category><![CDATA[ifplugd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networkmanager]]></category>
		<category><![CDATA[static ip fallback]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://localloop.co.za/?p=143</guid>
		<description><![CDATA[NetworkManager has made it&#8217;s way into the top Linux distributions as the standard way to manage network interfaces on desktop/notebook computers. I like NetworkManager. It works well for both wired and wireless interfaces with DHCP, and using wireless security and authentication is a breeze. With more recent versions you can also configure static IP addresses, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://projects.gnome.org/NetworkManager/"><code>NetworkManager</code></a> has made it&#8217;s way into the top Linux distributions as the standard way to manage network interfaces on desktop/notebook computers. I like <code>NetworkManager</code>. It works well for both wired and wireless interfaces with DHCP, and using wireless security and authentication is a breeze. With more recent versions you can also configure static IP addresses, but it doesn&#8217;t support a fall-back static IP configuration if DHCP fails to get a dynamic IP.</p>
<p>I need this capability, because my home network doesn&#8217;t have a router-like device to act as a DHCP server, but I would like to be able to take my notebook to work (or elsewhere), and use DHCP with minimal fuss.</p>
<p>It turns out this fall-back capability is supported in <code>dhcp3-client</code> (and perhaps other DHCP clients), by using a pre-defined lease in the config file (<code>/etc/dhcp3/dhclient.conf</code> on my Ubuntu 8.10 install):<br />
<code><br />
request subnet-mask, broadcast-address, time-offset, routers,<br />
        domain-name, domain-name-servers, domain-search, host-name,<br />
        netbios-name-servers, netbios-scope, interface-mtu;</p>
<p>timeout 10;</p>
<p>lease {<br />
  interface "eth0";<br />
  fixed-address 10.0.0.1;<br />
  option subnet-mask 255.255.255.0;<br />
  renew 2 2030/1/12 00:00:01;<br />
  rebind 2 2030/1/12 00:00:01;<br />
  expire 2 2030/1/12 00:00:01;<br />
}<br />
</code></p>
<p><code>dhcp3-client</code> will now try to get a lease from DHCP, and if it fails, it will configure the IP given in the pre-defined lease, effectively making this a static fall-back IP address.</p>
<p>Unfortunately when <code>NetworkManager</code> gets the news from the DHCP client that we could not get a lease from a DHCP server, it nukes the static configuration on the interface and takes us back to square one. I wanted a work-around that would allow me to keep <code>NetworkManager</code> (since I use it for my 3G modem too), so I came up with this:</p>
<p>I added the following stanza to my <code>/etc/network/interfaces</code> file:<br />
<code><br />
allow-hotplug eth0<br />
iface eth0 inet dhcp<br />
</code></p>
<p>This enables the standard Debian <code>ifup/ifdown</code> magic, and it also stops <code>NetworkManager</code> from managing the interface (which I don&#8217;t mind, since I never use 802.1x on wired networks).</p>
<p>In order to get back plug-and-play functionality (like <code>NetworkManager</code> provided by configuring the interface when it detected the link going up), I installed <code>ifplugd</code>, and configured it to watch my wired interface by changing <code>INTERFACES=""</code> to <code>INTERFACES="eth0"</code> in <code>/etc/default/ifplugd</code>, and restarting the daemon</code>.</p>
<p>An alternative to this setup would be to use IPv4LL addressing provided by <code>avahi-autoip</code>, but I prefer to manually allocate a static IP to each host.</p>
]]></content:encoded>
			<wfw:commentRss>http://localloop.co.za/2009/02/linux-home-networking-part-1-static-ip-fall-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

