en:bpi-r2:wlan
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:bpi-r2:wlan [2020/12/23 16:03] – [known issues] frank | en:bpi-r2:wlan [2023/06/08 17:06] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== WLAN ====== | ||
+ | :!: Config-files don't have any security-params enabled (e.g. WLAN-security/ | ||
+ | ===== internal ===== | ||
+ | in Kernel 4.4.70 code is available, but must be activated | ||
+ | |||
+ | [[https:// | ||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | :!: wpasupplicant must be removed and hostapd+dnsmasq installed: | ||
+ | apt-get remove wpasupplicant | ||
+ | | ||
+ | apt-get install hostapd dnsmasq | ||
+ | |||
+ | |||
+ | {{ https:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | - wmt_loader | ||
+ | - stp_uart_launcher -p / | ||
+ | - load driver module (if compiled as module 5.4+): modprobe wlan_gen2 | ||
+ | - echo A >/ | ||
+ | |||
+ | in last step ap-device (Accesspoint) will be created, which can be used by hostapd | ||
+ | <code bash> | ||
+ | [14:14] root@bpi-r2: | ||
+ | ap0 Link encap: | ||
+ | bond0 Link encap: | ||
+ | eth0 Link encap: | ||
+ | inet6 addr: fe80:: | ||
+ | eth1 Link encap: | ||
+ | inet6 addr: fe80:: | ||
+ | lo Link encap:Local Loopback | ||
+ | sit0 Link encap: | ||
+ | tunl0 Link encap:IPIP Tunnel | ||
+ | wlan0 Link encap: | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | <code bash> | ||
+ | hw_mode=g | ||
+ | interface=ap0 | ||
+ | driver=nl80211 | ||
+ | channel=1 | ||
+ | auth_algs=1 | ||
+ | ssid=test | ||
+ | </ | ||
+ | |||
+ | start hostapd | ||
+ | |||
+ | hostapd -dd / | ||
+ | |||
+ | interface can now be further configured and DHCP-Server configured and started: [[# | ||
+ | |||
+ | {{ : | ||
+ | {{ : | ||
+ | |||
+ | ==== client-mode ==== | ||
+ | |||
+ | Afair only working in vendor kernel versions (4.4,4.14) | ||
+ | |||
+ | http:// | ||
+ | |||
+ | works with 4.14-mt6625 branch (4.14.32 + vendor-code + fixes) | ||
+ | |||
+ | apt install wpasupplicant | ||
+ | / | ||
+ | / | ||
+ | echo 1 >/ | ||
+ | |||
+ | / | ||
+ | < | ||
+ | network={ | ||
+ | ssid=" | ||
+ | psk=" | ||
+ | priority=1 | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | wpa_supplicant -i wlan0 -c / | ||
+ | dhclient wlan0 | ||
+ | ==== Kernel 4.14 ==== | ||
+ | |||
+ | code from 4.4.70 has been merged to [[https:// | ||
+ | |||
+ | wifi-configuration is the same as in Kernel 4.4 [[# | ||
+ | |||
+ | discussion here: [[http:// | ||
+ | |||
+ | systemd init script here: http:// | ||
+ | ==== known issues ==== | ||
+ | |||
+ | === random numbers === | ||
+ | |||
+ | after a (Re-)boot the random-number generator not filled enough, so that connection-attempts will be rejected. | ||
+ | |||
+ | in the hostapd-log there are entries like this: | ||
+ | < | ||
+ | random: Cannot read from / | ||
+ | random: Got 0/14 bytes from /dev/random | ||
+ | random: Only 6/20 bytes of strong random data available from /dev/random | ||
+ | random: Not enough entropy pool available for secure operations | ||
+ | WPA: Not enough entropy in random pool to proceed - reject first 4-way handshake | ||
+ | ... | ||
+ | WPA: Reject 4-way handshake to collect more entropy for random number generation | ||
+ | random: Mark internal entropy pool to be ready (count=1/2) | ||
+ | ... | ||
+ | random: Cannot read from / | ||
+ | random: Got 0/14 bytes from /dev/random | ||
+ | random: Only 6/20 bytes of strong random data available from /dev/random | ||
+ | random: Allow operation to proceed based on internal entropy | ||
+ | </ | ||
+ | |||
+ | http:// | ||
+ | |||
+ | < | ||
+ | apt-get install rng-tools | ||
+ | echo ' | ||
+ | </ | ||
+ | === init failed === | ||
+ | < | ||
+ | root@bpi-iot-ros-ai: | ||
+ | Opened combo device | ||
+ | get device id : 30243 | ||
+ | set device id : 30243 | ||
+ | do module init: 30243 | ||
+ | failed to init module | ||
+ | </ | ||
+ | |||
+ | This can be ignored because the combo-driver tries to init wifi,bt,gps and fm. Last 2 fail because driver does not support them. | ||
+ | |||
+ | === stpnode === | ||
+ | |||
+ | < | ||
+ | Can't open device node(/ | ||
+ | //in dmesg: | ||
+ | [WMT-DEV][W]WMT_open: | ||
+ | </ | ||
+ | reboot fixed that...reason still unclear | ||
+ | |||
+ | Also this can be tried: | ||
+ | < | ||
+ | apt-get install network-manager | ||
+ | sudo nmcli radio wifi off | ||
+ | rfkill unblock 1 | ||
+ | rfkill unblock 2 | ||
+ | </ | ||
+ | |||
+ | === no traffic === | ||
+ | |||
+ | Kernelmodules SCH_FQ / SCH_FQ_CODEL are known breaking ap0-functionality | ||
+ | |||
+ | maybe there are some kalHifAhbKalWakeLockTimeout messages in dmesg | ||
+ | |||
+ | maybe NETFILTER_XT_TARGET_NFQUEUE does have similar effects ([[http:// | ||
+ | |||
+ | === rcu_stall === | ||
+ | |||
+ | this is maybe caused by net.ifnames=0 | ||
+ | |||
+ | < | ||
+ | [ 437.885886] [MTK-WIFI] WIFI_open: WIFI_open: major 155 minor 0 (pid 2614) | ||
+ | [ 437.892961] [MTK-WIFI] WIFI_write: WIFI_write A | ||
+ | [ 437.892961] | ||
+ | [ 437.938648] kalFirmwareImageMapping firmware size 225840 | ||
+ | [ 439.132189] [MTK-WIFI] register_set_p2p_mode_handler: | ||
+ | [ 439.141960] [MTK-WIFI] WIFI_write: WMT turn on WIFI success! | ||
+ | [ 460.170441] rcu: INFO: rcu_sched detected stalls on CPUs/tasks: | ||
+ | </ | ||
+ | |||
+ | hang occours in kalioctl (drivers/ | ||
+ | |||
+ | solution: do not use net.ifnames in cmdline and use [[.: | ||
+ | |||
+ | === driver hang === | ||
+ | |||
+ | check if there is a wlan0 device before starting wifi.sh/ | ||
+ | driver will hang after message | ||
+ | |||
+ | [MTK-WIFI] WIFI_write: WMT turn on WIFI success | ||
+ | |||
+ | if there is a wlan0 interface not mapped to the mt6625l driver (maybe pcie/ | ||
+ | |||
+ | rootcause is adding a handler to wrong netdev searched with hardcoded wlan0 in drivers/ | ||
+ | |||
+ | #define WLAN_IFACE_NAME " | ||
+ | static INT8 *ifname = WLAN_IFACE_NAME; | ||
+ | netdev = dev_get_by_name(& | ||
+ | pf_set_p2p_mode(netdev, | ||
+ | |||
+ | you can rename existing wlan0 to anything else before starting ap0 init | ||
+ | |||
+ | ip link set wlan0 name wlan_2g | ||
+ | ip link set wlan1 name wlan_5g | ||
+ | |||
+ | did this with my mt7615 (dbdc mode) and wifi init finished with success in linux 5.10 | ||
+ | |||
+ | === client-mode does not work === | ||
+ | |||
+ | client mode does not work in 4.9+ | ||
+ | |||
+ | http:// | ||
+ | |||
+ | |||
+ | i tested wifi-client in 5.10, here it is working with config posted here: | ||
+ | |||
+ | http:// | ||
+ | ===== external ===== | ||
+ | |||
+ | ==== MT7612 ==== | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | firmware neeeded: https:// | ||
+ | |||
+ | === 4.4.70 === | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | <code bash> | ||
+ | git clone https:// | ||
+ | cd bpi_r2_mt76/ | ||
+ | cd linux-mt/ | ||
+ | git clone https:// | ||
+ | cd ../../../.. # | ||
+ | patch -p1 < drivers/ | ||
+ | nano drivers/ | ||
+ | #add: obj-$(CONFIG_MT76) | ||
+ | nano drivers/ | ||
+ | #add before endif: before endif # WL_MEDIATEK: | ||
+ | cd .. | ||
+ | ./build.sh => 4 | ||
+ | #networking support => wireless => < | ||
+ | #Device Drivers | ||
+ | ./build.sh => 1 | ||
+ | cp SD/ | ||
+ | sudo cp -r SD/ | ||
+ | cp linux-mt/ | ||
+ | #scp linux-mt/ | ||
+ | sync | ||
+ | </ | ||
+ | |||
+ | === 4.14 === | ||
+ | |||
+ | Kernel 4.14 (in progress...): | ||
+ | < | ||
+ | import {{ : | ||
+ | |||
+ | <code bash> | ||
+ | patch -p1 < pcie.patch | ||
+ | cd drivers/ | ||
+ | git clone https:// | ||
+ | </ | ||
+ | * in mt76/ | ||
+ | * in mt76/ | ||
+ | * in Makefile missing " | ||
+ | * and include code in drivers/ | ||
+ | |||
+ | unpack {{ : | ||
+ | |||
+ | activate following modules in kernel: | ||
+ | |||
+ | < | ||
+ | CONFIG_MAC80211=m | ||
+ | CONFIG_CFG80211=m | ||
+ | CONFIG_MT76=m | ||
+ | |||
+ | #pcie | ||
+ | CONFIG_PCIEPORTBUS=y | ||
+ | CONFIG_PCIE_MEDIATEK=y | ||
+ | CONFIG_PHY_MTK_TPHY=y | ||
+ | </ | ||
+ | |||
+ | copy the firmware | ||
+ | |||
+ | sudo cp drivers/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | === configure === | ||
+ | |||
+ | <code bash> | ||
+ | [10:50] root@bpi-r2: | ||
+ | wlan1 Link encap: | ||
+ | </ | ||
+ | if your wlan-device-number is above 1, you can edit that with | ||
+ | <code bash> | ||
+ | nano / | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | <code bash> | ||
+ | interface=wlan1 | ||
+ | # | ||
+ | driver=nl80211 | ||
+ | |||
+ | ssid=r2_AP1 | ||
+ | |||
+ | hw_mode=g | ||
+ | channel=1 | ||
+ | # | ||
+ | auth_algs=1 | ||
+ | # | ||
+ | #wpa=2 | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | start hostapd (Debugmode): | ||
+ | < | ||
+ | |||
+ | set IP-address and start dnsmasq: | ||
+ | [[# | ||
+ | |||
+ | ==== MT7615 ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | http:// | ||
+ | |||
+ | I have added mt7615 driver in 5.4 on nov 19 2020 (should be 5.4.78). | ||
+ | |||
+ | Mt7615 is separate kernel-module which needs to be loaded | ||
+ | |||
+ | modprobe mt7615e | ||
+ | |||
+ | === dual-ap === | ||
+ | |||
+ | Dbdc mode was added in 5.7 | ||
+ | |||
+ | echo 1 > / | ||
+ | |||
+ | There is a report that dbdc cannot be enabled after reboot,but on [[http:// | ||
+ | |||
+ | You can only enable 2.4ghz on phy0, and 5ghz on phy1 simultaneously. | ||
+ | |||
+ | === antenna connectors === | ||
+ | |||
+ | < | ||
+ | |||
+ | http:// | ||
+ | ===== HostAPd ===== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== 5GHz ==== | ||
+ | |||
+ | <code bash> | ||
+ | apt-get install iw | ||
+ | iw list | grep " | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | apt-get install iw wireless-regdb crda | ||
+ | </ | ||
+ | === country code === | ||
+ | setting Country-Code (regulary domain) can be a bit tricky | ||
+ | <code bash> | ||
+ | iw reg set ISO_3166-1_alpha-2 | ||
+ | iw reg set DE | ||
+ | iw reg get | ||
+ | </ | ||
+ | |||
+ | wrong output: | ||
+ | |||
+ | global | ||
+ | country 00: DFS-UNSET | ||
+ | |||
+ | correct: | ||
+ | |||
+ | global | ||
+ | country US: DFS-ETSI | ||
+ | |||
+ | maybe try this: | ||
+ | < | ||
+ | modprobe cfg80211 ieee80211_regdom=US | ||
+ | COUNTRY=US crda | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | $ sudo nano / | ||
+ | options cfg80211 ieee80211_regdom=US | ||
+ | </ | ||
+ | |||
+ | === possible frequencies === | ||
+ | < | ||
+ | iw list | grep MHz | ||
+ | </ | ||
+ | === Hostapd-Configuration === | ||
+ | |||
+ | <code bash> | ||
+ | $ sudo nano / | ||
+ | [...] | ||
+ | country_code=US | ||
+ | ieee80211n=1 | ||
+ | ieee80211d=1 | ||
+ | hw_mode=a | ||
+ | channel=48 | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | ===== IP-Configuration ===== | ||
+ | |||
+ | set IP-address: | ||
+ | |||
+ | <code bash> | ||
+ | #set IP and start | ||
+ | ip addr add 192.168.10.1/ | ||
+ | #ip link set dev ap0 up | ||
+ | |||
+ | ip addr add 192.168.11.1/ | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | <code ini> | ||
+ | conf-dir=/ | ||
+ | </ | ||
+ | / | ||
+ | <code bash> | ||
+ | # | ||
+ | interface=wlan0 | ||
+ | # | ||
+ | interface=ap0 | ||
+ | |||
+ | # DHCP-Server not active for Interface | ||
+ | # | ||
+ | no-dhcp-interface=eth0 | ||
+ | no-dhcp-interface=eth1 | ||
+ | |||
+ | # | ||
+ | dhcp-range=ap0, | ||
+ | dhcp-option=ap0, | ||
+ | dhcp-range=wlan1, | ||
+ | dhcp-option=wlan1, | ||
+ | |||
+ | #special handling of some hosts (here using another dns-server) | ||
+ | # | ||
+ | dhcp-option=tag: | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | service dnsmasq start | ||
+ | |||
+ | ==== Routing ==== | ||
+ | |||
+ | <code bash> | ||
+ | nano / | ||
+ | #activate net.ipv4.ip_forward=1 and net.ipv6.conf.all.forwarding=1 by removing # at beginning of line | ||
+ | sysctl -p / | ||
+ | </ | ||
+ | |||
+ | if the BPI-R2 is not the main-router (access to internet), it is neccessary, that this main-router knows the networks (wlan) behind the R2. | ||
+ | |||
+ | The following commands must be entered on a (Debian-)Router, | ||
+ | <code bash> | ||
+ | route add -net 192.168.10.0 netmask 255.255.255.0 gw 192.168.0.10 | ||
+ | route add -net 192.168.11.0 netmask 255.255.255.0 gw 192.168.0.10 | ||
+ | </ | ||
+ | here is 192.168.10.0 the 1st WLAN, 192.168.11.0 the 2nd WLAN and 192.168.0.10 is the LAN-IP of the BPI-R2 (same subnet as LAN-IP from main-router) | ||