wireless.tex 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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.
  5. Each wireless driver has its own configuration script in \texttt{/lib/wifi/driver\_name.sh} which handles
  6. driver specific options and configurations. This script is also calling driver specific binaries like wlc for
  7. Broadcom, or hostapd and wpa\_supplicant for atheros.
  8. The reason for using such architecture, is that it abstracts the driver configuration
  9. \paragraph{Generic Broadcom wireless config:}
  10. \begin{Verbatim}
  11. config wifi-device "wl0"
  12. option type "broadcom"
  13. option channel "5"
  14. config wifi-iface
  15. option device "wl0"
  16. # option network lan
  17. option mode "ap"
  18. option ssid "OpenWrt"
  19. option hidden "0"
  20. option encryption "none"
  21. \end{Verbatim}
  22. \paragraph{Generic Atheros wireless config:}
  23. \begin{Verbatim}
  24. config wifi-device "wifi0"
  25. option type "atheros"
  26. option channel "5"
  27. option agmode "11g"
  28. config wifi-iface
  29. option device "wifi0"
  30. # option network lan
  31. option mode "ap"
  32. option ssid "OpenWrt"
  33. option hidden "0"
  34. option encryption "none"
  35. \end{Verbatim}
  36. \paragraph{Generic multi-radio Atheros wireless config:}
  37. \begin{Verbatim}
  38. config wifi-device wifi0
  39. option type atheros
  40. option channel 1
  41. config wifi-iface
  42. option device wifi0
  43. # option network lan
  44. option mode ap
  45. option ssid OpenWrt_private
  46. option hidden 0
  47. option encryption none
  48. config wifi-device wifi1
  49. option type atheros
  50. option channel 11
  51. config wifi-iface
  52. option device wifi1
  53. # option network lan
  54. option mode ap
  55. option ssid OpenWrt_public
  56. option hidden 1
  57. option encryption none
  58. \end{Verbatim}
  59. There are two types of config sections in this file. The '\texttt{wifi-device}' refers to
  60. the physical wifi interface and '\texttt{wifi-iface}' configures a virtual interface on top
  61. of that (if supported by the driver).
  62. A full outline of the wireless configuration file with description of each field:
  63. \begin{Verbatim}
  64. config wifi-device wifi device name
  65. option type broadcom, atheros
  66. option country us, uk, fr, de, etc.
  67. option channel 1-14
  68. option maxassoc 1-128 (broadcom only)
  69. option distance 1-n
  70. option agmode 11b, 11g, 11a, 11bg (atheros only)
  71. config wifi-iface
  72. option network the interface you want wifi to bridge with
  73. option device wifi0, wifi1, wifi2, wifiN
  74. option mode ap, sta, adhoc, or wds
  75. option ssid ssid name
  76. option bssid bssid address
  77. option encryption none, wep, psk, psk2, wpa, wpa2
  78. option key encryption key
  79. option key1 key 1
  80. option key2 key 2
  81. option key3 key 3
  82. option key4 key 4
  83. option server ip address
  84. option port port
  85. option hidden 0,1
  86. option isolate 0,1
  87. \end{Verbatim}
  88. \paragraph{Options for the \texttt{wifi-device}:}
  89. \begin{itemize}
  90. \item \texttt{type} \\
  91. The driver to use for this interface.
  92. \item \texttt{country} \\
  93. The country code used to determine the regulatory settings.
  94. \item \texttt{channel} \\
  95. The wifi channel (e.g. 1-14, depending on your country setting).
  96. \item \texttt{maxassoc} \\
  97. Optional: Maximum number of associated clients. This feature is supported only on the broadcom chipset.
  98. \item \texttt{distance} \\
  99. Optional: Distance between the ap and the furthest client in meters. This feature is supported only on the atheros chipset.
  100. \item \texttt{mode} \\
  101. The frequency band (\texttt{b}, \texttt{g}, \texttt{bg}, \texttt{a}). This feature is only supported on the atheros chipset.
  102. \end{itemize}
  103. \paragraph{Options for the \texttt{wifi-iface}:}
  104. \begin{itemize}
  105. \item \texttt{network} \\
  106. Selects the interface section from \texttt{/etc/config/network} to be
  107. used with this interface
  108. \item \texttt{device} \\
  109. Set the wifi device name.
  110. \item \texttt{mode} \\
  111. Operating mode:
  112. \begin{itemize}
  113. \item \texttt{ap} \\
  114. Access point mode
  115. \item \texttt{sta} \\
  116. Client mode
  117. \item \texttt{adhoc} \\
  118. Ad-Hoc mode
  119. \item \texttt{wds} \\
  120. WDS point-to-point link
  121. \end{itemize}
  122. \item \texttt{ssid}
  123. Set the SSID to be used on the wifi device.
  124. \item \texttt{bssid}
  125. Set the BSSID address to be used for wds to set the mac address of the other wds unit.
  126. \item \texttt{encryption} \\
  127. Encryption setting. Accepts the following values:
  128. \begin{itemize}
  129. \item \texttt{none}
  130. \item \texttt{wep}
  131. \item \texttt{psk}, \texttt{psk2} \\
  132. WPA(2) Pre-shared Key
  133. \item \texttt{wpa}, \texttt{wpa2} \\
  134. WPA(2) RADIUS
  135. \end{itemize}
  136. \item \texttt{key, key1, key2, key3, key4} (wep, wpa and psk) \\
  137. WEP key, WPA key (PSK mode) or the RADIUS shared secret (WPA RADIUS mode)
  138. \item \texttt{server} (wpa) \\
  139. The RADIUS server ip address
  140. \item \texttt{port} (wpa) \\
  141. The RADIUS server port
  142. \item \texttt{hidden} \\
  143. 0 broadcasts the ssid; 1 disables broadcasting of the ssid
  144. \item \texttt{isolate} \\
  145. 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.
  146. 0 disables ap isolation (default); 1 enables ap isolation.
  147. \end{itemize}
  148. \paragraph{Limitations:}
  149. There are certain limitations when combining modes.
  150. Only the following mode combinations are supported:
  151. \begin{itemize}
  152. \item \textbf{Broadcom}: \\
  153. \begin{itemize}
  154. \item 1x \texttt{sta}, 0-3x \texttt{ap}
  155. \item 1-4x \texttt{ap}
  156. \item 1x \texttt{adhoc}
  157. \end{itemize}
  158. WDS links can only be used in pure AP mode and cannot use WEP (except when sharing the
  159. settings with the master interface, which is done automatically).
  160. \item \textbf{Atheros}: \\
  161. \begin{itemize}
  162. \item 1x \texttt{sta}, 0-4x \texttt{ap}
  163. \item 1-4x \texttt{ap}
  164. \item 1x \texttt{adhoc}
  165. \end{itemize}
  166. \end{itemize}
  167. \paragraph{Adding a new driver configuration}
  168. Since we currently only support two different wireless drivers : Broadcom and Atheros,
  169. you might be interested in adding support for another driver like Ralink RT2x00,
  170. Texas Instruments ACX100/111.
  171. The driver specific script should be placed in \texttt{/lib/wifi/<driver>.sh} and has to
  172. include several functions providing :
  173. \begin{itemize}
  174. \item detection of the driver presence
  175. \item enabling/disabling the wifi interface(s)
  176. \item configuration reading and setting
  177. \item third-party programs calling (nas, supplicant)
  178. \end{itemize}
  179. Each driver script should append the driver to a global DRIVERS variable :
  180. \begin{verbatim}
  181. append DRIVERS "driver name"
  182. \end{verbatim}
  183. \subparagraph{scan\_driver}
  184. This function will parse the \texttt{/etc/config/wireless} and make sure there
  185. are no configuration incompatibilities, like enabling hidden SSIDS with ad-hoc mode
  186. for instance. This can be more complex if your driver supports a lof of configuration
  187. options. It does not enable your wireless driver to work.
  188. \subparagraph{enable\_driver}
  189. This function will enable the driver and read the configuration file to create application
  190. specific configuration files for the NAS or supplicant program. It will not check the
  191. configuration consistency.
  192. \subparagraph{disable\_driver}
  193. This function should properly shutdown the wireless interfaces and kill associated programs
  194. running on top of it.
  195. \subparagraph{detec\_driver}
  196. This function should reliably report the existence of the driver and of one or more of its
  197. wireless interfaces. A basic configuration file has to be generated in the meantime.