📄 network-wireless.html
字号:
different wireless modes, generally BSS (infrastructure mode, which requires an accesspoint), and IBSS (ad-hoc, or peer-to-peer mode). In our example, we will use the mostpopular of the two, BSS mode, to talk to an access point.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN36465" name="AEN36465">24.3.3.3.1 Requirements</a></h4><p>There is only one real requirement for setting up FreeBSD as a wireless client. Youwill need a wireless card that is supported by FreeBSD.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36468" name="AEN36468">24.3.3.3.2 Setting Up a WirelessFreeBSD Client</a></h4><p>You will need to know a few things about the wireless network you are joining beforeyou start. In this example, we are joining a network that has a name of <varclass="REPLACEABLE">my_net</var>, and encryption turned off.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> In this example, we are not using encryption, which is a dangeroussituation. In the next section, you will learn how to turn on encryption, why it isimportant to do so, and why some encryption technologies still do not completely protectyou.</p></blockquote></div><p>Make sure your card is recognized by FreeBSD:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig -a</kbd>wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet6 fe80::202:2dff:fe2d:c938%wi0 prefixlen 64 scopeid 0x7 inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 ether 00:09:2d:2d:c9:50 media: IEEE 802.11 Wireless Ethernet autoselect (DS/2Mbps) status: no carrier ssid "" stationname "FreeBSD Wireless node" channel 10 authmode OPEN powersavemode OFF powersavesleep 100 wepmode OFF weptxkey 1</pre><p>Now, we can set the card to the correct settings for our network:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig wi0 inet <varclass="REPLACEABLE">192.168.0.20</var> netmask <varclass="REPLACEABLE">255.255.255.0</var> ssid <var class="REPLACEABLE">my_net</var></kbd></pre><p>Replace <tt class="HOSTID">192.168.0.20</tt> and <tt class="HOSTID">255.255.255.0</tt>with a valid IP address and netmask on your wired network. Remember, our access point isbridging the data between the wireless network, and the wired network, so it will appearto the other devices on your network that you are on the wired network just as theyare.</p><p>Once you have done that, you should be able to ping hosts on the wired network just asif you were connected using a standard wired connection.</p><p>If you are experiencing problems with your wireless connection, check to make surethat you are associated (connected) to the access point:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig wi0</kbd></pre><p>should return some information, and you should see:</p><pre class="SCREEN">status: associated</pre><p>If it does not show <var class="LITERAL">associated</var>, then you may be out ofrange of the access point, have encryption on, or possibly have a configurationproblem.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN36497" name="AEN36497">24.3.3.4 Encryption</a></h3><p>Encryption on a wireless network is important because you no longer have the abilityto keep the network contained in a well protected area. Your wireless data will bebroadcast across your entire neighborhood, so anyone who cares to read it can. This iswhere encryption comes in. By encrypting the data that is sent over the airwaves, youmake it much more difficult for any interested party to grab your data right out of theair.</p><p>The two most common ways to encrypt the data between your client and the access pointare WEP, and <a href="http://www.FreeBSD.org/cgi/man.cgi?query=ipsec&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ipsec</span>(4)</span></a>.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN36507" name="AEN36507">24.3.3.4.1 WEP</a></h4><p>WEP is an abbreviation for Wired Equivalency Protocol. WEP is an attempt to makewireless networks as safe and secure as a wired network. Unfortunately, it has beencracked, and is fairly trivial to break. This also means it is not something to rely onwhen it comes to encrypting sensitive data.</p><p>It is better than nothing, so use the following to turn on WEP on your new FreeBSDaccess point:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig wi0 inet up ssid <varclass="REPLACEABLE">my_net</var> wepmode on wepkey <varclass="REPLACEABLE">0x1234567890</var> media DS/11Mbps mediaopt hostap</kbd></pre><p>And you can turn on WEP on a client with this command:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig wi0 inet <varclass="REPLACEABLE">192.168.0.20</var> netmask <varclass="REPLACEABLE">255.255.255.0</var> ssid <varclass="REPLACEABLE">my_net</var> wepmode on wepkey <varclass="REPLACEABLE">0x1234567890</var></kbd></pre><p>Note that you should replace the <var class="REPLACEABLE">0x1234567890</var> with amore unique key.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36528" name="AEN36528">24.3.3.4.2 IPsec</a></h4><p><a href="http://www.FreeBSD.org/cgi/man.cgi?query=ipsec&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ipsec</span>(4)</span></a> is a muchmore robust and powerful tool for encrypting data across a network. This is definitelythe preferred way to encrypt data over a wireless network. You can read more about <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ipsec&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ipsec</span>(4)</span></a> security andhow to implement it in the <a href="ipsec.html">IPsec</a> section of this handbook.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN36538" name="AEN36538">24.3.3.5 Tools</a></h3><p>There are a small number of tools available for use in debugging and setting up yourwireless network, and here we will attempt to describe some of them and what they do.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN36541" name="AEN36541">24.3.3.5.1 The <bclass="APPLICATION">bsd-airtools</b> Package</a></h4><p>The <b class="APPLICATION">bsd-airtools</b> package is a complete toolset thatincludes wireless auditing tools for WEP key cracking, access point detection, etc.</p><p>The <b class="APPLICATION">bsd-airtools</b> utilities can be installed from the <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/net/bsd-airtools/pkg-descr"><ttclass="FILENAME">net/bsd-airtools</tt></a> port. Information on installing ports can befound in <a href="ports.html">Chapter 4</a> of this handbook.</p><p>The program <tt class="COMMAND">dstumbler</tt> is the packaged tool that allows foraccess point discovery and signal to noise ratio graphing. If you are having a hard timegetting your access point up and running, <tt class="COMMAND">dstumbler</tt> may help youget started.</p><p>To test your wireless network security, you may choose to use ``dweputils'' (<ttclass="COMMAND">dwepcrack</tt>, <tt class="COMMAND">dwepdump</tt> and <ttclass="COMMAND">dwepkeygen</tt>) to help you determine if WEP is the right solution toyour wireless security needs.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36558" name="AEN36558">24.3.3.5.2 The <ttclass="COMMAND">wicontrol</tt>, <tt class="COMMAND">ancontrol</tt> and <ttclass="COMMAND">raycontrol</tt> Utilities</a></h4><p>These are the tools you can use to control how your wireless card behaves on thewireless network. In the examples above, we have chosen to use <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=wicontrol&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">wicontrol</span>(8)</span></a>, sinceour wireless card is a <tt class="DEVICENAME">wi0</tt> interface. If you had a Ciscowireless device, it would come up as <tt class="DEVICENAME">an0</tt>, and therefore youwould use <a href="http://www.FreeBSD.org/cgi/man.cgi?query=ancontrol&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ancontrol</span>(8)</span></a>.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36572" name="AEN36572">24.3.3.5.3 The <ttclass="COMMAND">ifconfig</tt> Command</a></h4><p>The <a href="http://www.FreeBSD.org/cgi/man.cgi?query=ifconfig&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ifconfig</span>(8)</span></a> commandcan be used to do many of the same options as <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=wicontrol&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">wicontrol</span>(8)</span></a>, howeverit does lack a few options. Check <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ifconfig&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ifconfig</span>(8)</span></a> forcommand line parameters and options.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN36587" name="AEN36587">24.3.3.6 Supported Cards</a></h3><div class="SECT4"><h4 class="SECT4"><a id="AEN36589" name="AEN36589">24.3.3.6.1 Access Points</a></h4><p>The only cards that are currently supported for BSS (as an access point) mode aredevices based on the Prism 2, 2.5, or 3 chipsets. For a complete list, look at <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=wi&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">wi</span>(4)</span></a>.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36595" name="AEN36595">24.3.3.6.2 Clients</a></h4><p>Almost all 802.11b wireless cards are currently supported under FreeBSD. Most cardsbased on Prism, Spectrum24, Hermes, Aironet, and Raylink will work as a wireless networkcard in IBSS (ad-hoc, peer-to-peer, and BSS) mode.</p></div></div></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="network-routing.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="network-bluetooth.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Gateways and Routes</td><td width="34%" align="center" valign="top"><a href="advanced-networking.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Bluetooth</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -