update for rename of docs/user/DebugKernelCrashDumps.mdwn to docs/user/list/DebugKern...
[ikiwiki.git] / docs / handbook / handbook-network-wireless.mdwn
1 \r
2 \r
3 ## 19.3 Wireless Networking \r
4 \r
5 ***Written by Eric Anderson. ***\r
6 \r
7 ### 19.3.1 Introduction \r
8 \r
9 It can be very useful to be able to use a computer without the annoyance of having a network cable attached at all times. DragonFly can be used as a wireless client, and even as a wireless ***access point***.\r
10 \r
11 ### 19.3.2 Wireless Modes of Operation \r
12 \r
13 There are two different ways to configure 802.11 wireless devices: BSS and IBSS.\r
14 \r
15 #### 19.3.2.1 BSS Mode \r
16 \r
17 BSS mode is the mode that typically is used. BSS mode is also called infrastructure mode. 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.\r
18 \r
19 Wireless clients connect to these wireless access points. The IEEE 802.11 standard defines the protocol that wireless networks use to connect. A wireless client can be tied to a specific network, when a SSID is set. A wireless client can also attach to any network by not explicitly setting a SSID.\r
20 \r
21 #### 19.3.2.2 IBSS Mode \r
22 \r
23 IBSS mode, also called ad-hoc mode, is designed for point to point connections. There are actually two types of ad-hoc mode. One is IBSS mode, also called ad-hoc or IEEE ad-hoc mode. This mode is defined by the IEEE 802.11 standards. The second is called demo ad-hoc mode or Lucent ad-hoc mode (and sometimes, confusingly, ad-hoc mode). This is the old, pre-802.11 ad-hoc mode and should only be used for legacy installations. We will not cover either of the ad-hoc modes further.\r
24 \r
25 ### 19.3.3 Infrastructure Mode \r
26 \r
27 #### 19.3.3.1 Access Points \r
28 \r
29 Access points are wireless networking devices that allow one or more wireless clients to use the device as a central hub. When using an access point, all clients communicate through the access point. Multiple access points are often used to cover a complete area such as a house, business, or park with a wireless network.\r
30 \r
31 Access points typically have multiple network connections: the wireless card, and one or more wired Ethernet adapters for connection to the rest of the network.\r
32 \r
33 Access points can either be purchased prebuilt, or you can build your own with DragonFly and a supported wireless card. Several vendors make wireless access points and wireless cards with various features.\r
34 \r
35 #### 19.3.3.2 Building a DragonFly Access Point \r
36 \r
37 ##### 19.3.3.2.1 Requirements \r
38 \r
39 In order to set up a wireless access point with DragonFly, you need to have a compatible wireless card. Currently, only cards with the Prism chipset are supported. You will also need a wired network card that is supported by DragonFly (this should not be difficult to find, DragonFly supports a lot of different devices). For this guide, we will assume you want to [bridge(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#bridge&section4) all traffic between the wireless device and the network attached to the wired network card.\r
40 \r
41 The hostap functionality that DragonFly uses to implement the access point works best with certain versions of firmware. Prism 2 cards should use firmware version 1.3.4 or newer. Prism 2.5 and Prism 3 cards should use firmware 1.4.9. Older versions of the firmware way or may not function correctly. At this time, the only way to update cards is with Windows® firmware update utilities available from your card's manufacturer.\r
42 \r
43 ##### 19.3.3.2.2 Setting It Up \r
44 \r
45 First, make sure your system can see the wireless card:\r
46 \r
47     \r
48     # ifconfig -a\r
49     wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r
50             inet6 fe80::202:2dff:fe2d:c938%wi0 prefixlen 64 scopeid 0x7\r
51             inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255\r
52             ether 00:09:2d:2d:c9:50\r
53             media: IEEE 802.11 Wireless Ethernet autoselect (DS/2Mbps)\r
54             status: no carrier\r
55             ssid ""\r
56             stationname "DragonFly Wireless node"\r
57             channel 10 authmode OPEN powersavemode OFF powersavesleep 100\r
58             wepmode OFF weptxkey 1\r
59 \r
60 \r
61 Do not worry about the details now, just make sure it shows you something to indicate you 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 [pccardc(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#pccardc&section8) and [pccardd(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=pccardd&section=8) manual pages for more information.\r
62 \r
63 Next, you will need to load a module in order to get the bridging part of DragonFly ready for the access point. To load the [bridge(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#bridge&section4) module, simply run the following command:\r
64 \r
65     \r
66     # kldload bridge\r
67 \r
68 \r
69 It should not have produced any errors when loading the module. If it did, you may need to compile the [bridge(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#bridge&section4) code into your kernel. The [network-bridging.html Bridging] section of this handbook should be able to help you accomplish that task.\r
70 \r
71 Now that you have the bridging stuff done, we need to tell the DragonFly kernel which interfaces to bridge together. We do that by using [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#sysctl&section8):\r
72 \r
73     \r
74     # sysctl net.link.ether.bridge=1\r
75     # sysctl net.link.ether.bridge_cfg="wi0,xl0"\r
76     # sysctl net.inet.ip.forwarding=1\r
77 \r
78 \r
79 Now it is time for the wireless card setup. The following command will set the card into an access point:\r
80 \r
81     \r
82     # ifconfig wi0 ssid `***my_net***` channel 11 media DS/11Mbps mediaopt hostap up stationname "`***DragonFly AP***`"\r
83     \r
84 \r
85 \r
86 The [ifconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#ifconfig&section8) line brings the `wi0` interface up, sets its SSID to `***my_net***`, and sets the station name to `***DragonFly AP***`. The `media DS/11Mbps` sets the card into 11Mbps mode and is needed for any `mediaopt` to take effect. The `mediaopt hostap` option places the interface into access point mode. The `channel 11` option sets the 802.11b channel to use. The [wicontrol(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=wicontrol&section=8) manual page has valid channel options for your regulatory domain.\r
87 \r
88 Now you should have a complete functioning access point up and running. You are encouraged to read [wicontrol(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#wicontrol&section8), [ifconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=ifconfig&section=8), and [wi(4)](http://leaf.dragonflybsd.org/cgi/web-man?command=wi&section=4) for further information.\r
89 \r
90 It is also suggested that you read the section on encryption that follows.\r
91 \r
92 ##### 19.3.3.2.3 Status Information \r
93 \r
94 Once the access point is configured and operational, operators will want to see the clients that are associated with the access point. At any time, the operator may type:\r
95 \r
96     \r
97     # wicontrol -l\r
98     1 station:\r
99     00:09:b7:7b:9d:16  asid#04c0, flags3<ASSOC,AUTH>, caps=1<ESS>, rates=f<1M,2M,5.5M,11M>, sig=38/15\r
100 \r
101 \r
102 This shows that there is one station associated, along with its parameters. The signal indicated should be used as a relative indication of strength only. Its translation to dBm or other units varies between different firmware revisions.\r
103 \r
104 #### 19.3.3.3 Clients \r
105 \r
106 A wireless client is a system that accesses an access point or another client directly.\r
107 \r
108 Typically, wireless clients only have one network device, the wireless networking card.\r
109 \r
110 There are a few different ways to configure a wireless client. These are based on the different wireless modes, generally BSS (infrastructure mode, which requires an access point), and IBSS (ad-hoc, or peer-to-peer mode). In our example, we will use the most popular of the two, BSS mode, to talk to an access point.\r
111 \r
112 ##### 19.3.3.3.1 Requirements \r
113 \r
114 There is only one real requirement for setting up DragonFly as a wireless client. You will need a wireless card that is supported by DragonFly.\r
115 \r
116 ##### 19.3.3.3.2 Setting Up a Wireless DragonFly Client \r
117 \r
118 You will need to know a few things about the wireless network you are joining before you start. In this example, we are joining a network that has a name of `***my_net***`, and encryption turned off.\r
119 \r
120  **Note:** In this example, we are not using encryption, which is a dangerous situation. In the next section, you will learn how to turn on encryption, why it is important to do so, and why some encryption technologies still do not completely protect you.\r
121 \r
122 Make sure your card is recognized by DragonFly:\r
123 \r
124     \r
125     # ifconfig -a\r
126     wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r
127             inet6 fe80::202:2dff:fe2d:c938%wi0 prefixlen 64 scopeid 0x7\r
128             inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255\r
129             ether 00:09:2d:2d:c9:50\r
130             media: IEEE 802.11 Wireless Ethernet autoselect (DS/2Mbps)\r
131             status: no carrier\r
132             ssid ""\r
133             stationname "DragonFly Wireless node"\r
134             channel 10 authmode OPEN powersavemode OFF powersavesleep 100\r
135             wepmode OFF weptxkey 1\r
136 \r
137 \r
138 Now, we can set the card to the correct settings for our network:\r
139 \r
140     \r
141     # ifconfig wi0 inet `***192.168.0.20***` netmask `***255.255.255.0***` ssid `***my_net***`\r
142 \r
143 \r
144 Replace `192.168.0.20` and `255.255.255.0` with a valid IP address and netmask on your wired network. Remember, our access point is bridging the data between the wireless network, and the wired network, so it will appear to the other devices on your network that you are on the wired network just as they are.\r
145 \r
146 Once you have done that, you should be able to ping hosts on the wired network just as if you were connected using a standard wired connection.\r
147 \r
148 If you are experiencing problems with your wireless connection, check to make sure that your are associated (connected) to the access point:\r
149 \r
150     \r
151     # ifconfig wi0\r
152 \r
153 \r
154 should return some information, and you should see:\r
155 \r
156     \r
157     status: associated\r
158 \r
159 \r
160 If it does not show `associated`, then you may be out of range of the access point, have encryption on, or possibly have a configuration problem.\r
161 \r
162 #### 19.3.3.4 Encryption \r
163 \r
164 Encryption on a wireless network is important because you no longer have the ability to keep the network contained in a well protected area. Your wireless data will be broadcast across your entire neighborhood, so anyone who cares to read it can. This is where encryption comes in. By encrypting the data that is sent over the airwaves, you make it much more difficult for any interested party to grab your data right out of the air.\r
165 \r
166 The two most common ways to encrypt the data between your client and the access point are WEP, and [ipsec(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#ipsec&section4).\r
167 \r
168 ##### 19.3.3.4.1 WEP \r
169 \r
170 WEP is an abbreviation for Wired Equivalency Protocol. WEP is an attempt to make wireless networks as safe and secure as a wired network. Unfortunately, it has been cracked, and is fairly trivial to break. This also means it is not something to rely on when it comes to encrypting sensitive data.\r
171 \r
172 It is better than nothing, so use the following to turn on WEP on your new DragonFly access point:\r
173 \r
174     \r
175     # ifconfig wi0 inet up ssid `***my_net***` wepmode on wepkey `***0x1234567890***` media DS/11Mbps mediaopt hostap\r
176 \r
177 \r
178 And you can turn on WEP on a client with this command:\r
179 \r
180     \r
181     # ifconfig wi0 inet `***192.168.0.20***` netmask `***255.255.255.0***` ssid `***my_net***` wepmode on wepkey `***0x1234567890***`\r
182 \r
183 \r
184 Note that you should replace the `***0x1234567890***` with a more unique key.\r
185 \r
186 ##### 19.3.3.4.2 IPsec \r
187 \r
188 [ipsec(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#ipsec&section4) is a much more robust and powerful tool for encrypting data across a network. This is definitely the preferred way to encrypt data over a wireless network. You can read more about [ipsec(4)](http://leaf.dragonflybsd.org/cgi/web-man?command=ipsec&section=4) security and how to implement it in the [ipsec.html IPsec] section of this handbook.\r
189 \r
190 #### 19.3.3.5 Tools \r
191 \r
192 There are a small number of tools available for use in debugging and setting up your wireless network, and here we will attempt to describe some of them and what they do.\r
193 \r
194 ##### 19.3.3.5.1 The `wicontrol`, `ancontrol` and `raycontrol` Utilities \r
195 \r
196 These are the tools you can use to control how your wireless card behaves on the wireless network. In the examples above, we have chosen to use [wicontrol(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#wicontrol&section8), since our wireless card is a `wi0` interface. If you had a Cisco wireless device, it would come up as `an0`, and therefore you would use [ancontrol(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=ancontrol&section=8).\r
197 \r
198 ##### 19.3.3.5.2 The `ifconfig` Command \r
199 \r
200 The [ifconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#ifconfig&section8) command can be used to do many of the same options as [wicontrol(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=wicontrol&section=8), however it does lack a few options. Check [ifconfig(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=ifconfig&section=8) for command line parameters and options.\r
201 \r
202 #### 19.3.3.6 Supported Cards \r
203 \r
204 ##### 19.3.3.6.1 Access Points \r
205 \r
206 The only cards that are currently supported for BSS (as an access point) mode are devices based on the Prism 2, 2.5, or 3 chipsets. For a complete list, look at [wi(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#wi&section4).\r
207 \r
208 ##### 19.3.3.6.2 Clients \r
209 \r
210 Almost all 802.11b wireless cards are currently supported under DragonFly. Most cards based on Prism, Spectrum24, Hermes, Aironet, and Raylink will work as a wireless network card in IBSS (ad-hoc, peer-to-peer, and BSS) mode.\r
211 \r
212 \r
213 \r
214 CategoryHandbook\r
215 CategoryHandbook-advancednetworking\r