Testing Antennas and Disabling Diversity Antenna 2 One application for Horst is testing external antennas, for example directional high gain antennas. The Mesh Potato, like many routers, has two antennas, numbered 1 and 2. Antenna 1 is a tx/rx antenna, and Antenna 2 is only rx, sometimes called a "diversity" antenna. This helps with multipath issues where the signal received by one antenna may be very weak, but very strong in another antenna just a few cm away. Multipath effects are especially common during indoor operation. Now we usually connect external antennas to Antenna 1, as we use external antennas for long range tx/rx operation. However the Mesh Potato Wifi driver tends to favour Antenna 2 for receive. So when testing antennas you can get confusing results: sometimes packets are received on Antenna 1 and sometimes on Antenna 2. These will usually have differe nt signal strengths and will confuse antenna testing results. So if you are using Horst to test antennas (or testing antennas with other software), it is useful to disable the receive only Antenna 2. First di sable automatic antenna selection:
root@OpenWrt:~# root@OpenWrt:~# echo 0 > /proc/sys/dev/wifi0/diver /proc/sys/dev/wifi0/diversity sity
Then select just Antenna 1:
root@OpenWrt:~# root@OpenWrt:~# echo 1 > /proc/sys/dev/wifi0/rxant /proc/sys/dev/wifi0/rxantenna enna
You can check using athstats:
root@OpenWrt:~# root@OpenWrt:~# athstats 74 tx management frames 2691 tx failed due to too many retries 361969 long on-chip tx retries 13509527 tx frames with no ack marked 120624 tx frames with an alternate rate 761053 rx failed due to bad CRC 46146 PHY errors 15 transmit override receive 52 OFDM restart 46079 CCK restart rssi of last ack: 17 rssi of last rcv: 24 739402 switched default/rx antenna Antenna profile: [1] tx tx
7247393 rx 37256094 37256094
[2] tx
7769498 rx
9750180
The last two lines from athstats indicate how many packets were received on Antenna 1 and how many on Antenna 2. After Antenna 1 is selected no more packets should be received on antenna 2. Try running athstats several times to check. Note that a reboot is required to re-enable diversity (Antenna 2) operation, this:
root@OpenWrt:~# root@OpenWrt:~# echo 1 > /proc/sys/dev/wifi0/diver /proc/sys/dev/wifi0/diversity sity
doesn't seem to work.
Audio Ping Ping option diversity 0 option rxantenna 1 option txantenna 1
iw list | grep ntenn
check antenna
iwconfig set country Bolivia = BO , set diversity = 0 ,
Wifi Devices The wifi-device refer to physical radio devices present on the system. T he options present in this section describe properties common across all wireless networks on this radio interface, such as channel or antenna selection. In most cases there is only one radio adapter present on the device, so only one such section is defined, however on multi-radio hardware there may be multiple wifi-device sections each referring to a different adapter. A minimal wifi-device declaration may look like the example below. Note that identifiers and options may vary for different chipset types or drivers.
config 'wifi-device' 'wl0' option 'type'
'broadcom'
option 'channel' '6'
wl0 is the internal identifier for the wireless adapter
broadcom specifies the chipset/driver type
6 is the wireless channel the device operates on
The possible options for device sections are listed in the table below. Note that not all options are used for all chipset/driver types, refer to the comments for further details. Common Options
Name
type
phy
Type
strin g
yes
(autodete cted)
Description
The type is determined on firstboot during the initial radio device detection it is usually not required to change it. Used values are broadcom on brcm47xx, or mac80211 for b43, ath5k and ath9k
no/
(autodete
Specifies the radio phy associated to this section. If present, it is usually
g
yes
cted)
autodetected and should not be changed.
yes/
(autodete
Specifies the radio adapter associated to this section, it is not used to change
no
cted)
the device mac but to identify the underlying interface.
no
0
yes
auto
addr ess
disabled
Default
ed
strin
MAC macaddr
Requir
bool ean
Disables the radio adapter if set to 1. Removing this option or setting it to 0 will enable the adapter
integ er or channel
"aut
Specifies the wireless channel to use. "auto" defaults to the minimum channel available
o"
hwmode
strin g
no
(driver
Selects the wireless protocol to use, possible values are 11b, 11g, and 11a (note
default)
that 11ng and 11naare not available options, see ticket 17541) Specifies the channel width in 802.11n and 802.11ac mode, possible values are:
strin htmode
g
no
(driver default)
HT20 (single HT40- (2x
20MHz channel),
20MHz channels, primary/control channel is upper, secondary
channel is below) HT40+ (2x
20MHz channels, primary/control channel is lower, secondary
channel is above). VHT20 / VHT40 / VHT80 / VHT160 (channel
width in 802.11ac, extra channels are
picked according to the specification) Cf. why.can.t.i.use.ht40.with.channel.11 andhttp://hostap.epitest.fi/cgit/hos tap/tree/hostapd/hostapd.conf (search for HT40) in the web page.
This option is only used for type mac80211
chanbw
integ er
Specifies a narrow channel width, possible values are: 5 (5MHz no
20
channel), 10 (10MHz channel) or 20(20MHz channel).
Only supported by the
ath9k
/ath5k driver (since Attitude Adjustment)
Specifies the available capabilities of the radio. The values are autodetected. ht_capab
strin g
no
(driver
Seehttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.conf for
default)
options (search for ht_capab in web page).
This option is only used for type mac80211
txpower
diversity
integ er bool ean
no
no
(driver default)
1
Specifies the transmission power in dBm
Enables or disables the automatic antenna selection by the driver
Specifies the antenna for receiving, the value may be driver specific, usually rxantenna
integ er
no
(driver
it is 1 for the first and 2for the second antenna. Specifying 0 enables
default)
automatic selection by the driver if supported. This option has no effec t if diversity is enabled
txantenna
integ er
no
(driver default)
Specifies the antenna for transmitting, values are identical to rxantenna
Selects the antenna, possible values are vertical for internal vertical antenna
strin g
no
(driver default)
polarization, horizontal for internal horizontal polarization or external to use the external antenna connector
Only used on the Ubiquiti NanoStation device family instead of the rxantenna/txantenna settings.
country
country_i e
varie s
bool ean
no
no
(driver default)
Specifies the country code, affects the available channels and transmission powers. For typebroadcom a two letter country code is used (EN or DE). The madwifi driver expects a numeric code.
1
Enables IEEE 802.11d country IE (information element) advertisement in
if country is
beacon and probe response frames. This IE contains the country code and
set,
channel/power map. Requires country.
otherwise
0 integ
distance
er
bool
noscan
ean
integ
beacon_in terval
er
basic_rat e
list
Distance between the ap and the furthest client in meters .
(driver
no
default)
Only supported by madwifi, and the mac80211 type (in trunk) Do not scan for overlapping BSSs in HT40+/- mo de.
no
Only supported by mac80211
0
Turning this on will violate regulatory requirements! Set the beacon interval. This is the time interval between beacon frames,
100 (hostapd
no
default)
no
measured in units of 1.024 ms. hostapd permits this to be set between 15 and 65535. This option only has an effect on
Only supported by mac80211 (in trunk)
(hostapd/
Set the supported basic rates. Each basic_rate is measured in kb/s. This
driver
option only has an effect onap and adhoc wifi-ifaces.
default)
strin
require_m ode
g
Only supported by mac80211 (in trunk) (AP mode) Set the minimum mode that connecting c lients need to support
no
none
to be allowed to connect. Supported values: g = 802.11g, n = 802.11n, ac = 802.11ac
integ log_level
ap andadhoc wifi-ifaces.
er
no
Set the log_level. Supported levels are: 0 = verbose debugging, 1 =
2
debugging, 2 = informational messages, 3 = notification, 4 = warning
Broadcom Options
The options below are only used by the proprietary Broadcom driver (type broadcom).
Name
Type
Required
Default
Description
frameburst
boolean
no
0
Enables Broadcom frame bursting if supported
maxassoc
integer
no
(driver default)
Limits the maximum allowed number of associated clients
slottime
integer
no
(driver default)
Slot time in milliseconds
Madwifi Options
The following options are only used by the Madwifi driver (type atheros).
Name
Type
Required
Default
Description
softled
boolean
no
1
Enables software based LED control in the driver
outdoor
boolean
no
0
Enables outdoor channels in the 5GHz band
regdomain
number
no
(driver default)
Overrides the regulatory domain setting
Wifi Networks A complete wireless configuration contains at least one wifi-iface section per adapter to define a wireless network on top of the hardware. Some drivers support multiple wireless networks per device:
broadcom if the core revision is greater or equal 9 (see dmesg | grep corerev )
madwifi always supports multiple networks
mac80211 STA mode supported on trunk. STA and AP at the same time is not yet supported(r22989).
A minimal example for a wifi-iface declaration is given below.
config 'wifi-iface' option 'device'
'wl0'
option 'network'
'lan'
option 'mode'
'ap'
option 'ssid'
'MyWifiAP'
option 'encryption' 'psk2' option 'key'
'secret passphrase'
wl0 is the identifier for the underlying radio hardware
lan specifies the network interface the wifi is attached to
ap is the opetion mode, Access Point in this example
MyWifiAP is the broadcasted SSID
psk2 specifies the wireless encryption method, WPA2 PSK here
secret passphrase is the secret WPA passphrase
Common Options
The most common configuration option for wifi-iface sections are listed below.
Name
device
Type
string
Required
yes
Default
(first device id)
Description Specifies the used wireless adapter, must refer to one of the defined wifi-devicesections Selects the operation mode of the wireless network interface controller (some are supported simultaneously by some drivers): ap for
mode
string
yes
Access Point,
sta for ap
managed (client) mode,
adhoc for wds for
Ad-Hoc,
static WDS,
monitor for mesh for
monitor mode,
IEEE 802.11s mesh mode
mode only supported by mac80211 (in trunk)
mesh
disabled
boolean
no
1
When set to 1, wireless network is disabled. The broadcasted SSID of the wireless network (for
ssid
string
yes
OpenWrt
managed mode the SSID of the network you're connecting to)
BSSID bssid
address
Override the BSSID of the network, only no
(driver default)
applicable in adhoc or sta mode. In wds mode specifies the BSSID of another AP to create WDS
with. The Mesh ID as defined in IEEE 802.11s. If set, the wireless interface will join this mesh network mesh_id
Mesh ID
no
none
when brought up. If not, it is ne cessary to invokeiw mesh join to
join a mesh after the
interface is brought up.
Only supported by mac80211 (in trunk)
hidden
boolean
no
0
Turns off SSID broadcasting if set to 1 Isolate wireless clients from each other, only
isolate
boolean
no
0
applicable in ap mode. May not be supported in the original Backfire release for mac80211 Enables 802.11h support.
doth
boolean
no
0
wmm
boolean
no
1
network
string
yes
lan
Not supported for the mac80211 type yet Enables WMM (802.11e) support. Required for 802.11n support Specifies the network interface to attach the wireless to Wireless encryption method. none for an open network, wep for WEP, psk for WPA-PSK, or psk2 for WPA2-PSK. See the WPA modes table for additional possible values.
encryption
string
no
none
For an access point in WEP mode, the default is "open system" authentication. Use wep+shared for "shared key" authentication (less secure), wep+open to explicitly use "open system," or wep+mixed to allow either. wep+mixed is only supported by hostapd. In any WPA-PSK mode, this is a string that specifies the pre-shared passphrase from which the pre-shared key will be derived. If a 64-
key
integer or string
character hexadecimal string is supplied, it will be no
(none)
used directly as the pre-shared key instead. In WEP mode, this can be an integer specifying which key index to use ( key1 , key2,key3, or key4.) Alternatively, it can be a string specifying a passphrase or key directly, as in key1.
In any WPA-Enterprise AP mode, this option has a different interpretation. WEP passphrase or key #1 (selected by t he index in key). This string is treated as a passphrase from key1
string
no
(none)
which the WEP key will be derived. If a 10- or 26character hexadecimal string is supplied, it will be used directly as the WEP key instead.
key2
string
no
(none)
key3
string
no
(none)
key4
string
no
(none)
WEP passphrase or key #2 (selected by t he index in key), as in key1. WEP passphrase or key #3 (selected by t he index in key), as in key1. WEP passphrase or key #4 (selected by the index in key), as in key1. Specifies the mac filter policy , disable to disable
macfilter
string
no
the filter, allow to treat it as whitelist or deny to disable
treat it as blacklist.
Supported for the mac80211 since r25105
maclist
iapp_interface
list of MAC addresses
string
no
(none)
no
(none)
List of MAC addresses (divided by spaces) to put into the mac filter. Specifies a network interface to be used for 802.11f (IAPP) - only enabled when defined. Allow preauthentication for WPA2-EAP networks
rsn_preauth
boolean
no
0
(and advertise it in WLAN beacons). Only works if the specified network interface is a bridge. Enables MFP (802.11w) support (0 = disabled, 1 =
ieee80211w
integer
no
0
optional, 2 = required).
Only supported by the
ieee80211w_max_timeout
ieee80211w_retry_timeout
integer
integer
no
no
(hostapd default)
(hostapd default)
ath9k
driver (in trunk)
Specifies the 802.11w Association SA Query maximum timeout.
Only supported by the
ath9k
driver (in trunk)
Specifies the 802.11w Association SA Query re try timeout .
Only supported by the
integer
maxassoc
no
mac macaddr
no
address
ath9k
driver (in trunk)
(hostapd/driver
Specifies the maximum number of clients to
default)
connect.
(hostapd/driver
Overrides the MAC address used for t he wifi
default)
interface. Set the DTIM (delivery traffic information message) period. There will be one DTIM per this
integer
dtim_period
no
2 (hostapd
many beacon frames. This may be set between 1
default)
and 255. This option only has an effect on
ap wifi-
ifaces.
Only supported by mac80211 (in trunk)
boolean
short_preamble
no
Set optional use of short preamble
1
Supported for the mac80211 since r35565 Set the maximum allowed STA (client) listen interval. Association will be refused if a STA
integer
max_listen_int
no
65535 (hostapd
attempts to associate with a listen interval gre ater
default)
than this value. This option only has an effect on ap wifi-ifaces.
Only supported by mac80211 (in trunk) Sets the fixed multicast rate, measured in kb/s. integer
mcast_rate
no
(driver default)
Only supported by madwifi, and mac80211 (for type adhoc in trunk)
See the WPA tables below for a full listing of WPA related options used for WPA2 Enterprise (802.1x) See the WPS Options below for a full listing of Wi-Fi Protected Setup options. boolean
wds
no
0
This sets 4-address mode
Madwifi Options
The options in the table below only work with type atheros.
Name
Type
Required
Default
Description
ar
boolean
no
0
Enables AR support
bgscan
boolean
no
0
Enables background scanning
bursting
boolean
no
0
Enables frame bursting
compression
boolean
no
0
Enables hardware compression
ff
boolean
no
0
Enables fast frames
frag
integer
no
(none)
Fragmentation threshold
minrate
integer
no
maxrate
integer
no
nosbeacon
boolean
no
0
sw_merge
boolean
no
0
probereq
boolean
no
1
rate
integer
no
rts
integer
no
turbo
boolean
no
0
Enables turbo mode
uapsd
boolean
no
0
Enables Unscheduled Automatic Power Save Delivery (UAPSD)
wds
boolean
no
0
wdssep
boolean
no
0
Separates WDS clients from each other
xr
boolean
no
0
Enables XR support, only applicable in Managed mode
(driver default) (driver default)
(driver default) (driver default)
Limit the minimum rate used
Limit the maximum rate used
Disables the hardware beacon timer, only applicable in Managed mode Disables the hardware beacon timer, only applicable in IBSS mode Enables probe responses (AP will not appear in wifi scans if disabled)
Use a fixed rate
Override the RTS/CTS threshold
Enables Lazy-WDS, only applicable in Access Point or Managed mode