WiFi operation in AccesPoint mode along with maximum transmitter power in the bridge with ethenet cards.

For the implementation of the project was used a Qualcomm Atheros AR5418 WiFi card. It has the ability to operate at either 2.4GHz or 5GHz. But despite their attempts, they cannot act simultaneously. Since I can't use 5GHz, I use 2.4GHz, but the configuration is the same.

Code:
ath0@pci0:7:0:0:        class=0x028000 rev=0x01 hdr=0x00 vendor=0x168c device=0x0024 subvendor=0x106b subdevice=0x0087
    vendor     = 'Qualcomm Atheros'
    device     = 'AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn] (PCI-Express)'
    class      = network

As ethenet cards 'Intel Corporation 82576 Gigabit Network Connection having four independent network cards.

Code:
igb3@pci0:4:0:1:        class=0x020000 rev=0x01 hdr=0x00 vendor=0x8086 device=0x10e8 subvendor=0x8086 subdevice=0xa02c
    vendor     = 'Intel Corporation'
    device     = '82576 Gigabit Network Connection'
    class      = network
    subclass   = ethernet

1. Configuring the wifi card to work in AccesPoint mode.

In the /etc/rc.conf file the following lines should be set:
Code:
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap mode 11ng txpower 15 country JP channel 13"
hostapd_enable="YES"

But, in the file /etc/hostapd.conf
Code:
interface=wlan0
ssid=Mynetwork
wpa=2
wpa_passphrase=PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP

For an explanation each of the commands, referral to the handbook.

After reading the ifconfig manual

Four commands can be found:
Code:
ifconfig wlan0 list chan
ifconfig wlan0 list countries
ifconfig wlan0 list regdomain
ifconfig wlan0 list txpower

In general, There are eleven domain regulators in the world. (ROW KOREA APAC3 APAC2 APAC ETSI3 ETSI2 ETSI JAPAN FCC3 FCC)
Each two-letter country code is appended to one of the regulators. In each regulator, there are restrictions on transmitter power and channel availability.

Following the ready-made from wikipedia
https://en.wikipedia.org/wiki/List_of_WLAN_channels

I used the JP country code corresponding to Japan.

By specifying in /etc/rc.conf in line:
Code:
create_args_wlan0="wlanmode hostap mode 11ng txpower 15 country JP channel 13"

Country code of JP under command ifconfig wlan0 list regdomain can get: In the first line information about the region, then a list of channels of frequencies corresponding to them wifi mode and HT mode 20 or 40.

For an explanation of the IEEE standard referral to the wikipedia:

Quoting Huawei:
The channel bandwidth in HT20 mode is 20 MHz, and the channel bandwidth in HT40 mode is 40 MHz. Two neighboring 20 MHz channels are bundled to form a 40 MHz channel. One channel functions as the main channel, and the other as the auxiliary channel. The main channel sends Beacon packets and data packets, and the auxiliary channel sends other packets. When the HT40 mode is used in the 2.4 GHz frequency band, there is only one non-overlapping channel. Therefore, you are not advised to use the HT40 mode in the 2.4 GHz frequency band.

Two neighboring 20 MHz channels are bundled to form a 40 MHz channel. If the center frequency of the main 20 MHz channel is higher than that of the auxiliary channel, 40MHz-plus is displayed; otherwise, 40MHz-minus is displayed. For example, if the center frequency 149 and the center frequency 153 reside on two 20 MHz channels, 149plus indicates that the two 20 MHz channels are bundled to form a 40 MHz channel

Source:

Code:
:regdomain JAPAN country JP indoor ecm
Channel   1 : 2412      MHz 11b          Channel  10 : 2457      MHz 11b
Channel   1 : 2412      MHz 11g          Channel  10 : 2457      MHz 11g
Channel   1 : 2412      MHz 11g ht/20    Channel  10 : 2457      MHz 11g ht/20
Channel   1 : 2412      MHz 11g ht/40+   Channel  10 : 2457      MHz 11g ht/40-
Channel   2 : 2417      MHz 11b          Channel  11 : 2462      MHz 11b
Channel   2 : 2417      MHz 11g          Channel  11 : 2462      MHz 11g
Channel   2 : 2417      MHz 11g ht/20    Channel  11 : 2462      MHz 11g ht/20
Channel   2 : 2417      MHz 11g ht/40+   Channel  11 : 2462      MHz 11g ht/40-
Channel   3 : 2422      MHz 11b          Channel  12 : 2467      MHz 11b
Channel   3 : 2422      MHz 11g          Channel  12 : 2467      MHz 11g
Channel   3 : 2422      MHz 11g ht/20    Channel  12 : 2467      MHz 11g ht/20
Channel   3 : 2422      MHz 11g ht/40+   Channel  12 : 2467      MHz 11g ht/40-
Channel   4 : 2427      MHz 11b          Channel  13 : 2472      MHz 11b
Channel   4 : 2427      MHz 11g          Channel  13 : 2472      MHz 11g
Channel   4 : 2427      MHz 11g ht/20    Channel  13 : 2472      MHz 11g ht/20
Channel   4 : 2427      MHz 11g ht/40+   Channel  13 : 2472      MHz 11g ht/40-
Channel   5 : 2432      MHz 11b          Channel  14 : 2484      MHz 11b
Channel   5 : 2432      MHz 11g          Channel  36 : 5180      MHz 11a
Channel   5 : 2432      MHz 11g ht/20    Channel  36 : 5180      MHz 11a ht/20
Channel   5 : 2432      MHz 11g ht/40+   Channel  36 : 5180      MHz 11a ht/40+
Channel   5 : 2432      MHz 11g ht/40-   Channel  40 : 5200      MHz 11a
Channel   6 : 2437      MHz 11b          Channel  40 : 5200      MHz 11a ht/20
Channel   6 : 2437      MHz 11g          Channel  40 : 5200      MHz 11a ht/40-
Channel   6 : 2437      MHz 11g ht/20    Channel  44 : 5220      MHz 11a
Channel   6 : 2437      MHz 11g ht/40+   Channel  44 : 5220      MHz 11a ht/20
Channel   6 : 2437      MHz 11g ht/40-   Channel  44 : 5220      MHz 11a ht/40+
Channel   7 : 2442      MHz 11b          Channel  48 : 5240      MHz 11a
Channel   7 : 2442      MHz 11g          Channel  48 : 5240      MHz 11a ht/20
Channel   7 : 2442      MHz 11g ht/20    Channel  48 : 5240      MHz 11a ht/40-
Channel   7 : 2442      MHz 11g ht/40+   Channel  52 : 5260*D    MHz 11a
Channel   7 : 2442      MHz 11g ht/40-   Channel  52 : 5260*D    MHz 11a ht/20
Channel   8 : 2447      MHz 11b          Channel  52 : 5260*D    MHz 11a ht/40+
Channel   8 : 2447      MHz 11g          Channel  56 : 5280*D    MHz 11a
Channel   8 : 2447      MHz 11g ht/20    Channel  56 : 5280*D    MHz 11a ht/20
Channel   8 : 2447      MHz 11g ht/40+   Channel  56 : 5280*D    MHz 11a ht/40-
Channel   8 : 2447      MHz 11g ht/40-   Channel  60 : 5300*D    MHz 11a
Channel   9 : 2452      MHz 11b          Channel  60 : 5300*D    MHz 11a ht/20
Channel   9 : 2452      MHz 11g          Channel  60 : 5300*D    MHz 11a ht/40+
Channel   9 : 2452      MHz 11g ht/20    Channel  64 : 5320*D    MHz 11a
Channel   9 : 2452      MHz 11g ht/40+   Channel  64 : 5320*D    MHz 11a ht/20
Channel   9 : 2452      MHz 11g ht/40-   Channel  64 : 5320*D    MHz 11a ht/40-

However, ifconfig wlan0 list txpower shows the maximum transmitter power that can be used per channel. The maximum transmitter power for this code is 23dBm
Code:
root@router:~ # ifconfig wlan0 list txpower
Channel   1 : 2412 MHz 23.0 reg 23  Channel  12 : 2467 MHz 23.0 reg 23
Channel   2 : 2417 MHz 23.0 reg 23  Channel  13 : 2472 MHz 23.0 reg 23
Channel   3 : 2422 MHz 23.0 reg 23  Channel  14 : 2484 MHz 23.0 reg 23
Channel   4 : 2427 MHz 23.0 reg 23  Channel  36 : 5180 MHz 23.0 reg 23
Channel   5 : 2432 MHz 23.0 reg 23  Channel  40 : 5200 MHz 23.0 reg 23
Channel   6 : 2437 MHz 23.0 reg 23  Channel  44 : 5220 MHz 23.0 reg 23
Channel   7 : 2442 MHz 23.0 reg 23  Channel  48 : 5240 MHz 23.0 reg 23
Channel   8 : 2447 MHz 23.0 reg 23  Channel  52 : 5260 MHz 23.0 reg 23
Channel   9 : 2452 MHz 23.0 reg 23  Channel  56 : 5280 MHz 23.0 reg 23
Channel  10 : 2457 MHz 23.0 reg 23  Channel  60 : 5300 MHz 23.0 reg 23
Channel  11 : 2462 MHz 23.0 reg 23  Channel  64 : 5320 MHz 23.0 reg 23

Example for country code BR Brazil:
Code:
:regdomain FCC country BR indoor ecm
Channel   1 : 2412      MHz 11b          Channel   9 : 2452      MHz 11g
Channel   1 : 2412      MHz 11g          Channel   9 : 2452      MHz 11g ht/20
Channel   1 : 2412      MHz 11g ht/20    Channel   9 : 2452      MHz 11g ht/40-
Channel   1 : 2412      MHz 11g ht/40+   Channel  10 : 2457      MHz 11b
Channel   2 : 2417      MHz 11b          Channel  10 : 2457      MHz 11g
Channel   2 : 2417      MHz 11g          Channel  10 : 2457      MHz 11g ht/20
Channel   2 : 2417      MHz 11g ht/20    Channel  10 : 2457      MHz 11g ht/40-
Channel   2 : 2417      MHz 11g ht/40+   Channel  11 : 2462      MHz 11b
Channel   3 : 2422      MHz 11b          Channel  11 : 2462      MHz 11g
Channel   3 : 2422      MHz 11g          Channel  11 : 2462      MHz 11g ht/20
Channel   3 : 2422      MHz 11g ht/20    Channel  11 : 2462      MHz 11g ht/40-
Channel   3 : 2422      MHz 11g ht/40+   Channel  36 : 5180      MHz 11a
Channel   4 : 2427      MHz 11b          Channel  36 : 5180      MHz 11a ht/20
Channel   4 : 2427      MHz 11g          Channel  36 : 5180      MHz 11a ht/40+
Channel   4 : 2427      MHz 11g ht/20    Channel  40 : 5200      MHz 11a
Channel   4 : 2427      MHz 11g ht/40+   Channel  40 : 5200      MHz 11a ht/20
Channel   5 : 2432      MHz 11b          Channel  40 : 5200      MHz 11a ht/40-
Channel   5 : 2432      MHz 11g          Channel  44 : 5220      MHz 11a
Channel   5 : 2432      MHz 11g ht/20    Channel  44 : 5220      MHz 11a ht/20
Channel   5 : 2432      MHz 11g ht/40+   Channel  44 : 5220      MHz 11a ht/40+
Channel   5 : 2432      MHz 11g ht/40-   Channel  48 : 5240      MHz 11a
Channel   6 : 2437      MHz 11b          Channel  48 : 5240      MHz 11a ht/20
Channel   6 : 2437      MHz 11g          Channel  48 : 5240      MHz 11a ht/40-
Channel   6 : 2437      MHz 11g ht/20    Channel 149 : 5745      MHz 11a
Channel   6 : 2437      MHz 11g ht/40+   Channel 149 : 5745      MHz 11a ht/20
Channel   6 : 2437      MHz 11g ht/40-   Channel 149 : 5745      MHz 11a ht/40+
Channel   7 : 2442      MHz 11b          Channel 153 : 5765      MHz 11a
Channel   7 : 2442      MHz 11g          Channel 153 : 5765      MHz 11a ht/20
Channel   7 : 2442      MHz 11g ht/20    Channel 153 : 5765      MHz 11a ht/40-
Channel   7 : 2442      MHz 11g ht/40+   Channel 157 : 5785      MHz 11a
Channel   7 : 2442      MHz 11g ht/40-   Channel 157 : 5785      MHz 11a ht/20
Channel   8 : 2447      MHz 11b          Channel 157 : 5785      MHz 11a ht/40+
Channel   8 : 2447      MHz 11g          Channel 161 : 5805      MHz 11a
Channel   8 : 2447      MHz 11g ht/20    Channel 161 : 5805      MHz 11a ht/20
Channel   8 : 2447      MHz 11g ht/40-   Channel 161 : 5805      MHz 11a ht/40-
Channel   9 : 2452      MHz 11b          Channel 165 : 5825*     MHz 11a
root@router:~ # ifconfig wlan0 list txpower
Channel   1 : 2412 MHz 30.0 reg 30  Channel  11 : 2462 MHz 30.0 reg 30
Channel   2 : 2417 MHz 30.0 reg 30  Channel  36 : 5180 MHz 17.0 reg 17
Channel   3 : 2422 MHz 30.0 reg 30  Channel  40 : 5200 MHz 17.0 reg 17
Channel   4 : 2427 MHz 30.0 reg 30  Channel  44 : 5220 MHz 17.0 reg 17
Channel   5 : 2432 MHz 30.0 reg 30  Channel  48 : 5240 MHz 17.0 reg 17
Channel   6 : 2437 MHz 30.0 reg 30  Channel 149 : 5745 MHz 23.0 reg 23
Channel   7 : 2442 MHz 30.0 reg 30  Channel 153 : 5765 MHz 23.0 reg 23
Channel   8 : 2447 MHz 30.0 reg 30  Channel 157 : 5785 MHz 23.0 reg 23
Channel   9 : 2452 MHz 30.0 reg 30  Channel 161 : 5805 MHz 23.0 reg 23
Channel  10 : 2457 MHz 30.0 reg 30  Channel 165 : 5825 MHz 23.0 reg 23
root@router:~ #

Reading the manual page of ifconfig will notice that instead of the channel number, in the /etc/rc.conf file can enter the frequency from the ifconfig wlan0 list regdomain table, which allows you to define HT20 or HT40 if available. From then on, the following syntax is used. Setting txpower 15 in this line getting 15dBm transmitter power. Is possible to set a value from 0 to 23 for the JP code.

Code:
create_args_wlan0="wlanmode hostap mode 11ng txpower 15 country JP channel 2472:ht/40"

Code:
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:1e:52:72:e9:0b
        groups: wlan
        ssid SampleSSID channel 13 (2472 MHz 11g ht/40-) bssid 00:1e:52:72:e9:0b
        regdomain JAPAN country JP indoor ecm authmode WPA2/802.11i
        privacy MIXED deftxkey 2 AES-CCM 2:128-bit txpower 15 scanvalid 60
        protmode CTS ampdulimit 64k ampdudensity 8 shortgi -stbc -ldpc -uapsd
        wme burst dtimperiod 1 -dfs
        parent interface: ath0
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
        status: running
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

2. Increasing transmitter power:

The WiFi card I am using has a maximum transmitter power of 31dBm which corresponds to 1258.92mW = 1.26W. Quite a few. To use this is needed to edit the /etc/regdomain.xml file.
In this file should refer to regulator. In this example, JAPAN Since this controller gives access to all channels, the limitation is the power of the transmitter to 23dBm. Since the Countrycode and domain regulator are stored in the card's memory, it is not possible to do this otherwise.
Calc: https://www.rapidtables.com/convert/power/dBm_to_mW.html

On the file:
/etc/regdomain.xml

Is needed to modify the following block for the JAPAN regulator. Editing involves replacing the line:
Code:
<maxpower>23</maxpower>

On the largest that the card supports 30 in this case.
Code:
<maxpower>31</maxpower>

The entire regulator block is below.
Code:
<rd id="japan">
  <name>JAPAN</name>
  <sku>0x40</sku>
  <defcc ref="JP"/>
  <netband mode="11b">
    <band>
      <freqband ref="F1_2412_2472"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_B</flags>
    </band>
    <band>
      <freqband ref="F1_2484_2484"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_B</flags>
    </band>
  </netband>
  <netband mode="11g">
    <band>
      <freqband ref="F1_2412_2472"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_G</flags>
    </band>
  </netband>
  <netband mode="11a">
    <band>
      <freqband ref="F1_5180_5240"/>
      <maxpower>31</maxpower>
    </band>
    <band>
      <freqband ref="F1_5260_5320"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_PASSIVE</flags>
      <flags>IEEE80211_CHAN_DFS</flags>
    </band>
  </netband>
  <netband mode="11ng">
    <band>
      <freqband ref="F1_2412_2472"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_G</flags>
      <flags>IEEE80211_CHAN_HT20</flags>
    </band>
    <band>
      <freqband ref="H4_2412_2472"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_G</flags>
      <flags>IEEE80211_CHAN_HT40</flags>
    </band>
  </netband>
  <netband mode="11na">
    <band>
      <freqband ref="F1_5180_5240"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_HT20</flags>
    </band>
    <band>
      <freqband ref="H4_5180_5240"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_HT40</flags>
    </band>
    <band>
      <freqband ref="F1_5260_5320"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_HT20</flags>
      <flags>IEEE80211_CHAN_PASSIVE</flags>
      <flags>IEEE80211_CHAN_DFS</flags>
    </band>
    <band>
      <freqband ref="H4_5260_5320"/>
      <maxpower>31</maxpower>
      <flags>IEEE80211_CHAN_HT40</flags>
      <flags>IEEE80211_CHAN_PASSIVE</flags>
      <flags>IEEE80211_CHAN_DFS</flags>
    </band>
  </netband>
</rd>

The original regdomain.xml file can be found here:

At 5GHz it is different, theoretically up to 36dBm i.e. 4W, but my card does not support such power.

After this treatment command ifconfig wlan0 list txpower shows maximum txpower values at 31dBm
Code:
root@router:~ # ifconfig wlan0 list txpower
Channel   1 : 2412 MHz 31.0 reg 31  Channel  12 : 2467 MHz 31.0 reg 31
Channel   2 : 2417 MHz 31.0 reg 31  Channel  13 : 2472 MHz 31.0 reg 31
Channel   3 : 2422 MHz 31.0 reg 31  Channel  14 : 2484 MHz 31.0 reg 31
Channel   4 : 2427 MHz 31.0 reg 31  Channel  36 : 5180 MHz 31.0 reg 31
Channel   5 : 2432 MHz 31.0 reg 31  Channel  40 : 5200 MHz 31.0 reg 31
Channel   6 : 2437 MHz 31.0 reg 31  Channel  44 : 5220 MHz 31.0 reg 31
Channel   7 : 2442 MHz 31.0 reg 31  Channel  48 : 5240 MHz 31.0 reg 31
Channel   8 : 2447 MHz 31.0 reg 31  Channel  52 : 5260 MHz 31.0 reg 31
Channel   9 : 2452 MHz 31.0 reg 31  Channel  56 : 5280 MHz 31.0 reg 31
Channel  10 : 2457 MHz 31.0 reg 31  Channel  60 : 5300 MHz 31.0 reg 31
Channel  11 : 2462 MHz 31.0 reg 31  Channel  64 : 5320 MHz 31.0 reg 31

And this can be manipulated by an entry in /etc/rc.conf and so for txpower 31 in /etc/rc.conf, ifconfig wlan0 shows txpower at 31dBm. Should it work.
Code:
create_args_wlan0="wlanmode hostap mode 11ng txpower 31 country JP channel 2472:ht/40"

wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:1e:52:72:e9:0b
        groups: wlan
        ssid Mynetwork channel 13 (2472 MHz 11g ht/40-) bssid 00:1e:52:72:e9:0b
        regdomain JAPAN country JP indoor ecm authmode WPA2/802.11i
        privacy MIXED deftxkey 2 AES-CCM 2:128-bit txpower 31 scanvalid 60
        protmode CTS ampdulimit 64k ampdudensity 8 shortgi -stbc -ldpc -uapsd
        wme burst dtimperiod 1 -dfs
        parent interface: ath0
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
        status: running
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

3. Bridge mode:

To bridge network cards, add the following entry to /etc/rc.conf and set the address with alias.

Code:
cloned_interfaces="bridge0"
ifconfig_bridge0="addm igb3 addm igb2 addm igb1 addm igb0 addm wlan0"
ifconfig_bridge0_alias0="inet 10.10.1.1 netmask 255.255.255.0"
ifconfig_igb3="up"
ifconfig_igb2="up"
ifconfig_igb1="up"
ifconfig_igb0="up"
ifconfig_wlan0="up"

DHCPD set on the bridge (isc-dhcp package from repo):

Code:
dhcpd_enable="YES"
dhcpd_ifaces="bridge0"

Code:
root@router:~ # ee /usr/local/etc/dhcpd.conf


default-lease-time 3600;
max-lease-time 86400;
ddns-update-style none;

subnet 10.10.1.0 netmask 255.255.255.0 {
        option domain-name "router";
        option domain-name-servers 208.67.222.222;
        range 10.10.1.2 10.10.1.200;
        option routers 10.10.1.1;
}
 
Last edited:
AR5418 WiFi card
I am a little amazed that a miniPCI card still works. Ho-ray for Atheros.
I have several MikroTik AR5xxx modules that were more powerful than any miniPCIe cards today.
They have giant hulking heatsinks too.

So a 10+ year old Atheros card providing HostAP. Very nice.
 
Is wpa3 supported? I read here some information regarding it but I dont know if you need a wpa3 compatible card or not in order to implement such.
 
The card must support WPA3. This one does not. The operating system must also support it. You have to look for it.

In addition, there is an option to use SSL in the /etc/hostapd.conf file, but I do not know whether to encrypt the password or to encrypt the entire transmission.

 
WPA3 didn't hit Atheros until Wi-fi 6 / ax6 . Shown under 'notes'. We do not have support for these modules.

For Intel it looks like WPA3 hit on the 9xxx series.
 
Qualcomm Atheros AR5418 card does not have 1.2W TxPower because. I have a second router from the operator and I can only 100mW in the country. There is more coverage on the operator's router than on the router with the Atheros card.
 
Back
Top