You are on page 1of 9

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 different 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 disable automatic antenna selection:

root@OpenWrt:~# echo 0 > /proc/sys/dev/wifi0/diversity

Then select just Antenna 1:

root@OpenWrt:~# echo 1 > /proc/sys/dev/wifi0/rxantenna

You can check using athstats:

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

7247393 rx 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:~# echo 1 > /proc/sys/dev/wifi0/diversity

doesn't seem to work.

Audio 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. The 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 multiplewifi-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

Type

Requir
ed

Default

Description

type

strin
g

yes

(autodete
cted)

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

phy

strin
g

no/
yes

(autodete
cted)

Specifies the radio phy associated to this section. If present, it is usually


autodetected and should not be changed.

macaddr

MAC
addr
ess

yes/
no

(autodete
cted)

Specifies the radio adapter associated to this section, it is not used to change
the device mac but to identify the underlying interface.

disabled

bool
ean

no

Disables the radio adapter if set to 1. Removing this option or setting it


to 0 will enable the adapter

channel

integ
er or
"aut
o"

yes

auto

Specifies the wireless channel to use. "auto" defaults to the minimum


channel available

hwmode

strin
g

no

(driver
default)

Selects the wireless protocol to use, possible values are 11b, 11g, and 11a (note
that 11ng and 11naare not available options, see ticket 17541)

(driver
default)

Specifies the channel width in 802.11n and 802.11ac mode, possible values
are:
HT20 (single 20MHz channel),
HT40- (2x 20MHz channels, primary/control channel is upper, secondary
channel is below)
HT40+ (2x 20MHz channels, primary/control channel is lower, secondary

Name

htmode

strin
g

no

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

no

20

Specifies a narrow channel width, possible values are: 5 (5MHz


channel), 10 (10MHz channel) or 20(20MHz channel).
Only supported by the ath9k/ath5k driver (since Attitude Adjustment)

ht_capab

strin
g

no

(driver
default)

Specifies the available capabilities of the radio. The values are autodetected.
Seehttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.conf for
options (search for ht_capab in web page).
This option is only used for type mac80211

txpower

integ
er

no

(driver
default)

Specifies the transmission power in dBm

diversity

bool
ean

no

Enables or disables the automatic antenna selection by the driver

rxantenna

integ
er

no

(driver
default)

Specifies the antenna for receiving, the value may be driver specific, usually
it is 1 for the first and 2for the second antenna. Specifying 0 enables
automatic selection by the driver if supported. This option has no effect if
diversity is enabled

txantenna

integ
er

no

(driver
default)

Specifies the antenna for transmitting, values are identical to rxantenna

no

(driver
default)

Selects the antenna, possible values are vertical for internal vertical
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.

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.

no

1
if country is
set,
otherwise

Enables IEEE 802.11d country IE (information element) advertisement in


beacon and probe response frames. This IE contains the country code and
channel/power map. Requires country.

antenna

strin
g

country

varie
s

country_i
e

bool
ean

distance

integ
er

no

(driver
default)

Distance between the ap and the furthest client in meters .


Only supported by madwifi, and the mac80211 type (in trunk)

noscan

bool
ean

no

Do not scan for overlapping BSSs in HT40+/- mode.


Only supported by mac80211
Turning this on will violate regulatory requirements!

no

100
(hostapd
default)

Set the beacon interval. This is the time interval between beacon frames,
measured in units of 1.024 ms. hostapd permits this to be set between 15
and 65535. This option only has an effect on ap andadhoc wifi-ifaces.
Only supported by mac80211 (in trunk)

no

(hostapd/
driver
default)

Set the supported basic rates. Each basic_rate is measured in kb/s. This
option only has an effect onap and adhoc wifi-ifaces.
Only supported by mac80211 (in trunk)

beacon_in
terval

integ
er

basic_rat
e

list

require_m
ode

strin
g

no

none

(AP mode) Set the minimum mode that connecting clients need to support
to be allowed to connect. Supported values: g = 802.11g, n = 802.11n, ac =
802.11ac

log_level

integ
er

no

Set the log_level. Supported levels are: 0 = verbose debugging, 1 =


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

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

Enables software based LED control in the driver

outdoor

boolean

no

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

Description

(first device id)

Specifies the used wireless adapter, must refer to


one of the defined wifi-devicesections

mode

string

yes

ap

Selects the operation mode of the wireless


network interface controller (some are supported
simultaneously by some drivers):
ap for Access Point,
sta for managed (client) mode,
adhoc for Ad-Hoc,
wds for static WDS,
monitor for monitor mode,
mesh for IEEE 802.11s mesh mode
mesh mode only supported by mac80211 (in trunk)

disabled

boolean

no

When set to 1, wireless network is disabled.


The broadcasted SSID of the wireless network (for
managed mode the SSID of the network you're
connecting to)

ssid

string

yes

OpenWrt

bssid

BSSID
address

no

(driver default)

Override the BSSID of the network, only


applicable in adhoc or sta mode. In wds mode
specifies the BSSID of another AP to create WDS

with.

mesh_id

Mesh ID

no

none

The Mesh ID as defined in IEEE 802.11s. If set, the


wireless interface will join this mesh network
when brought up. If not, it is necessary to invokeiw
<iface> mesh join <mesh_id> to join a mesh after the
interface is brought up.
Only supported by mac80211 (in trunk)

hidden

boolean

no

Turns off SSID broadcasting if set to 1

isolate

boolean

no

Isolate wireless clients from each other, only


applicable in ap mode. May not be supported in
the original Backfire release for mac80211

doth

boolean

no

Enables 802.11h support.


Not supported for the mac80211 type yet

wmm

boolean

no

Enables WMM (802.11e) support. Required for


802.11n support

network

string

yes

lan

Specifies the network interface to attach the


wireless to

none

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.
For an access point in WEP mode, the default is
"open system" authentication. Usewep+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.

encryption

key

string

integer or
string

no

no

(none)

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 64character hexadecimal string is supplied, it will be
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.

key1

string

no

(none)

WEP passphrase or key #1 (selected by the index


in key). This string is treated as a passphrase from
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)

WEP passphrase or key #2 (selected by the index


in key), as in key1.

key3

string

no

(none)

WEP passphrase or key #3 (selected by the index


in key), as in key1.

key4

string

no

(none)

WEP passphrase or key #4 (selected by the index


in key), as in key1.

macfilter

string

no

disable

Specifies the mac filter policy, disable to disable


the filter, allow to treat it as whitelist or deny to
treat it as blacklist.
Supported for the mac80211 since r25105

maclist

list of MAC
addresses

no

(none)

List of MAC addresses (divided by spaces) to put


into the mac filter.

iapp_interface

string

no

(none)

Specifies a network interface to be used for


802.11f (IAPP) - only enabled when defined.

Allow preauthentication for WPA2-EAP networks


(and advertise it in WLAN beacons). Only works if
the specified network interface is a bridge.

no

Enables MFP (802.11w) support (0 = disabled, 1 =


optional, 2 = required).
Only supported by the 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 retry
timeout .

rsn_preauth

ieee80211w

boolean

integer

no

ieee80211w_max_timeout

integer

no

(hostapd
default)

ieee80211w_retry_timeout

integer

no

(hostapd
default)

Only supported by the ath9k driver (in trunk)

maxassoc

integer

no

(hostapd/driver
default)

Specifies the maximum number of clients to


connect.

macaddr

mac
address

no

(hostapd/driver
default)

Overrides the MAC address used for the wifi


interface.

dtim_period

integer

no

2 (hostapd
default)

Set the DTIM (delivery traffic information


message) period. There will be one DTIM per this
many beacon frames. This may be set between 1
and 255. This option only has an effect on ap wifiifaces.
Only supported by mac80211 (in trunk)

short_preamble

boolean

no

Set optional use of short preamble


Supported for the mac80211 since r35565

65535 (hostapd
default)

Set the maximum allowed STA (client) listen


interval. Association will be refused if a STA
attempts to associate with a listen interval greater
than this value. This option only has an effect
on ap wifi-ifaces.
Only supported by mac80211 (in trunk)

(driver default)

Sets the fixed multicast rate, measured in kb/s.


Only supported by madwifi, and mac80211 (for
type adhoc in trunk)

integer

max_listen_int

no

integer

mcast_rate

no

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

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

Enables AR support

bgscan

boolean

no

Enables background scanning

bursting

boolean

no

Enables frame bursting

compression

boolean

no

Enables hardware compression

ff

boolean

no

Enables fast frames

frag

integer

no

(none)

Fragmentation threshold

minrate

integer

no

(driver
default)

Limit the minimum rate used

maxrate

integer

no

(driver
default)

Limit the maximum rate used

nosbeacon

boolean

no

Disables the hardware beacon timer, only applicable in Managed


mode

sw_merge

boolean

no

Disables the hardware beacon timer, only applicable in IBSS mode

probereq

boolean

no

Enables probe responses (AP will not appear in wifi scans if


disabled)

rate

integer

no

(driver
default)

Use a fixed rate

rts

integer

no

(driver
default)

Override the RTS/CTS threshold

turbo

boolean

no

Enables turbo mode

uapsd

boolean

no

Enables Unscheduled Automatic Power Save Delivery (UAPSD)

wds

boolean

no

Enables Lazy-WDS, only applicable in Access Point or Managed


mode

wdssep

boolean

no

Separates WDS clients from each other

xr

boolean

no

Enables XR support, only applicable in Managed mode

You might also like