Openwrt Testing Antennas and Disabling Diversity Antenna 2

Embed Size (px)

DESCRIPTION

Openwrt Testing Antennas and Disabling Diversity Antenna 2

Citation preview

  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    1/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 ante

    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 jus

    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 w

    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 anten

    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:~# 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.

    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 ,

  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    2/9

    Wifi Devices

    The wifi-devicerefer 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-devicesection

    each referring to a different adapter.

    A minimal wifi-devicedeclaration 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'

    wl0is the internal identifierfor the wireless adapter

    broadcomspecifies the chipset/driver type

    6is the wireless channelthe device operates onThe 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 Opt ions

    Name TypeRequir

    edDefault Description

    typestrin

    gyes

    (autodete

    cted)

    The typeis determined on firstboot during the initial radio device detection

    it is usually not required to change it. Used values are broadcomon brcm47xx,

    or mac80211for b43, ath5k and ath9k

    phystrin

    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 notused to chang

    the device mac but to identify the underlying interface.

    disabledbool

    eanno 0

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

    to 0will enable the adapter

    channel

    integ

    er or

    "aut

    o"

    yes autoSpecifies the wireless channel to use. "auto" defaults to the minimum

    channel available

    hwmodestrin

    gno

    (driver

    default)

    Selects the wireless protocol to use, possible values are 11b, 11g, and 11a(not

    that 11ngand 11naare not available options, seeticket 17541)

    htmodestrin

    gno

    (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

    https://dev.openwrt.org/ticket/17541https://dev.openwrt.org/ticket/17541https://dev.openwrt.org/ticket/17541https://dev.openwrt.org/ticket/17541
  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    3/9

    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.11andhttp://hostap.epitest.fi/cgit/h

    tap/tree/hostapd/hostapd.conf(search for HT40) in the web page.

    This option is only used for type mac80211

    chanbwinteg

    erno 20

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

    channel), 10(10MHz channel) or 20(20MHz channel).

    Only supported by the ath9k/ath5kdriver (since Attitude Adjustment)

    ht_capabstrin

    gno

    (driver

    default)

    Specifies the available capabilities of the radio. The values are autodetecte

    Seehttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.conffor

    options (search for ht_capab in web page).

    This option is only used for type mac80211

    txpower integer

    no (driverdefault)

    Specifies the transmission power in dBm

    diversitybool

    eanno 1 Enables or disables the automatic antenna selection by the driver

    rxantennainteg

    erno

    (driver

    default)

    Specifies the antenna for receiving, the value may be driver specific, usually

    it is 1for the first and 2for the second antenna. Specifying 0enables

    automatic selection by the driver if supported. This option has no effect if

    diversity is enabled

    txantennainteg

    erno

    (driver

    default)Specifies the antenna for transmitting, values are identical to rxantenna

    antennastrin

    gno

    (driver

    default)

    Selects the antenna, possible values are verticalfor internal vertical

    polarization, horizontalfor internal horizontal polarization or externalto use

    the external antenna connector

    Only used on theUbiquiti NanoStationdevice family instead of the

    rxantenna/txantenna settings.

    countryvarie

    sno

    (driver

    default)

    Specifies the country code, affects the available channels and transmission

    powers. For typebroadcoma two letter country code is used (ENor DE).

    The madwifidriver expects a numeric code.

    country_i

    ebool

    eanno

    1

    if countryis

    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.

    http://wiki.openwrt.org/doc/faq/faq.wireless#why.can.t.i.use.ht40.with.channel.11http://wiki.openwrt.org/doc/faq/faq.wireless#why.can.t.i.use.ht40.with.channel.11http://wiki.openwrt.org/doc/faq/faq.wireless#why.can.t.i.use.ht40.with.channel.11http://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://wiki.openwrt.org/toh/ubiquiti/nanostationhttp://wiki.openwrt.org/toh/ubiquiti/nanostationhttp://wiki.openwrt.org/toh/ubiquiti/nanostationhttp://wiki.openwrt.org/toh/ubiquiti/nanostationhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://hostap.epitest.fi/cgit/hostap/tree/hostapd/hostapd.confhttp://wiki.openwrt.org/doc/faq/faq.wireless#why.can.t.i.use.ht40.with.channel.11
  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    4/9

    0

    distanceinteg

    erno

    (driver

    default)

    Distance between the ap and the furthest client in meters .

    Only supported by madwifi, and the mac80211type (in trunk)

    noscanbool

    eanno 0

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

    Only supported by mac80211

    Turning this on will violate regulatory requirements!

    beacon_in

    tervalinteg

    erno

    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 apandadhocwifi-ifaces.

    Only supported by mac80211(in trunk)

    basic_rat

    e list no

    (hostapd/

    driver

    default)

    Set the supported basic rates. Each basic_rate is measured in kb/s. This

    option only has an effect onapand adhocwifi-ifaces.

    Only supported by mac80211(in trunk)

    require_m

    odestrin

    gno 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_levelinteg

    erno 2

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

    debugging, 2 = informational messages, 3 = notification, 4 = warning

    Broadcom Opt ions

    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

    Madwif i 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

  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    5/9

    Wifi NetworksA complete wireless configuration contains at least one wifi-ifacesection per adapter to define a wireless network on top of the hardware. Some drivers support multiple wireless

    networks per device:

    broadcomif the core revision is greater or equal 9(see dmesg | grep corerev)

    madwifialways supports multiple networks

    mac80211STA mode supported on trunk. STA and AP at the same time is not yet supported(r22989).A minimal example for a wifi-ifacedeclaration 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'

    wl0is the identifier for the underlyingradio hardware

    lanspecifies thenetwork interfacethe wifi is attached to

    apis the opetion mode,Access Pointin this example

    MyWifiAPis the broadcasted SSID

    psk2specifies the wireless encryption method, WPA2 PSK here

    secret passphraseis the secret WPA passphraseCommon Opt ions

    The most common configuration option for wifi-ifacesections are listed below.

    Name Type Required Default Description

    device string yes (first device id)Specifies the used wireless adapter, must refer t

    one of the defined wifi-devicesections

    mode string yes ap

    Selects theoperation modeof the wireless

    network interface controller (some are supportesimultaneously by some drivers):

    apfor Access Point,

    stafor managed (client) mode,

    adhocfor Ad-Hoc,

    wdsfor static WDS,

    monitorfor monitor mode,

    meshforIEEE 802.11smesh mode

    meshmode only supported by mac80211(in trun

    disabled boolean no 1 When set to 1, wireless network is disabled.

    ssid string yes OpenWrt

    The broadcasted SSID of the wireless network (f

    managed mode the SSID of the network you're

    connecting to)

    bssidBSSID

    addressno (driver default)

    Override the BSSID of the network, only

    applicable in adhocor stamode. In wdsmode

    specifies the BSSID of another AP to create WDS

    http://wiki.openwrt.org/doc/uci/wireless#wifi.deviceshttp://wiki.openwrt.org/doc/uci/wireless#wifi.deviceshttp://wiki.openwrt.org/doc/uci/wireless#wifi.deviceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wireless.kernel.org/en/users/Documentation/modeshttp://wireless.kernel.org/en/users/Documentation/modeshttp://wireless.kernel.org/en/users/Documentation/modeshttp://en.wikipedia.org/wiki/IEEE%20802.11shttp://en.wikipedia.org/wiki/IEEE%20802.11shttp://en.wikipedia.org/wiki/IEEE%20802.11shttp://en.wikipedia.org/wiki/IEEE%20802.11shttp://wireless.kernel.org/en/users/Documentation/modeshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/wireless#wifi.devices
  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    6/9

    with.

    mesh_id Mesh ID no none

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

    wireless interface will join this mesh network

    when brought up. If not, it is necessary to invoke

    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 boolean no 0

    Isolate wireless clients from each other, only

    applicable in apmode. May not be supported in

    the original Backfire release for mac80211

    doth boolean no 0Enables 802.11h support.

    Not supported for the mac80211type yet

    wmm boolean no 1Enables WMM (802.11e) support. Required for

    802.11n support

    network string yes lanSpecifies thenetwork interfaceto attach the

    wireless to

    encryption string no none

    Wireless encryption method. nonefor an open

    network, wepfor WEP, pskfor WPA-PSK, or psk2foWPA2-PSK. See theWPA modestable for

    additional possible values.

    For an access point in WEPmode, the default is

    "open system" authentication. Usewep+sharedfor

    "shared key" authentication (less

    secure), wep+opento explicitly use "open system,"

    or wep+mixedto allow either. wep+mixedis only

    supported by hostapd.

    keyinteger or

    stringno (none)

    In any WPA-PSKmode, this is a string thatspecifies the pre-shared passphrase from which

    the pre-shared key will be derived. If a 64-

    character hexadecimal string is supplied, it will b

    used directly as the pre-shared key instead.

    In WEPmode, 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.

    http://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/network#interfaces
  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    7/9

    In anyWPA-Enterprise APmode, this option has

    different interpretation.

    key1 string no (none)

    WEP passphrase or key #1 (selected by the inde

    in key). This string is treated as a passphrase from

    which the WEP key will be derived. If a 10- or 26

    character hexadecimal string is supplied, it will b

    used directly as the WEP key instead.

    key2 string no (none)WEP passphrase or key #2 (selected by the inde

    in key), as in key1.

    key3 string no (none)WEP passphrase or key #3 (selected by the inde

    in key), as in key1.

    key4 string no (none)WEP passphrase or key #4 (selected by the inde

    in key), as in key1.

    macfilter string no disable

    Specifies the mac filter policy, disableto disable

    the filter, allowto treat it as whitelist or denyto

    treat it as blacklist.

    Supported for the mac80211sincer25105

    maclistlist of MAC

    addressesno (none)

    List of MAC addresses (divided by spaces) to put

    into the mac filter.

    iapp_interface string no (none)Specifies anetwork interfaceto be used for

    802.11f (IAPP) - only enabled when defined.

    rsn_preauth boolean no 0

    Allow preauthentication for WPA2-EAP network

    (and advertise it in WLAN beacons). Only works

    the specified network interface is a bridge.

    ieee80211w integer no 0

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

    optional, 2 = required).

    Only supported by the ath9kdriver (in trunk)

    ieee80211w_max_timeout integer no(hostapd

    default)

    Specifies the 802.11w Association SA Query

    maximum timeout.

    Only supported by the ath9kdriver (in trunk)

    ieee80211w_retry_timeout integer no(hostapd

    default)Specifies the 802.11w Association SA Query retr

    timeout .

    http://wiki.openwrt.org/doc/uci/wireless#wpa.enterprise.access.pointhttp://wiki.openwrt.org/doc/uci/wireless#wpa.enterprise.access.pointhttp://wiki.openwrt.org/doc/uci/wireless#wpa.enterprise.access.pointhttps://dev.openwrt.org/changeset/25105/trunkhttps://dev.openwrt.org/changeset/25105/trunkhttps://dev.openwrt.org/changeset/25105/trunkhttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttp://wiki.openwrt.org/doc/uci/network#interfaceshttps://dev.openwrt.org/changeset/25105/trunkhttp://wiki.openwrt.org/doc/uci/wireless#wpa.enterprise.access.point
  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    8/9

    Only supported by the ath9kdriver (in trunk)

    maxassoc integer no(hostapd/driver

    default)

    Specifies the maximum number of clients to

    connect.

    macaddrmac

    addressno

    (hostapd/driver

    default)

    Overrides the MAC address used for the wifi

    interface.

    dtim_period integer no2 (hostapd

    default)

    Set the DTIM (delivery traffic information

    message) period. There will be one DTIM per th

    many beacon frames. This may be set between 1

    and 255. This option only has an effect on apwif

    ifaces.

    Only supported by mac80211(in trunk)

    short_preamble boolean no 1Set optional use of short preamble

    Supported for the mac80211sincer35565

    max_listen_int integer no65535 (hostapd

    default)

    Set the maximum allowed STA (client) listen

    interval. Association will be refused if a STA

    attempts to associate with a listen interval great

    than this value. This option only has an effect

    on apwifi-ifaces.

    Only supported by mac80211(in trunk)

    mcast_rate integer no (driver default)

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

    Only supported by madwifi, and mac80211(for

    type adhocin trunk)

    See theWPA tablesbelow for a full listing of WPA related options used for WPA2 Enterprise (802.1x)

    See theWPS Optionsbelow for a full listing of Wi-Fi Protected Setupoptions.

    wds boolean no 0 This sets4-address mode

    Madwif i 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

    https://dev.openwrt.org/changeset/35565/trunkhttps://dev.openwrt.org/changeset/35565/trunkhttps://dev.openwrt.org/changeset/35565/trunkhttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttp://wiki.openwrt.org/doc/uci/wireless#wps.optionshttp://wiki.openwrt.org/doc/uci/wireless#wps.optionshttp://wiki.openwrt.org/doc/uci/wireless#wps.optionshttp://wireless.kernel.org/en/users/Documentation/iw#Using_4-address_for_AP_and_client_modehttp://wireless.kernel.org/en/users/Documentation/iw#Using_4-address_for_AP_and_client_modehttp://wireless.kernel.org/en/users/Documentation/iw#Using_4-address_for_AP_and_client_modehttp://wireless.kernel.org/en/users/Documentation/iw#Using_4-address_for_AP_and_client_modehttp://wiki.openwrt.org/doc/uci/wireless#wps.optionshttp://wiki.openwrt.org/doc/uci/wireless#wpa.modeshttps://dev.openwrt.org/changeset/35565/trunk
  • 5/19/2018 Openwrt Testing Antennas and Disabling Diversity Antenna 2

    9/9

    bursting boolean no 0 Enables frame bursting

    compression boolean no 0 Enables hardware compression

    ff boolean no 0 Enables fast frames

    fraginteger 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 0Disables the hardware beacon timer, only applicable in Managed

    mode

    sw_merge boolean no 0 Disables the hardware beacon timer, only applicable in IBSS mod

    probereq boolean no 1Enables probe responses (AP will not appear in wifi scans if

    disabled)

    rate integer no(driver

    default)Use a fixed rate

    rts integer no (driverdefault)

    Override the RTS/CTS threshold

    turbo boolean no 0 Enables turbo mode

    uapsd boolean no 0 Enables Unscheduled Automatic Power Save Delivery (UAPSD)

    wds boolean no 0Enables Lazy-WDS, only applicable in Access Point or Managed

    mode

    wdssep boolean no 0 Separates WDS clients from each other

    xr boolean no 0 Enables XR support, only applicable in Managed mode