Added wpa service configuration to wpa_supplicant p age and few modifications to wpa and dhclient services.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@11012 af4574ff-66df-0310-9fd7-8a98e5e911e0
This commit is contained in:
Krejzi 2013-02-11 16:22:35 +00:00
parent 49f0ce046a
commit 97a30d62f6
3 changed files with 128 additions and 48 deletions

View File

@ -66,7 +66,7 @@ $Date$
<!ENTITY lfs-vim-version "7.3">
<!-- End LFS versions -->
<!ENTITY blfs-bootscripts-version "20130204">
<!ENTITY blfs-bootscripts-version "20130211">
<!ENTITY blfs-bootscripts-download "&downloads-root;/blfs-bootscripts-&blfs-bootscripts-version;.tar.bz2">
<!ENTITY blfs-wiki "http://wiki.&lfs-domainname;/blfs/wiki">

View File

@ -44,6 +44,16 @@
-->
<listitem>
<para>February 11th, 2013</para>
<itemizedlist>
<listitem>
<para>[krejzi] - Added wpa service configuration to
wpa_supplicant instructions.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>February 10th, 2013</para>
<itemizedlist>

View File

@ -207,12 +207,9 @@ popd</userinput></screen>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>install -v -m755 wpa_{cli,passphrase,supplicant} \
/sbin &amp;&amp;
install -v -m644 doc/docbook/wpa_supplicant.conf.5 \
/usr/share/man/man5 &amp;&amp;
install -v -m644 doc/docbook/wpa_{cli,passphrase,supplicant}.8 \
/usr/share/man/man8</userinput></screen>
<screen role="root"><userinput>install -v -m755 wpa_{cli,passphrase,supplicant} /sbin/ &amp;&amp;
install -v -m644 doc/docbook/wpa_supplicant.conf.5 /usr/share/man/man5/ &amp;&amp;
install -v -m644 doc/docbook/wpa_{cli,passphrase,supplicant}.8 /usr/share/man/man8/</userinput></screen>
<para>
If you have built <application>WPA Supplicant</application> with
@ -223,7 +220,7 @@ install -v -m644 doc/docbook/wpa_{cli,passphrase,supplicant}.8 \
</para>
<screen role="root"><userinput>install -v -m644 dbus/fi.{epitest.hostap.WPASupplicant,w1.wpa_supplicant1}.service \
/usr/share/dbus-1/system-services &amp;&amp;
/usr/share/dbus-1/system-services/ &amp;&amp;
install -v -m644 dbus/dbus-wpa_supplicant.conf \
/etc/dbus-1/system.d/wpa_supplicant.conf</userinput></screen>
@ -233,10 +230,9 @@ install -v -m644 dbus/dbus-wpa_supplicant.conf \
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>
install -v -m755 wpa_gui-qt4/wpa_gui /usr/bin/ &amp;&amp;
install -v -m644 doc/docbook/wpa_gui.8 /usr/share/man/man8/ &amp;&amp;
install -v -m644 wpa_gui-qt4/wpa_gui.desktop /usr/share/applications/ &amp;&amp;
<screen role="root"><userinput>install -v -m755 wpa_gui-qt4/wpa_gui /usr/bin/ &amp;&amp;
install -v -m644 doc/docbook/wpa_gui.8 /usr/share/man/man8/ &amp;&amp;
install -v -m644 wpa_gui-qt4/wpa_gui.desktop /usr/share/applications/ &amp;&amp;
install -v -m644 wpa_gui-qt4/icons/wpa_gui.svg /usr/share/pixmaps/</userinput></screen>
<note>
@ -249,6 +245,7 @@ install -v -m644 wpa_gui-qt4/icons/wpa_gui.svg /usr/share/pixmaps/</userinput></
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../../xincludes/update-desktop-database.xml"/>
</sect2>
<sect2 role="configuration">
@ -256,12 +253,16 @@ install -v -m644 wpa_gui-qt4/icons/wpa_gui.svg /usr/share/pixmaps/</userinput></
<sect3 id="wpa_supplicant-config">
<title>Config File</title>
<para><filename>/etc/wpa_supplicant.conf</filename></para>
<para>
<filename>/etc/sysconfig/wpa_supplicant-*.conf</filename>
</para>
<indexterm zone="wpa_supplicant wpa_supplicant-config">
<primary
sortas="e-etc-wpa_supplicant.conf">/etc/wpa_supplicant.conf</primary>
sortas="e-etc-sysconfig-wpa_supplicant-star.conf">/etc/sysconfig/wpa_supplicant-*.conf</primary>
</indexterm>
</sect3>
<sect3>
@ -269,26 +270,27 @@ install -v -m644 wpa_gui-qt4/icons/wpa_gui.svg /usr/share/pixmaps/</userinput></
<para>
To connect to an access point that uses a password, you need to put
the pre-shared key in <filename>/etc/wpa_supplicant.conf</filename>. Use
<command>wpa_passphrase</command> to generate this. SSID is the string
that the access point/router transmits to identify itself. As the
the pre-shared key in <filename>
/etc/sysconfig/wpa_supplicant-<replaceable>wlan0</replaceable>.conf</filename>.
SSID is the string that the access point/router transmits to
identify itself. Run the following command as the
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>wpa_passphrase <replaceable>SSID</replaceable> <replaceable>SECRET_PASSWORD</replaceable> &gt; /etc/wpa_supplicant.conf</userinput></screen>
<screen role="root"><userinput>wpa_passphrase <replaceable>SSID</replaceable> <replaceable>SECRET_PASSWORD</replaceable> &gt; /etc/sysconfig/wpa_supplicant-<replaceable>wlan0</replaceable>.conf</userinput></screen>
<para>
<filename>/etc/wpa_supplicant.conf</filename> can hold the details of
several access points. When you run <command>wpa_supplicant</command>
it will scan for the SSIDs it can see and choose the appropriate
password to connect.
<filename>/etc/sysconfig/wpa_supplicant-<replaceable>wlan0</replaceable>.conf
</filename> can hold the details of several access points. When
<command>wpa_supplicant</command> is started, it will scan for the
SSIDs it can see and choose the appropriate password to connect.
</para>
<para>
If you want to connect to an access point that isn't password
protected, put an entry like this in
<filename>/etc/wpa_supplicant.conf</filename>. Replace
"Some-SSID" with the SSID of the access point/router.
protected, put an entry like this in <filename>
/etc/sysconfig/wpa_supplicant-<replaceable>wlan0</replaceable>.conf</filename>.
Replace "Some-SSID" with the SSID of the access point/router.
</para>
<screen>network={
@ -303,45 +305,113 @@ install -v -m644 wpa_gui-qt4/icons/wpa_gui.svg /usr/share/pixmaps/</userinput></
source tree.
</para>
<para>
To use <command>wpa_cli</command> to control the running
<command>>wpa_supplicant</command> daemon, add a control interface to
<filename>/etc/wpa_supplicant.conf</filename> as the
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>echo ctrl_interface=/run/wpa_supplicant &gt;&gt; /etc/wpa_supplicant.conf</userinput></screen>
</sect3>
<sect3>
<title>Connecting to an Access Point</title>
<para id="wpa-service">
If you want to configure network interfaces at boot using
<command>wpa_supplicant</command>, you need to install the
<filename>/lib/services/wpa</filename> script
included in <xref linkend="bootscripts"/> package:
</para>
<screen role="root"><userinput>make install-service-wpa</userinput></screen>
<indexterm zone="wpa_supplicant wpa-service">
<primary sortas="f-wpa">wpa</primary>
</indexterm>
<para>
If your router/access point uses DHCP to allocate IP addresses you
can install <xref linkend="dhcpcd"/> and use it to connect. As the
If your router/access point uses DHCP to allocate IP addresses, you
can install <xref linkend="dhcp"/> client and use it to
automatically obtain network addresses. Create the
<filename>/etc/sysconfig/ifconfig-<replaceable>wlan0</replaceable>
</filename> by running the following command as the
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
sleep 2 # let it settle
dhcpcd</userinput></screen>
<screen role="root"><userinput>cat &gt; /etc/sysconfig/ifconfig.<replaceable>wlan0</replaceable> &lt;&lt; "EOF"
<literal>ONBOOT="yes"
IFACE="<replaceable>wlan0</replaceable>"
SERVICE="wpa"
# Additional arguments to wpa_supplicant
WPA_ARGS=""
WPA_SERVICE="dhclient"
DHCP_START=""
DHCP_STOP=""
# Set PRINTIP="yes" to have the script print
# the DHCP assigned IP address
PRINTIP="no"
# Set PRINTALL="yes" to print the DHCP assigned values for
# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
PRINTALL="no"</literal>
EOF</userinput></screen>
<para>
Alternatively, you can use static addresses on your local network.
This has the advantage that you can put the hostnames in
<filename>/etc/hosts</filename>. Replace 192.168.1.6 with the static
address you've chosen. Replace 192.168.1.1 with the local IP address of
the access point/router. Run the following commands as the
If you prefer <xref linkend="dhcpcd"/> instead of
<xref linkend="dhcp"/> client, then create the
<filename>/etc/sysconfig/ifconfig-<replaceable>wlan0</replaceable>
</filename> by running the following command as the
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>ip addr add 192.168.1.6 dev wlan0
ip link set wlan0 up
wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
ip route add 192.168.1.1 dev wlan0
ip route add default via 192.168.1.1 dev wlan0</userinput></screen>
<screen role="root"><userinput>cat &gt; /etc/sysconfig/ifconfig.<replaceable>wlan0</replaceable> &lt;&lt; "EOF"
<literal>ONBOOT="yes"
IFACE="<replaceable>wlan0</replaceable>"
SERVICE="wpa"
# Additional arguments to wpa_supplicant
WPA_ARGS=""
WPA_SERVICE="dhcpcd"
DHCP_START="-b -q <replaceable>&lt;insert appropriate start options here&gt;</replaceable>"
DHCP_STOP="-k <replaceable>&lt;insert additional stop options here&gt;</replaceable>"</literal>
EOF</userinput></screen>
<para>
Alternatively, if you use static addresses on your local network,
then create the
<filename>/etc/sysconfig/ifconfig-<replaceable>wlan0</replaceable>
</filename> by running the following command as the
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>cat &gt; /etc/sysconfig/ifconfig.<replaceable>wlan0</replaceable> &lt;&lt; "EOF"
<literal>ONBOOT="yes"
IFACE="<replaceable>wlan0</replaceable>"
SERVICE="wpa"
# Additional arguments to wpa_supplicant
WPA_ARGS=""
WPA_SERVICE="ipv4-static"
IP="192.168.1.1"
GATEWAY="192.168.1.2"
PREFIX="24"
BROADCAST="192.168.1.255"</literal>
EOF</userinput></screen>
<para>
You can connect to the wireless access point by
running the following command as the
<systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>ifup <replaceable>wlan0</replaceable></userinput></screen>
<para>
Replace <replaceable>wlan0</replaceable> with the correct
wireless interface.
</para>
</sect3>
</sect2>
<sect2 role="content">