1 The WiFi settings are configured in the file
\texttt{/etc/config/wireless
}
2 (currently supported on Broadcom and Atheros). 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.
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 multi-radio Atheros wireless config:
}
48 config wifi-device wifi0
56 option ssid OpenWrt_private
58 option encryption none
60 config wifi-device wifi1
68 option ssid OpenWrt_public
70 option encryption none
73 There are two types of config sections in this file. The '
\texttt{wifi-device
}' refers to
74 the physical wifi interface and '
\texttt{wifi-iface
}' configures a virtual interface on top
75 of that (if supported by the driver).
77 A full outline of the wireless configuration file with description of each field:
80 config wifi-device wifi device name
81 option type broadcom, atheros
82 option country us, uk, fr, de, etc.
84 option maxassoc
1-
128 (broadcom only)
86 option agmode
11b,
11g,
11a,
11bg (atheros only)
89 option network the interface you want wifi to bridge with
90 option device wifi0, wifi1, wifi2, wifiN
91 option mode ap, sta, adhoc, or wds
93 option bssid bssid address
94 option encryption none, wep, psk, psk2, wpa, wpa2
95 option key encryption key
100 option server ip address
106 \paragraph{Options for the
\texttt{wifi-device
}:
}
109 \item \texttt{type
} \\
110 The driver to use for this interface.
112 \item \texttt{country
} \\
113 The country code used to determine the regulatory settings.
115 \item \texttt{channel
} \\
116 The wifi channel (e.g.
1-
14, depending on your country setting).
118 \item \texttt{maxassoc
} \\
119 Optional: Maximum number of associated clients. This feature is supported only on the broadcom chipset.
121 \item \texttt{distance
} \\
122 Optional: Distance between the ap and the furthest client in meters. This feature is supported only on the atheros chipset.
124 \item \texttt{mode
} \\
125 The frequency band (
\texttt{b
},
\texttt{g
},
\texttt{bg
},
\texttt{a
}). This feature is only supported on the atheros chipset.
130 \paragraph{Options for the
\texttt{wifi-iface
}:
}
133 \item \texttt{network
} \\
134 Selects the interface section from
\texttt{/etc/config/network
} to be
135 used with this interface
137 \item \texttt{device
} \\
138 Set the wifi device name.
140 \item \texttt{mode
} \\
147 \item \texttt{sta
} \\
150 \item \texttt{adhoc
} \\
153 \item \texttt{wds
} \\
154 WDS point-to-point link
159 Set the SSID to be used on the wifi device.
162 Set the BSSID address to be used for wds to set the mac address of the other wds unit.
164 \item \texttt{encryption
} \\
165 Encryption setting. Accepts the following values:
170 \item \texttt{psk
},
\texttt{psk2
} \\
171 WPA(
2) Pre-shared Key
173 \item \texttt{wpa
},
\texttt{wpa2
} \\
177 \item \texttt{key, key1, key2, key3, key4
} (wep, wpa and psk) \\
178 WEP key, WPA key (PSK mode) or the RADIUS shared secret (WPA RADIUS mode)
180 \item \texttt{server
} (wpa) \\
181 The RADIUS server ip address
183 \item \texttt{port
} (wpa) \\
184 The RADIUS server port
186 \item \texttt{hidden
} \\
187 0 broadcasts the ssid;
1 disables broadcasting of the ssid
189 \item \texttt{isolate
} \\
190 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.
191 0 disables ap isolation (default);
1 enables ap isolation.
196 \paragraph{Limitations:
}
198 There are certain limitations when combining modes.
199 Only the following mode combinations are supported:
202 \item \textbf{Broadcom
}: \\
204 \item 1x
\texttt{sta
},
0-
3x
\texttt{ap
}
205 \item 1-
4x
\texttt{ap
}
206 \item 1x
\texttt{adhoc
}
209 WDS links can only be used in pure AP mode and cannot use WEP (except when sharing the
210 settings with the master interface, which is done automatically).
212 \item \textbf{Atheros
}: \\
214 \item 1x
\texttt{sta
},
0-
4x
\texttt{ap
}
215 \item 1-
4x
\texttt{ap
}
216 \item 1x
\texttt{adhoc
}
220 \paragraph{Adding a new driver configuration
}
222 Since we currently only support two different wireless drivers : Broadcom and Atheros,
223 you might be interested in adding support for another driver like Ralink RT2x00,
224 Texas Instruments ACX100/
111.
226 The driver specific script should be placed in
\texttt{/lib/wifi/<driver>.sh
} and has to
227 include several functions providing :
230 \item detection of the driver presence
231 \item enabling/disabling the wifi interface(s)
232 \item configuration reading and setting
233 \item third-party programs calling (nas, supplicant)
236 Each driver script should append the driver to a global DRIVERS variable :
239 append DRIVERS "driver name"
242 \subparagraph{\texttt{scan
\_<driver>
}}
244 This function will parse the
\texttt{/etc/config/wireless
} and make sure there
245 are no configuration incompatibilities, like enabling hidden SSIDS with ad-hoc mode
246 for instance. This can be more complex if your driver supports a lof of configuration
247 options. It does not change the state of the interface.
254 config_get vifs "$device" vifs
256 # check config consistency for wifi-iface sections
258 # check mode combination
262 \subparagraph{\texttt{enable
\_<driver>
}}
264 This function will bring up the wifi device and optionally create application specific
265 configuration files, e.g. for the WPA authenticator or supplicant.
272 config_get vifs "$device" vifs
274 # bring up virtual interface belonging to
275 # the wifi-device "$device"
280 \subparagraph{\texttt{disable
\_<driver>
}}
282 This function will bring down the wifi device and all its virtual interfaces (if supported).
289 # bring down virtual interfaces belonging to
290 # "$device" regardless of whether they are
291 # configured or not. Don't rely on the vifs
292 # variable at this point
296 \subparagraph{\texttt{detect
\_<driver>
}}
298 This function looks for interfaces that are usable with the driver. Template config sections
299 for new devices should be written to stdout. Must check for already existing config sections
300 belonging to the interfaces before creating new templates.
305 [ wifi-device = "$(config_get dummydev type)"
] && return
0
307 config wifi-device dummydev
309 # REMOVE THIS LINE TO ENABLE WIFI:
313 option device dummydev