⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wpahowto - ubuntu中文.htm

📁 802.1x认证的认证服务器freeradius的howto文档
💻 HTM
📖 第 1 页 / 共 2 页
字号:
#  -c <config file>     Configuration file
#  -d                   Debugging (-dd for more)
#  -w                   Wait for interface to come up

# OPTIONS="-w"
</PRE>
<P>Save and exit. </P>
<P>{i} ~- You may not need to specify the OPTIONS="-iwlan0 
-c/etc/wpa_supplicant.conf -Dndiswrapper -w" - the other tutorial did not have 
this . - 20060226 [<I>Hobbsee</I>] -~ </P>
<P>{i} (although this next step is optional, it saves the supplicant having to 
generate the preshared key (PSK) each time it is started): </P>
<P>Next, you'll need to sort your pre-shared key out. My router allows me to 
input the passphrase that makes up the key itself; I originally tried putting 
this passphrase in as the wireless key, which failed to work altogether for 
fairly obvious reasons. Hindsight is wonderful like that. Take the passphrase 
that you used in your router or WAP and use wpa_passphrase to generate the key. 
You use this command in the following format: </P><PRE>wpa_passphrase &lt;ssid&gt; &lt;passphrase&gt;
</PRE>
<P>So the command I ran looks something like this: </P><PRE>wpa_passphrase MyHomeWireless SuperSecretPassphrase
</PRE>
<P>attachment:IconsPage/IconExample48.png ... which gives you an output 
something like: </P><PRE>network={
ssid="MyHomeWireless"
#psk="SuperSecretPassphrase"
psk=e42ac2538ef03f906d37332a0df4446150e04cdcdd392e  309486075065a70a1f
}
</PRE>
<P>Copy all that - we'll need in a moment. You now need to put that in to a 
configuration file for wpa_supplicant, which you first need to create. Given 
that you'll have the keys to your wireless access in this file, a little extra 
precaution is in order. Use the following commands to create and then open the 
file for editing: </P><PRE>sudo touch /etc/wpa_supplicant.conf
sudo chmod 600 /etc/wpa_supplicant.conf
sudo vi /etc/wpa_supplicant.conf
</PRE>
<P>attachment:IconsPage/IconExample48.png Using the output of wpa_passphrase we 
copied earlier as a base, you'll need to tell wpa_supplicant a few more details 
about your network. Here's what my copy of this file looks like when complete, 
with the sample data: </P><PRE>network={
ssid="MyHomeWireless"
#psk="SuperSecretPassphrase"
psk=e42ac2538ef03f906d37332a0df4446150e04cdcdd392e  309486075065a70a1f
key_mgmt=WPA-PSK
proto=WPA
}
</PRE>
<P>Save and exit. </P>
<P>Also, you may not need to specify the proto and key_mgmt directives, as 
wpa_supplicant defaults to autodetecting the right protocol. - 20060107 
DaniloPiazzalunga </P>
<P>You should probably test this now - here's a good command to copy/paste to 
your cli (this will only work if you fulfill the assumptions of this HOWTO): 
</P><PRE>sudo ifconfig wlan0 up &amp;&amp; sudo /usr/sbin/wpa_supplicant -Bw -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf &amp;&amp; sudo dhclient wlan0
</PRE>
<P>If that doesn't get you to the point where you can ping other hosts on your 
network, something is most likely wrong with wpa_supplicant (I'm assuming that 
it hasn't got anything to do with DHCP). Run these two commands: </P><PRE>sudo dhclient -r wlan0 &amp;&amp; sudo ifconfig wlan0 down &amp;&amp; sudo killall wpa_supplicant
sudo ifconfig wlan0 up &amp;&amp; sudo /usr/sbin/wpa_supplicant -w -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf -dd
</PRE>
<P>This will give you a bunch of debugging output, and someone who is much more 
skilled than I might be able to help you out. Sorry, but this HOWTO isn't going 
to help you much more, as it's beyond my ken completely. </P>
<P>If you got lucky and you -are- able to ping hosts on your network, now is the 
time to automate it. It's actually really easy. Run this command first to bring 
the wireless link down cleanly: </P><PRE>sudo dhclient -r wlan0 &amp;&amp; sudo ifconfig wlan0 down &amp;&amp; sudo killall wpa_supplicant
</PRE>
<P>You need to tell your network interface configuration file how to deal with 
the wireless config nicely; here's what you need to put in for your wireless 
card (again, if you don't completely fulfill the assumptions of this HOWTO, 
you'll need to change a few things). Open up /etc/network/interfaces: </P><PRE>sudo nano /etc/network/interfaces
</PRE>
<P>... here's the part you'll need to add/modify in yours for the wireless: </P><PRE>auto wlan0
iface wlan0 inet dhcp
pre-up /usr/sbin/wpa_supplicant -Bw -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
</PRE>
<P>Save and exit. </P>
<P>We're all done! Wireless will now come up on boot (assuming that your 
computer already detects the card and loads the drivers for it already), and you 
can start/stop the wireless link with the following two commands: </P><PRE>sudo ifup wlan0
sudo ifdown wlan0
</PRE>
<P><BR><A class=new title="Anchor(anthony) (尚未撰寫)" 
href="http://wiki.ubuntu.org.cn/index.php?title=Anchor%28anthony%29&amp;action=edit&amp;redlink=1">Anchor(anthony)</A> 
</P><A name=If_your_router_does_not_broadcast_the_SSID></A>
<H3><SPAN class=editsection>[<A 
title="編輯段落: If your router does not broadcast the SSID" 
href="http://wiki.ubuntu.org.cn/index.php?title=WPAHowto&amp;action=edit&amp;section=5">編輯</A>]</SPAN> 
<SPAN class=mw-headline>If your router does not broadcast the SSID </SPAN></H3>
<P>I recommend you do not broadcast the ssid for added security. It's just one 
more thing your potential intruder has to guess. </P>
<P>First, set </P><PRE>ap_scan=2
</PRE>
<P>This means, don't bother scanning (since it's not broadcasting anyway right), 
use the first network block. </P>
<P>Since your router isn't broadcasting, you have to add some more detail about 
the encryption, in particular whether it's TKIP or CCMP(also known as AES). </P>
<P>You also have to specify <B>scan_ssid=1</B>, which means this router does not 
broadcast. </P>
<P>attachment:IconsPage/IconExample48.png Here is a sample of my network block: 
</P><PRE>network={
ssid="myrouterssid"
scan_ssid=1
psk="topsecret"
key_mgmt=WPA-PSK
proto=WPA
auth_alg=OPEN
pairwise=TKIP
group=TKIP 
}
</PRE>
<P>Enjoy using your network securely&nbsp;:) </P>
<P>Now interrupt wpa_supplicant with &lt;ctrl&gt; C </P><A 
name=Other_Information_-_Can_someone_check_this_and_delete_it_if_it_is_irrelevant.3F></A>
<H2><SPAN class=editsection>[<A 
title="編輯段落: Other Information - Can someone check this and delete it if it is irrelevant?" 
href="http://wiki.ubuntu.org.cn/index.php?title=WPAHowto&amp;action=edit&amp;section=6">編輯</A>]</SPAN> 
<SPAN class=mw-headline>Other Information - Can someone check this and delete it 
if it is irrelevant? </SPAN></H2>
<P>{i} ~- Note that the instructions below are deprecated. 
/etc/network/interfaces has already been modified above. </P>
<P>Once wpa_supplicant works, you should edit /etc/network/interfaces to include 
wpa_supplicant. If prior to all of this, your /etc/network/interfaces looks 
like: </P><PRE>auto ath0
iface ath0 inet dhcp
</PRE>
<P>Simply change it to look like: </P><PRE>auto ath0
iface ath0 inet dhcp
pre-up /etc/init.d/wpasupplicant start
pre-up sleep 5
</PRE>
<P>{i} ~- This looks like an optional step, too. As of 0.4.7-0ubuntu3, the 
/etc/network/if-pre-up.d/wpasupplicant script will take care of this step 
automatically. - 20060107 DaniloPiazzalunga -~ </P>
<P>{i} ~- It is indeed optional and only relevant for Breezy systems. I made the 
change in Dapper's package. - 20060110 [<I>DanielTChen</I>] -~ </P>
<P>{i} ~- Note that in Dapper, because of a newer kernel (2.6.15) and a newer 
wpasupplicant package (0.4.7), your wireless driver may already support the 
kernel's wireless extensions interface. Please consult the README.Debian. - 
20060110 [<I>DanielTChen</I>] -~ </P><A name=Integration_with_DHCP></A>
<H2><SPAN class=editsection>[<A title="編輯段落: Integration with DHCP" 
href="http://wiki.ubuntu.org.cn/index.php?title=WPAHowto&amp;action=edit&amp;section=7">編輯</A>]</SPAN> 
<SPAN class=mw-headline>Integration with DHCP </SPAN></H2>
<P>{i} ~- Note that the instructions below are deprecated. The changes that I 
made in Dapper's wpasupplicant package already take care of this case. 
[<I>DanielTChen</I>] -~ </P>
<P>If you want your wireless card to aquire a new IP address using DHCP when 
wpa_supplicant associates with an access point, use the wpa_cli utility as 
documented in the wpa_supplicant <A class="external text" 
title=http://hostap.epitest.fi/cgi-bin/viewcvs.cgi/*checkout*/hostap/wpa_supplicant/README?rev=HEAD&amp;content-type=text/plain 
href="http://hostap.epitest.fi/cgi-bin/viewcvs.cgi/*checkout*/hostap/wpa_supplicant/README?rev=HEAD&amp;content-type=text/plain" 
rel=nofollow>README</A>: </P><PRE>wpa_cli can used to run external programs whenever wpa_supplicant
connects or disconnects from a network. This can be used, e.g., to
update network configuration and/or trigget DHCP client to update IP
addresses, etc.
</PRE>
<P>The wpa_cli utility can automatically execute a script whenever 
wpa_supplicant connects or disconnects from an access point. For this, use the 
-a switch like so: </P><PRE>wpa_cli -a&lt;my-script&gt;
</PRE>
<P>The script will be invoked like this: </P><PRE>my-script $IF $CONN
</PRE>
<P>Where $IF is the interface (eth0, ath0, etc), and $CONN is the event - either 
"CONNECTED" or "DISCONNECTED". </P>
<P><BR>attachment:IconsPage/IconExample48.png The simplest thing to do is write 
a script that invokes ifup or ifdown. I've put it in /sbin/wpa_action: </P><PRE>#! /bin/bash 

IFNAME=$1
CMD=$2

if [ "$CMD" == "CONNECTED" ]; then
SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
logger "WiFi: Connecting `$IFNAME' to network `$SSID'"
ifup $IFNAME
elif [ "$CMD" == "DISCONNECTED" ]; then
logger "WiFi: Disconnecting `$IFNAME'"
ifdown $IFNAME
fi
</PRE>
<P>Then, edit /etc/init.d/wpasupplicant to run wpa_cli appropriately. Look for 
these lines: </P><PRE>case "$1" in
	start)
		echo -n "Starting wpa_supplicant: "
		start-stop-daemon --start --name $PNAME 
			--oknodo --startas $DAEMON -- -B $OPTIONS
		echo "done."
		;;
	stop)
</PRE>
<P>Insert a sleep and wpa_cli call below the start-stop-daemon call: </P><PRE>case "$1" in
	start)
		echo -n "Starting wpa_supplicant: "
		start-stop-daemon --start --name $PNAME 
			--oknodo --startas $DAEMON -- -B $OPTIONS
		sleep 1
		wpa_cli -a/sbin/wpa_action -B
		echo "done."
		;;
	stop)
</PRE>
<P>If you are using DHCP exclusively to configure your wireless interface, then 
make sure you have this line for your wireless interface in 
/etc/network/interfaces: </P><PRE>iface eth0 inet dhcp
</PRE>
<P>Where "eth0" is your wireless interface. And you'll want to make sure that 
your computer doesn't try to automatically start the interface up without an 
associated AP, so remove your wireless interface from the 'auto' line in 
/etc/network/interfaces: </P><PRE>auto lo eth0 eth1
</PRE>
<P>So it becomes </P><PRE>auto lo eth1
</PRE>
<P>Listing only those interfaces that you want to configure on startup. 
(Obviously, your 'auto' line will look different, depending on what network 
interfaces you have on your system.) </P>
<P>Now, whenever you associate with a new wireless access point, your wireless 
interface will have an IP automatically configured and you'll be fully connected 
to the network. (YAY!) </P>
<HR>
<A name=Links_and_Resources></A>
<H2><SPAN class=editsection>[<A title="編輯段落: Links and Resources" 
href="http://wiki.ubuntu.org.cn/index.php?title=WPAHowto&amp;action=edit&amp;section=8">編輯</A>]</SPAN> 
<SPAN class=mw-headline>Links and Resources </SPAN></H2>
<P><A class="external text" 
title=http://en.wikipedia.org/wiki/Wi-Fi_Protected_Access 
href="http://en.wikipedia.org/wiki/Wi-Fi_Protected_Access" rel=nofollow>WPA</A> 
<A class="external text" title=http://hostap.epitest.fi/wpa_supplicant/ 
href="http://hostap.epitest.fi/wpa_supplicant/" rel=nofollow>wpa_supplicant 
website</A> </P><!-- NewPP limit reportPreprocessor node count: 93/1000000Post-expand include size: 0/2097152 bytesTemplate argument size: 0/2097152 bytesExpensive parser function count: 0/100--><!-- Saved in parser cache with key help:pcache:idhash:13451-0!1!0!!zh-tw!2!zh-tw and timestamp 20081119055047 -->
<DIV class=printfooter>取自"<A 
href="http://wiki.ubuntu.org.cn/index.php?title=WPAHowto&amp;variant=zh-tw">http://wiki.ubuntu.org.cn/index.php?title=WPAHowto&amp;variant=zh-tw</A>"</DIV>
<DIV id=catlinks>
<DIV class=catlinks id=catlinks>
<DIV id=mw-normal-catlinks><A title=Special:Categories 
href="http://wiki.ubuntu.org.cn/index.php?title=Special:Categories&amp;variant=zh-tw">1個分類</A>: 
<SPAN dir=ltr><A title=Category:CategoryDocumentation 
href="http://wiki.ubuntu.org.cn/index.php?title=Category:CategoryDocumentation&amp;variant=zh-tw">CategoryDocumentation</A></SPAN></DIV></DIV></DIV><!-- end content --></DIV><!-- end of MAINCONTENT div --></DIV><!-- end of MBODY div -->
<DIV id=footer>
<TABLE>
  <TBODY>
  <TR>
    <TD noWrap align=left width="1%"></TD>
    <TD align=middle><SPAN id=f-viewcount>本頁面已經被瀏覽1,241次。 </SPAN>
      <UL id=f-list>
        <LI id=f-credits>此頁由<A title=User:Oneleaf 
        href="http://wiki.ubuntu.org.cn/index.php?title=User:Oneleaf&amp;variant=zh-tw">Oneleaf</A>於2007年5月30日 
        (星期三) 18:08的最後更改。 
        <LI id=f-about><A title=Ubuntu中文:关于 
        href="http://wiki.ubuntu.org.cn/index.php?title=Ubuntu%E4%B8%AD%E6%96%87:%E5%85%B3%E4%BA%8E&amp;variant=zh-tw">關於Ubuntu中文</A> 

        <LI id=f-disclaimer><A title=Ubuntu中文:免责声明 
        href="http://wiki.ubuntu.org.cn/index.php?title=Ubuntu%E4%B8%AD%E6%96%87:%E5%85%8D%E8%B4%A3%E5%A3%B0%E6%98%8E&amp;variant=zh-tw">免責聲明</A> 
        </LI></UL></TD>
    <TD noWrap align=right width="1%">
      <DIV id=f-poweredbyico><A href="http://www.mediawiki.org/"><IMG 
      alt="Powered by MediaWiki" 
      src="WPAHowto - Ubuntu中文.files/poweredby_mediawiki_88x31.png"></A></DIV></TD></TR></TBODY></TABLE></DIV><!-- end of the FOOTER div --></DIV><!-- end of the CONTAINER div --><!-- Served in 1.187 secs. --></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -