1 The WiFi settings are configured in the file
\texttt{/etc/config/wireless
}
2 (currently supported on Broadcom, Atheros and mac80211). When booting the router for the first time
3 it should detect your card and create a sample configuration file. By default '
\texttt{option network lan
}' is
4 commented. This prevents unsecured sharing of the network over the wireless interface.
6 Each wireless driver has its own configuration script in
\texttt{/lib/wifi/driver
\_name.sh
} which handles
7 driver specific options and configurations. This script is also calling driver specific binaries like wlc for
8 Broadcom, or hostapd and wpa
\_supplicant for atheros and mac80211.
10 The reason for using such architecture, is that it abstracts the driver configuration.
12 \paragraph{Generic Broadcom wireless config:
}
15 config wifi-device "wl0"
16 option type "broadcom"
25 option encryption "none"
28 \paragraph{Generic Atheros wireless config:
}
31 config wifi-device "wifi0"
42 option encryption "none"
45 \paragraph{Generic mac80211 wireless config:
}
48 config wifi-device "wifi0"
49 option type "mac80211"
58 option encryption "none"
61 \paragraph{Generic multi-radio Atheros wireless config:
}
64 config wifi-device wifi0
72 option ssid OpenWrt_private
74 option encryption none
76 config wifi-device wifi1
84 option ssid OpenWrt_public
86 option encryption none
89 There are two types of config sections in this file. The '
\texttt{wifi-device
}' refers to
90 the physical wifi interface and '
\texttt{wifi-iface
}' configures a virtual interface on top
91 of that (if supported by the driver).
93 A full outline of the wireless configuration file with description of each field:
96 config wifi-device wifi device name
97 option type broadcom, atheros, mac80211
98 option country us, uk, fr, de, etc.
100 option maxassoc
1-
128 (broadcom only)
101 option distance
1-n (meters)
102 option hwmode
11b,
11g,
11a,
11bg (atheros, mac80211)
103 option rxantenna
0,
1,
2 (atheros, broadcom)
104 option txantenna
0,
1,
2 (atheros, broadcom)
105 option txpower transmission power in dBm
108 option network the interface you want wifi to bridge with
109 option device wifi0, wifi1, wifi2, wifiN
110 option mode ap, sta, adhoc, monitor, mesh, or wds
111 option txpower (deprecated) transmission power in dBm
112 option ssid ssid name
113 option bssid bssid address
114 option encryption none, wep, psk, psk2, wpa, wpa2
115 option key encryption key
120 option server ip address
123 option isolate
0,
1 (broadcom)
126 \paragraph{Options for the
\texttt{wifi-device
}:
}
129 \item \texttt{type
} \\
130 The driver to use for this interface.
132 \item \texttt{country
} \\
133 The country code used to determine the regulatory settings.
135 \item \texttt{channel
} \\
136 The wifi channel (e.g.
1-
14, depending on your country setting).
138 \item \texttt{maxassoc
} \\
139 Optional: Maximum number of associated clients. This feature is supported only on the Broadcom chipsets.
141 \item \texttt{distance
} \\
142 Optional: Distance between the ap and the furthest client in meters. This feature is supported only on the Atheros chipsets.
144 \item \texttt{mode
} \\
145 The frequency band (
\texttt{b
},
\texttt{g
},
\texttt{bg
},
\texttt{a
}). This feature is only supported on the Atheros chipsets.
147 \item \texttt{diversity
} \\
148 Optional: Enable diversity for the Wi-Fi device. This feature is supported only on the Atheros chipsets.
150 \item \texttt{rxantenna
} \\
151 Optional: Antenna identifier (
0,
1 or
2) for reception. This feature is supported by Atheros and some Broadcom chipsets.
153 \item \texttt{txantenna
} \\
154 Optional: Antenna identifier (
0,
1 or
2) for emission. This feature is supported by Atheros and some Broadcom chipsets.
156 \item \texttt{txpower
}
157 Set the transmission power to be used. The amount is specified in dBm.
161 \paragraph{Options for the
\texttt{wifi-iface
}:
}
164 \item \texttt{network
} \\
165 Selects the interface section from
\texttt{/etc/config/network
} to be
166 used with this interface
168 \item \texttt{device
} \\
169 Set the wifi device name.
171 \item \texttt{mode
} \\
178 \item \texttt{sta
} \\
181 \item \texttt{adhoc
} \\
184 \item \texttt{monitor
} \\
187 \item \texttt{mesh
} \\
188 Mesh Point mode (
802.11s)
190 \item \texttt{wds
} \\
191 WDS point-to-point link
196 Set the SSID to be used on the wifi device.
199 Set the BSSID address to be used for wds to set the mac address of the other wds unit.
201 \item \texttt{txpower
}
202 (Deprecated, set in wifi-device) Set the transmission power to be used. The amount is specified in dBm.
204 \item \texttt{encryption
} \\
205 Encryption setting. Accepts the following values:
210 \item \texttt{psk
},
\texttt{psk2
} \\
211 WPA(
2) Pre-shared Key
213 \item \texttt{wpa
},
\texttt{wpa2
} \\
217 \item \texttt{key, key1, key2, key3, key4
} (wep, wpa and psk) \\
218 WEP key, WPA key (PSK mode) or the RADIUS shared secret (WPA RADIUS mode)
220 \item \texttt{server
} (wpa) \\
221 The RADIUS server ip address
223 \item \texttt{port
} (wpa) \\
224 The RADIUS server port (defaults to
1812)
226 \item \texttt{hidden
} \\
227 0 broadcasts the ssid;
1 disables broadcasting of the ssid
229 \item \texttt{isolate
} \\
230 Optional: Isolation is a mode usually set on hotspots that limits the clients to communicate only with the AP and not with other wireless clients.
231 0 disables ap isolation (default);
1 enables ap isolation.
235 \paragraph{Mesh Point
}
237 Mesh Point (
802.11s) is only supported by some mac80211 drivers. It requires the iw package
238 to be installed to setup mesh links. OpenWrt creates mshN mesh point interfaces. A sample
239 configuration looks like this:
242 config wifi-device "wlan0"
243 option type "mac80211"
247 option device "wlan0"
250 option mesh_id "OpenWrt"
253 \paragraph{Wireless Distribution System
}
255 WDS is a non-standard mode which will be working between two Broadcom devices for instance
256 but not between a Broadcom and Atheros device.
258 \subparagraph{Unencrypted WDS connections
}
260 This configuration example shows you how to setup unencrypted WDS connections.
261 We assume that the peer configured as below as the BSSID ca:fe:ba:be:
00:
01
262 and the remote WDS endpoint ca:fe:ba:be:
00:
02 (option bssid field).
265 config wifi-device "wl0"
266 option type "broadcom"
273 option ssid "OpenWrt"
275 option encryption "none"
281 option ssid "OpenWrt WDS"
282 option bssid "ca:fe:ba:be:
00:
02"
285 \subparagraph{Encrypted WDS connections
}
287 It is also possible to encrypt WDS connections.
\texttt{psk
},
\texttt{psk2
} and
288 \texttt{psk+psk2
} modes are supported. Configuration below is an example
289 configuration using Pre-Shared-Keys with AES algorithm.
292 config wifi-device wl0
300 option ssid "OpenWrt"
301 option encryption psk2
302 option key "<key for clients>"
308 option bssid ca:fe:ba:be:
00:
02
309 option ssid "OpenWrt WDS"
310 option encryption psk2
311 option key "<psk for WDS>"
314 \paragraph{802.1x configurations
}
316 OpenWrt supports both
802.1x client and Access Point
317 configurations.
802.1x client is only working with
318 drivers supported by wpa-supplicant. Configuration
319 only supports EAP types TLS, TTLS or PEAP.
321 \subparagraph{EAP-TLS
}
329 option ca_cert "/etc/config/certs/ca.crt"
330 option priv_key "/etc/config/certs/priv.crt"
331 option priv_key_pwd "PKCS
#12 passphrase"
334 \subparagraph{EAP-PEAP
}
342 option ca_cert "/etc/config/certs/ca.crt"
344 option identity username
345 option password password
348 \paragraph{Limitations:
}
350 There are certain limitations when combining modes.
351 Only the following mode combinations are supported:
354 \item \textbf{Broadcom
}: \\
356 \item 1x
\texttt{sta
},
0-
3x
\texttt{ap
}
357 \item 1-
4x
\texttt{ap
}
358 \item 1x
\texttt{adhoc
}
359 \item 1x
\texttt{monitor
}
362 WDS links can only be used in pure AP mode and cannot use WEP (except when sharing the
363 settings with the master interface, which is done automatically).
365 \item \textbf{Atheros
}: \\
367 \item 1x
\texttt{sta
},
0-Nx
\texttt{ap
}
368 \item 1-Nx
\texttt{ap
}
369 \item 1x
\texttt{adhoc
}
372 N is the maximum number of VAPs that the module allows, it defaults to
4, but can be
373 changed by loading the module with the maxvaps=N parameter.
376 \paragraph{Adding a new driver configuration
}
378 Since we currently only support thread different wireless drivers : Broadcom, Atheros and mac80211,
379 you might be interested in adding support for another driver like Ralink RT2x00,
380 Texas Instruments ACX100/
111.
382 The driver specific script should be placed in
\texttt{/lib/wifi/<driver>.sh
} and has to
383 include several functions providing :
386 \item detection of the driver presence
387 \item enabling/disabling the wifi interface(s)
388 \item configuration reading and setting
389 \item third-party programs calling (nas, supplicant)
392 Each driver script should append the driver to a global DRIVERS variable :
395 append DRIVERS "driver name"
398 \subparagraph{\texttt{scan
\_<driver>
}}
400 This function will parse the
\texttt{/etc/config/wireless
} and make sure there
401 are no configuration incompatibilities, like enabling hidden SSIDS with ad-hoc mode
402 for instance. This can be more complex if your driver supports a lof of configuration
403 options. It does not change the state of the interface.
410 config_get vifs "$device" vifs
412 # check config consistency for wifi-iface sections
414 # check mode combination
418 \subparagraph{\texttt{enable
\_<driver>
}}
420 This function will bring up the wifi device and optionally create application specific
421 configuration files, e.g. for the WPA authenticator or supplicant.
428 config_get vifs "$device" vifs
430 # bring up virtual interface belonging to
431 # the wifi-device "$device"
436 \subparagraph{\texttt{disable
\_<driver>
}}
438 This function will bring down the wifi device and all its virtual interfaces (if supported).
445 # bring down virtual interfaces belonging to
446 # "$device" regardless of whether they are
447 # configured or not. Don't rely on the vifs
448 # variable at this point
452 \subparagraph{\texttt{detect
\_<driver>
}}
454 This function looks for interfaces that are usable with the driver. Template config sections
455 for new devices should be written to stdout. Must check for already existing config sections
456 belonging to the interfaces before creating new templates.
461 [ wifi-device = "$(config_get dummydev type)"
] && return
0
463 config wifi-device dummydev
465 # REMOVE THIS LINE TO ENABLE WIFI:
469 option device dummydev