[Linux] Wireless Settings Considerations for OpenWrt

Source: Internet
Author: User

OpenWrt after the brush is complete, it does not automatically turn on the wireless function, need to manually modify the configuration file, and then restart the Network service. The configuration file for managing wireless features is:

/etc/config/wireless

The content is composed of two parts: config wifi-device and config wifi-iface. The former configuration of the wireless network card operating mode, channel, MAC address, which antennas used (generally 1, 2, 33 antennas, depending on the network card has several feeder interface), is DSSS or OFDM information. The latter configures the NIC interface information, such as the name of the interface, ESSID, password and encryption, network connectivity (Networking configuration items), and so on. Internet connection Network This must be consistent with one of the interface in/etc/config/network, indicating which interface (interface) The wireless card corresponds to.

For example, the following configuration, which contains two config wifi-device+config wifi-iface configuration blocks, requires two network cards. (as the author of the blog computer and management OpenWrt computer is not the same, for convenience, the following content is copied from elsewhere, does not affect the correctness of the narrative.) )

  1. # 1
  2. Config Wifi-device ' radio0 '
  3. Option type ' mac80211 '
  4. Option Hwmode ' 11ng '
  5. Option path ' Platform/ar934x_wmac '
  6. Option Htmode ' ht40+ '
  7. List ht_capab ' LDPC '
  8. List ht_capab ' short-gi-20 '
  9. List ht_capab ' short-gi-40 '
  10. List ht_capab ' TX-STBC '
  11. List ht_capab ' RX-STBC1 '
  12. List ht_capab ' dsss_cck-40 '
  13. Option Noscan ' 1 '
  14. Option Channel ' 7 '
  15. Option Txpower ' 27 '
  16. Option Country ' CN '
  17. Config Wifi-iface
  18. Option Device ' Radio0 '
  19. Option Network ' LAN '
  20. Option Mode ' AP '
  21. Option SSID ' openwrt_25g '
  22. Option encryption ' psk-mixed '
  23. Option key ' 11111111 '
  24. #2
  25. Config Wifi-device ' Radio1 '
  26. Option type ' mac80211 '
  27. Option Hwmode ' 11na '
  28. Option path ' pci0000:00/0000:00:00.0 '
  29. List ht_capab ' LDPC '
  30. List ht_capab ' short-gi-20 '
  31. List ht_capab ' short-gi-40 '
  32. List ht_capab ' TX-STBC '
  33. List ht_capab ' RX-STBC1 '
  34. List ht_capab ' dsss_cck-40 '
  35. Option Htmode ' ht40+ '
  36. Option Country ' CN '
  37. Option Noscan ' 1 '
  38. Option Txpower ' 17 '
  39. Option Channel ' 149 '
  40. Config Wifi-iface
  41. Option Device ' Radio1 '
  42. Option Network ' LAN '
  43. Option Mode ' AP '
  44. Option SSID ' openwrt_5g '
  45. Option encryption ' psk-mixed '
  46. Option key ' 11111111 '

The following is a few configuration items, other configuration items are either not commonly used, or at a glance.

1 Channel: Channels

The channel value must be correct, to know that the network card supports those channels, can be viewed with the iwlist command:

Iwlist C (or write the whole: Iwlist channel)

Note here that if the network card works at 5G, although according to the 802.11A Standard, 5G channel from 60 to 165 there are many, and the use of Iwlist query network card information also indicates that the network card supports these channels, but perhaps the channel configuration can only write more than 149 values. Because China's 5G channel only allows the use of more than 149 of the channel.

2 Hwmode: What is the standard of work

Hwmode and channel are corresponding, for example, if the channel is 149, meaning that the network card is working at 5G, then Hwmode can not write 11g, because the 11g standard defined communication frequency is not inclusive 5G, only 11a can.

The value of the Hwmode cannot be confused (that's what I know today). Valid values are: 11a 11b 11g 11na 11ng and so on. Using other strange values, perhaps the kernel will not be complain when the network card service is started, perhaps it is not possible to properly deploy the AP after the Web service is turned on, but the configuration may be wrong: In my experiment, I need to configure the AP to 11n, but because the value of Hwmode is written in 11an, The result is not as I wish, the network card actually works in the 11a standard, at this time although can establish the AP, can ping, but 11n is not enabled, does not meet my needs.

The reason can be explained in the following shell. When parsing the configuration file, it is parsed by this case code starting at line 8th in the following code, and then attempting to match 11BG, 11a, 11b, 11g, then 11n* (i.e. 11na, 11ng), then the other (with $ Default as the value of Hwmode).

1 Wifi_fixup_hwmode () {2Local device=" $"3Local default=" $"4 Local Hwmode hwmode_11n5Config_get Channel"$device"Channel6     7Config_get Hwmode"$device"Hwmode8      Case "$hwmode" inch911BG) hwmode=BG;;Ten11a) hwmode=A;; One11b) hwmode=b;; A11g) hwmode=g;; -11n*) -hwmode_11n="${hwmode# #11n}" the              Case "$hwmode _11n" inch -a|g);; -Default) hwmode_11n="$default" -             Esac +Config_set"$device"hwmode_11n"$hwmode _11n" -         ;; +*) AHwmode= at             if["${channel:-0}"-gt0]; Then  -                 if["${channel:-0}"-gt -]; Then -Hwmode=a -                 Else -Hwmode=g -                 fi in             Else -Hwmode="$default" to             fi +         ;; -     Esac theConfig_set"$device"Hwmode"$hwmode" *}

Mode in the 3 config Wifi-iface

Mode is the work of the network card, which is different from hwmode (Hardware mode), the value is the network card as what role in communication. Typically there are several roles, but the NIC does not necessarily support these roles:

STA: User-side, WiFi users

Master: Access Point (AP)

Ad-hoc: Only in this mode, the device can be a multi-hop network (mesh network) with devices in other AD-HOC modes, which requires some wireless Ad-hoc routing protocols, such as the famous Batmand protocol.

Monitor: Only in this mode, the NIC can listen for frames from other devices on the same channel. You can get the address, content, RSSI (even channel state information) for these frames CSI, theoretically, actually, according to our tests, the CSI tools based on the Intel 5300 network adapter do not work stably in monitor mode, which CSI Daniel, the author of tools, also admits).

[Linux] Wireless Settings Considerations for OpenWrt

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.