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

📄 network-wireless.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Wireless Networking</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Advanced Networking" href="advanced-networking.html" /><link rel="PREVIOUS" title="Gateways and Routes" href="network-routing.html" /><link rel="NEXT" title="Bluetooth" href="network-bluetooth.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="network-routing.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 24 Advanced Networking</td><td width="10%" align="right" valign="bottom"><a href="network-bluetooth.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="NETWORK-WIRELESS" name="NETWORK-WIRELESS">24.3 WirelessNetworking</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Written by</span> Eric Anderson.</i> <div class="SECT2"><h2 class="SECT2"><a id="AEN36344" name="AEN36344">24.3.1 Introduction</a></h2><p>It can be very useful to be able to use a computer without the annoyance of having anetwork cable attached at all times. FreeBSD can be used as a wireless client, and evenas a wireless ``access point''.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN36348" name="AEN36348">24.3.2 Wireless Modes ofOperation</a></h2><p>There are two different ways to configure 802.11 wireless devices: BSS and IBSS.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN36351" name="AEN36351">24.3.2.1 BSS Mode</a></h3><p>BSS mode is the mode that typically is used. BSS mode is also called infrastructuremode. In this mode, a number of wireless access points are connected to a wired network.Each wireless network has its own name. This name is called the SSID of the network.</p><p>Wireless clients connect to these wireless access points. The IEEE 802.11 standarddefines the protocol that wireless networks use to connect. A wireless client can be tiedto a specific network, when a SSID is set. A wireless client can also attach to anynetwork by not explicitly setting a SSID.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN36355" name="AEN36355">24.3.2.2 IBSS Mode</a></h3><p>IBSS mode, also called ad-hoc mode, is designed for point to point connections. Thereare actually two types of ad-hoc mode. One is IBSS mode, also called ad-hoc or IEEEad-hoc mode. This mode is defined by the IEEE 802.11 standards. The second is called demoad-hoc mode or Lucent ad-hoc mode (and sometimes, confusingly, ad-hoc mode). This is theold, pre-802.11 ad-hoc mode and should only be used for legacy installations. We will notcover either of the ad-hoc modes further.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN36358" name="AEN36358">24.3.3 Infrastructure Mode</a></h2><div class="SECT3"><h3 class="SECT3"><a id="AEN36360" name="AEN36360">24.3.3.1 Access Points</a></h3><p>Access points are wireless networking devices that allow one or more wireless clientsto use the device as a central hub. When using an access point, all clients communicatethrough the access point. Multiple access points are often used to cover a complete areasuch as a house, business, or park with a wireless network.</p><p>Access points typically have multiple network connections: the wireless card, and oneor more wired Ethernet adapters for connection to the rest of the network.</p><p>Access points can either be purchased prebuilt, or you can build your own with FreeBSDand a supported wireless card. Several vendors make wireless access points and wirelesscards with various features.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN36365" name="AEN36365">24.3.3.2 Building a FreeBSD AccessPoint</a></h3><div class="SECT4"><h4 class="SECT4"><a id="AEN36370" name="AEN36370">24.3.3.2.1 Requirements</a></h4><p>In order to set up a wireless access point with FreeBSD, you need to have a compatiblewireless card. Currently, only cards with the Prism chipset are supported. You will alsoneed a wired network card that is supported by FreeBSD (this should not be difficult tofind, FreeBSD supports a lot of different devices). For this guide, we will assume youwant to <a href="http://www.FreeBSD.org/cgi/man.cgi?query=bridge&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">bridge</span>(4)</span></a> all trafficbetween the wireless device and the network attached to the wired network card.</p><p>The hostap functionality that FreeBSD uses to implement the access point works bestwith certain versions of firmware. Prism 2 cards should use firmware version 1.3.4 ornewer. Prism 2.5 and Prism 3 cards should use firmware 1.4.9. Older versions of thefirmware way or may not function correctly. At this time, the only way to update cards iswith <span class="TRADEMARK">Windows</span>&reg; firmware update utilities available fromyour card's manufacturer.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36378" name="AEN36378">24.3.3.2.2 Setting It Up</a></h4><p>First, make sure your system can see the wireless card:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig -a</kbd>wi0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; 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>Do not worry about the details now, just make sure it shows you something to indicateyou have a wireless card installed. If you have trouble seeing the wireless interface,and you are using a PC Card, you may want to check out <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pccardc&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pccardc</span>(8)</span></a> and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pccardd&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pccardd</span>(8)</span></a> manualpages for more information.</p><p>Next, you will need to load a module in order to get the bridging part of FreeBSDready for the access point. To load the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=bridge&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">bridge</span>(4)</span></a> module,simply run the following command:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kldload bridge</kbd></pre><p>It should not have produced any errors when loading the module. If it did, you mayneed to compile the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=bridge&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">bridge</span>(4)</span></a> code intoyour kernel. The <a href="network-bridging.html">Bridging</a> section of this handbookshould be able to help you accomplish that task.</p><p>Now that you have the bridging stuff done, we need to tell the FreeBSD kernel whichinterfaces to bridge together. We do that by using <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=sysctl&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">sysctl</span>(8)</span></a>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">sysctl net.link.ether.bridge=1</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sysctl net.link.ether.bridge_cfg="wi0,xl0"</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sysctl net.inet.ip.forwarding=1</kbd></pre><p>On FreeBSD&nbsp;5.2-RELEASE and later, you have to use instead the followingoptions:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sysctl net.link.ether.bridge.enable=1</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sysctl net.link.ether.bridge.config="wi0,xl0"</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sysctl net.inet.ip.forwarding=1</kbd></pre><p>Now it is time for the wireless card setup. The following command will set the cardinto an access point:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig wi0 ssid <varclass="REPLACEABLE">my_net</var> channel 11 media DS/11Mbps mediaopt hostap up stationname "<var class="REPLACEABLE">FreeBSD AP</var>"</kbd>        </pre><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> linebrings the <tt class="DEVICENAME">wi0</tt> interface up, sets its SSID to <varclass="REPLACEABLE">my_net</var>, and sets the station name to <varclass="REPLACEABLE">FreeBSD AP</var>. The <var class="OPTION">media DS/11Mbps</var> setsthe card into 11Mbps mode and is needed for any <var class="OPTION">mediaopt</var> totake effect. The <var class="OPTION">mediaopt hostap</var> option places the interfaceinto access point mode. The <var class="OPTION">channel 11</var> option sets the 802.11bchannel to use. The <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=wicontrol&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">wicontrol</span>(8)</span></a> manualpage has valid channel options for your regulatory domain.</p><p>Now you should have a complete functioning access point up and running. You areencouraged to read <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=wicontrol&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">wicontrol</span>(8)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ifconfig&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ifconfig</span>(8)</span></a>, and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=wi&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">wi</span>(4)</span></a> for furtherinformation.</p><p>It is also suggested that you read the section on encryption that follows.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN36453" name="AEN36453">24.3.3.2.3 Status Information</a></h4><p>Once the access point is configured and operational, operators will want to see theclients that are associated with the access point. At any time, the operator maytype:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">wicontrol -l</kbd>1 station:00:09:b7:7b:9d:16  asid=04c0, flags=3&lt;ASSOC,AUTH&gt;, caps=1&lt;ESS&gt;, rates=f&lt;1M,2M,5.5M,11M&gt;, sig=38/15</pre><p>This shows that there is one station associated, along with its parameters. The signalindicated should be used as a relative indication of strength only. Its translation todBm or other units varies between different firmware revisions.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN36460" name="AEN36460">24.3.3.3 Clients</a></h3><p>A wireless client is a system that accesses an access point or another clientdirectly.</p><p>Typically, wireless clients only have one network device, the wireless networkingcard.</p><p>There are a few different ways to configure a wireless client. These are based on the

⌨️ 快捷键说明

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