ODROID
mad_ady Posts: 11481 Joined: Wed Jul 15, 2015 5:00 pm languages_spoken: english ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, N2L, H2, H3+, Go, Go Advance, M1 Location: Bucharest, Romania Has thanked: 648 times Been thanked: 1124 times Contact:
Dual band access points with Linux
Post by mad_ady » Thu Apr 29, 2021 6:17 pm
I’m trying to set up an Odroid C2 (Ubuntu 20) as a wifi hotspot with two WIFI card 4 (which are dual-band). One card should handle 2.4GHz traffic, while the other should handle 5GHz. As far as I know you can’t use only one dual-band card to set up two access points on different bands (or it may depend on the radio chipset used). So, you’ll need two physical wifi cards. One is connected to the 4 port USB bus (together with a BT adapter, a printer and a USB sound card), while the other is connected to the OTG port. Yes, I’m working my C2 hard
The configuration file is created with something like this:
create_ap --mkconfig /etc/create_ap_5.conf -m nat wlan1 eth0 MySSID "MyLongAndComplicatedPSK"
IEEE80211N=1 IEEE80211AC=1 FREQ_BAND=5
For the 2.4Ghz I created a different config file and a similar startup script. Here is my 5GHz configuration as an example:
CHANNEL=default GATEWAY=192.168.12.1 WPA_VERSION=2 ETC_HOSTS=0 DHCP_DNS=192.168.1.5 NO_DNS=0 NO_DNSMASQ=0 HIDDEN=0 MAC_FILTER=0 MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept ISOLATE_CLIENTS=0 SHARE_METHOD=nat IEEE80211N=1 IEEE80211AC=1 HT_CAPAB=[HT40+] VHT_CAPAB= DRIVER=nl80211 NO_VIRT=0 COUNTRY= FREQ_BAND=5 NEW_MACADDR= DAEMONIZE=0 DAEMON_PIDFILE= DAEMON_LOGFILE=/dev/null NO_HAVEGED=0 WIFI_IFACE=wlan1 INTERNET_IFACE=eth0 SSID=MySSID PASSPHRASE=MyLongAndComplicatedPSK USE_PSK=0
and if using NAT, make sure you set a different GATEWAY (like 192.168.11.1).
Here are some problems I ran into and their solutions.
In case create_ap complains when starting that.
Apr 29 09:45:59 spica-c2 systemd[1]: Started Create AP Service 5GHz. Apr 29 09:45:59 spica-c2 create_ap[1375696]: WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Apr 29 09:46:00 spica-c2 create_ap[1375696]: Config dir: /tmp/create_ap.wlan1.conf.GXW48lp6 Apr 29 09:46:00 spica-c2 create_ap[1375696]: PID: 1375696 Apr 29 09:46:00 spica-c2 create_ap[1375696]: ERROR: Your adapter can not transmit to channel 36, frequency band 5GHz. Apr 29 09:46:00 spica-c2 create_ap[1375696]: Doing cleanup.. done Apr 29 09:46:00 spica-c2 systemd[1]: create_ap_5.service: Main process exited, code=exited, status=1/FAILURE Apr 29 09:46:00 spica-c2 systemd[1]: create_ap_5.service: Failed with result 'exit-code'.
# iw list . Band 2: Capabilities: 0x2f2 HT20/HT40 Static SM Power Save RX Greenfield RX HT20 SGI RX HT40 SGI TX STBC RX STBC 2-streams Max AMSDU length: 3839 bytes No DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 2 usec (0x04) HT RX MCS rate indexes supported: 0-15, 32 TX unequal modulation not supported HT TX Max spatial streams: 2 HT TX MCS rate indexes supported may differ Bitrates (non-HT): * 6.0 Mbps * 9.0 Mbps * 12.0 Mbps * 18.0 Mbps * 24.0 Mbps * 36.0 Mbps * 48.0 Mbps * 54.0 Mbps Frequencies: * 5180 MHz [36] (20.0 dBm) (no IR) * 5190 MHz [38] (20.0 dBm) (no IR) * 5200 MHz [40] (20.0 dBm) (no IR) * 5210 MHz [42] (20.0 dBm) (no IR) * 5220 MHz [44] (20.0 dBm) (no IR) * 5230 MHz [46] (20.0 dBm) (no IR) * 5240 MHz [48] (20.0 dBm) (no IR) * 5250 MHz [50] (disabled) * 5260 MHz [52] (20.0 dBm) (no IR, radar detection) * 5270 MHz [54] (20.0 dBm) (no IR, radar detection) * 5280 MHz [56] (20.0 dBm) (no IR, radar detection) * 5290 MHz [58] (20.0 dBm) (no IR, radar detection) * 5300 MHz [60] (20.0 dBm) (no IR, radar detection) * 5310 MHz [62] (20.0 dBm) (no IR, radar detection) .
no IR means you’re not allowed to transmit and it’s likely due to regulatory limits in your country. However, it’s most likely the country setting is not applied. You can check with:
# iw reg get global country 00: DFS-UNSET (2402 - 2472 @ 40), (N/A, 20), (N/A) (2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, NO-IR (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, NO-IR (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, NO-IR (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, NO-IR (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, NO-IR (5735 - 5835 @ 80), (N/A, 20), (N/A), NO-IR (57240 - 63720 @ 2160), (N/A, 0), (N/A)
# iw reg set RO # iw reg get global country RO: DFS-ETSI (2400 - 2483 @ 40), (N/A, 20), (N/A) (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS (5725 - 5875 @ 80), (N/A, 13), (N/A) (57000 - 66000 @ 2160), (N/A, 40), (N/A)
# iw list . Band 2: Capabilities: 0x2f2 HT20/HT40 Static SM Power Save RX Greenfield RX HT20 SGI RX HT40 SGI TX STBC RX STBC 2-streams Max AMSDU length: 3839 bytes No DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 2 usec (0x04) HT RX MCS rate indexes supported: 0-15, 32 TX unequal modulation not supported HT TX Max spatial streams: 2 HT TX MCS rate indexes supported may differ Bitrates (non-HT): * 6.0 Mbps * 9.0 Mbps * 12.0 Mbps * 18.0 Mbps * 24.0 Mbps * 36.0 Mbps * 48.0 Mbps * 54.0 Mbps Frequencies: * 5180 MHz [36] (23.0 dBm) * 5190 MHz [38] (23.0 dBm) * 5200 MHz [40] (23.0 dBm) * 5210 MHz [42] (23.0 dBm) * 5220 MHz [44] (23.0 dBm) * 5230 MHz [46] (23.0 dBm) * 5240 MHz [48] (23.0 dBm) * 5250 MHz [50] (disabled) * 5260 MHz [52] (20.0 dBm) (radar detection) * 5270 MHz [54] (20.0 dBm) (radar detection) * 5280 MHz [56] (20.0 dBm) (radar detection) * 5290 MHz [58] (20.0 dBm) (radar detection) * 5300 MHz [60] (20.0 dBm) (radar detection) * 5310 MHz [62] (20.0 dBm) (radar detection) * 5320 MHz [64] (20.0 dBm) (radar detection) .
Apr 29 09:53:35 spica-c2 systemd[1]: Started Create AP Service 5GHz. Apr 29 09:53:35 spica-c2 create_ap[1396623]: WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Apr 29 09:53:35 spica-c2 create_ap[1396623]: Config dir: /tmp/create_ap.wlan1.conf.pyuGe0hz Apr 29 09:53:35 spica-c2 create_ap[1396623]: PID: 1396623 Apr 29 09:53:38 spica-c2 create_ap[1396623]: Network Manager found, set wlan1 as unmanaged device. DONE Apr 29 09:53:38 spica-c2 create_ap[1396871]: RTNETLINK answers: Operation not possible due to RF-kill Apr 29 09:53:38 spica-c2 create_ap[1396623]: Doing cleanup.. done Apr 29 09:53:38 spica-c2 systemd[1]: create_ap_5.service: Main process exited, code=exited, status=1/FAILURE
# rfkill list all 0: hci0: Bluetooth Soft blocked: no Hard blocked: no 1: phy0: Wireless LAN Soft blocked: yes Hard blocked: no 2: phy1: Wireless LAN Soft blocked: yes Hard blocked: no # rfkill unblock all # rfkill list all 0: hci0: Bluetooth Soft blocked: no Hard blocked: no 1: phy0: Wireless LAN Soft blocked: no Hard blocked: no 2: phy1: Wireless LAN Soft blocked: no Hard blocked: no
Apr 29 11:43:08 spica-c2 systemd[1]: Started Create AP Service 5GHz. Apr 29 11:43:08 spica-c2 create_ap[1575330]: WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Apr 29 11:43:08 spica-c2 create_ap[1575330]: Config dir: /tmp/create_ap.wlan1.conf.suYW8zid Apr 29 11:43:08 spica-c2 create_ap[1575330]: PID: 1575330 Apr 29 11:43:11 spica-c2 create_ap[1575330]: Network Manager found, set wlan1 as unmanaged device. DONE Apr 29 11:43:11 spica-c2 create_ap[1575330]: Sharing Internet using method: bridge Apr 29 11:43:11 spica-c2 create_ap[1575330]: hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan1.conf.suYW8zid/hostapd_ctrl Apr 29 11:43:11 spica-c2 create_ap[1575570]: Configuration file: /tmp/create_ap.wlan1.conf.suYW8zid/hostapd.conf Apr 29 11:43:11 spica-c2 create_ap[1575570]: nl80211: Failed to add interface wlan1 into bridge br0: Unknown error 524 Apr 29 11:43:11 spica-c2 create_ap[1575570]: nl80211: deinit ifname=wlan1 disabled_11b_rates=0 Apr 29 11:43:11 spica-c2 create_ap[1575570]: nl80211 driver initialization failed. Apr 29 11:43:11 spica-c2 create_ap[1575570]: wlan1: interface state UNINITIALIZED->DISABLED Apr 29 11:43:11 spica-c2 create_ap[1575570]: wlan1: AP-DISABLED Apr 29 11:43:11 spica-c2 create_ap[1575570]: wlan1: CTRL-EVENT-TERMINATING Apr 29 11:43:11 spica-c2 create_ap[1575570]: hostapd_free_hapd_data: Interface wlan1 wasn't started Apr 29 11:43:11 spica-c2 create_ap[1575330]: Error: Failed to run hostapd, maybe a program is interfering. Apr 29 11:43:12 spica-c2 create_ap[1575330]: If an error like 'n80211: Could not configure driver mode' was thrown Apr 29 11:43:12 spica-c2 create_ap[1575330]: try running the following before starting create_ap: Apr 29 11:43:12 spica-c2 create_ap[1575330]: nmcli r wifi off Apr 29 11:43:12 spica-c2 create_ap[1575330]: rfkill unblock wlan Apr 29 11:43:12 spica-c2 create_ap[1575330]: Doing cleanup.. done
. let me know if you can fix it — I haven’t found a way. Though for the first test I did manage to bridge it to br0, so it should work.
For now I’ll have to use nat.
I’ve put these commands in my service — at /etc/systemd/system/create_ap_5.service:
[Unit] Description=Create AP Service 5GHz After=network.target [Service] Type=simple ExecStartPre=/sbin/iw reg set RO ExecStartPre=/usr/sbin/rfkill unblock all ExecStart=/usr/bin/create_ap --config /etc/create_ap_5.conf KillSignal=SIGINT Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
I was surprised to find that running both APs (on different interfaces) was not an issue. Note that if you are using different wifi cards (e.g. only one of them supports 5GHz), you’ll have problems on reboot because the card names may change. You’ll need to add udev rules to force a name based on MAC address.
I’m getting around 65Mbps upload/download in the 5GHz spectrum (though the C2 has a 100Mbps uplink in my case) and about 40Mbps in the 2.4GHz. So, not bad. Let’s see how the stability goes.
Let me know if you can recommend other tweaks to improve performance/stability.
How to set wifi driver settings to prefer 5 GHz channel above 2.4 GHz
Currently I’m in a new building of my university. In this building my wifi often breaks down and then restores connection again. This is really irritating since it happens a lot. Now as a coincidence there were some tech guys running around here and where asking everyone if the wifi was doing fine. I told them that my wifi tears down all the time and then reconnects. They figured out that my wifi is switching all the time between the 2.4 GHz channel and 5 GHz channel. They asked me if I could acces the driver settings of my wireless card. Unfortunately I don’t know how to do this is in either Linux or Windows. And unfortunately again they only knew the windows solution xD. So I hope somebody can tell me how I tell my wifi that it should stay on the 5 GHz network and not disconnect and switch to the 2.4 GHz channel? -edit- @arhimed, firstly thank you for your help. I just tried what you said. It is some what different for me. I can’t seem to save the settings when I change the setting and choose to use only the 5 GHz band. «Network connections»->»Select the appropriate wireless network and click edit»->»In the wireless tab»->»Change the mode from infrastructure to ad-hoc»->»Choose 5 GHz band» However when I want to change the mode from infrastructure to ad-hoc the «save» button tells me that I have to authenticate myself. However I get no pop-up asking me for a password. Using sudo gnome-control-center didn’t help either. I could still not save it. Also a error occured then in the terminal:
** (nm-connection-editor:5577): WARNING **: Invalid setting Wireless Security: Security not compatible with Ad-Hoc mode
If possible, please consider closing some of your other open questions by selecting the best answer (if they have one). Consider which answers have been useful and need an upvote. We need users to maintain their questions so that the site can be an effective tool for the next person with your problems. For more details on best practices consider reading the FAQ on asking questions.
I haven’t tried but I hope that will help you. So, go to network-manager-> edit connections, wireless connections->select you network->Change. Set ‘Mode’ to ‘Special’ and frequency to 5GHz.