<?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>Made of Bugs &#187; ubuntu</title>
	<atom:link href="http://blog.nelhage.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nelhage.com</link>
	<description>It's software. It's made of bugs.</description>
	<lastBuildDate>Thu, 18 Aug 2011 21:57:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>wpa_supplicant: GUI and wpa_action</title>
		<link>http://blog.nelhage.com/2008/09/wpa_supplicant-gui-and-wpa_action/</link>
		<comments>http://blog.nelhage.com/2008/09/wpa_supplicant-gui-and-wpa_action/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 16:07:49 +0000</pubDate>
		<dc:creator>nelhage</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wpa_supplicant]]></category>

		<guid isPermaLink="false">http://blog.nelhage.com/?p=13</guid>
		<description><![CDATA[I&#8217;ve made two new interesting discoveries about wpa_supplicant since writing my last blog post on the subject. (Actually, I pretty much made both of them while reading documentation in order to write it, and have been lame about writing them up). Using wpa_gui It turns out that wpa_gui not only allows you to select existing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made two new interesting discoveries about <code>wpa_supplicant</code> since
writing my last blog post on the subject. (Actually, I pretty much
made both of them while reading documentation in order to write it,
and have been lame about writing them up).</p>

<h2>Using <code>wpa_gui</code></h2>

<p>It turns out that <code>wpa_gui</code> not only allows you to select existing
networks, but also to scan for and add new networks to your
configuration file. In addition, you can run it as yourself, without
needing to <code>sudo</code> it. In order to do so, you need to add two lines to
<code>/etc/wpa_supplicant/wpa_supplicant.conf</code>:</p>

<pre><code>ctrl_interface_group=netdev
update_config=1
</code></pre>

<p><code>ctrl_interface_group</code> selects a UNIX group that will be given
permission to read/write the control socket. I chose <code>netdev</code> because
it seems like it&#8217;s supposed to be networking-related, and my login
user was already in it on my Ubuntu machine.</p>

<p><code>update_config</code> allows <code>wpa_supplicant</code> to write back to its conf file
if instructed to configure new networks by a UI (<code>wpa_cli</code> or
<code>wpa_gui</code>). Note that this will squash any comments you have in the
file.</p>

<h2><code>wpa_action</code> — a mostly-baked roaming solution</h2>

<p>The setup I described in the previous post causes <code>wpa_supplicant</code> to
manage associating with access points, while Debian&#8217;s <code>ifupdown</code>
request DHCP independently. There&#8217;s no communication between the
layer, so if you switch networks, or associate sometime <em>after</em> we
bring up the interface, nothing tells <code>dhclient</code> to request a new
lease. It turns out we can turn this picture inside-out, and make
<code>wpa_supplicant</code> responsible for bringing up and down a virtual
interface, whenever it associates or loses association.</p>

<p>To make this work, we&#8217;re going to need to edit
<code>/etc/network/interface</code> again. Our <code>wpa_supplicant.conf</code> can stay
unchanged; Debian&#8217;s wrapper scripts do all the magic. Replace your
<code>ath0</code> block and add a virtual <code>default</code> interface as follows:</p>

<pre><code>iface ath0 inet manual
  wpa-driver wext
  wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
</code></pre>

<p>The way this is going to work is that, whenever <code>wpa_supplicant</code>
associates to a network, it will bring up the virtual <code>default</code>
interface, causing <code>ifupdown</code> to spawn <code>dhclient</code> and request
DHCP. When it loses association, it brings it down, killing the DHCP
daemon.</p>

<p>Furthermore, we can associate different virtual interfaces with
different networks. Suppose that I usually want DHCP, but at home
(essid <code>nelhage</code>) I don&#8217;t run a DHCP server, and just want my laptop
to always grab <code>10.0.1.100</code>. I can add an interface to
<code>wpa_supplicant.conf</code>:</p>

<pre><code>network={
    ssid="nelhage"
    id_str="nelhage"
    key_mgmt=NONE
}
</code></pre>

<p>And then I add a new virtual interface to <code>interfaces</code>, corresponding
to the <code>id_str</code>:</p>

<pre><code>iface nelhage inet static
        address 10.0.1.100
        netmask 255.255.255.0
        network 10.0.1.0
        gateway 10.0.1.1
</code></pre>

<p>Now, if <code>wpa_supplicant</code> associates to the <code>nelhage</code> network, it will
bring up the <code>nelhage</code> interface, binding <code>ath0</code> to the static
configuration there listed.</p>

<p>For documentation, check out the third section of
<code>/usr/share/doc/wpasupplicant/README.modes.gz</code> on your Debian or
Ubuntu machine.</p>

<h2>In conclusion&#8230;</h2>

<p>This setup actually seems pretty close to the correct design for a
roaming wifi architecture, to me. Unfortunately, my experience is that
it hasn&#8217;t worked well for me; For some reason, when I put it in
roaming mode, it fails to associate with networks that it otherwise
works fine with. I suspect that this is related to <code>madwifi</code> suckage
as much as <code>wpa_supplicant</code> suck, though, so I&#8217;d encourage everyone
else who&#8217;s been fighting with wifi to try it out and report back if it
works for them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nelhage.com/2008/09/wpa_supplicant-gui-and-wpa_action/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

