Dmitriy Zhuk Posted March 15, 2018 Posted March 15, 2018 Hello guys. I try to configure AP on WiFi. I have created /etc/hostapd/hostapd.conf: interface=wlan0 driver=nl80211 country_code=IN ssid=TEST hw_mode=g channel=6 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP auth_algs=1 macaddr_acl=0 Then I have uncommented DAEMON_CONF="/etc/hostapd/hostapd.conf" in /etc/default/hostapd. After it, I run /etc/init.d/hostapd restart And I try to scan WiFi via mobile phone, and no TEST. What am I doing wrong?
Igor Posted March 15, 2018 Posted March 15, 2018 You need to tell Network manager that you will use this adaptor. Did you try the armbian-config way?
Dmitriy Zhuk Posted March 15, 2018 Author Posted March 15, 2018 Could you please explain me this way?
Igor Posted March 15, 2018 Posted March 15, 2018 9 minutes ago, Dmitriy Zhuk said: Could you please explain me this way? How do you mean explain? How it is made or how to run it?
Dmitriy Zhuk Posted March 15, 2018 Author Posted March 15, 2018 Sorry, I mean how to run it. This video has small resolution, and I can't view it.
Igor Posted March 15, 2018 Posted March 15, 2018 Get latest armbian, than run sudo armbian-config Here is video in full quality: https://www.youtube.com/watch?v=__BJtInOQFY
Dmitriy Zhuk Posted March 15, 2018 Author Posted March 15, 2018 Thank you. But, for some reasons, I use older version of Armbian (5.33) for my BananaPi M2+. And, in menu Wired Wireless Bluetooth Hotspot only 3 items: IP Clear Advanced And it is no Hotspot item. How can I make AP via hostapd?
Igor Posted March 16, 2018 Posted March 16, 2018 8 hours ago, Dmitriy Zhuk said: How can I make AP via hostapd? 1 You can try with "clear", then go up and go once again into networking. You should have a menu for this but since you already made changes to configurations, this method might not work. It is not that resilient. I would still recommend you to go with the latest build or study the whole thing in deep. The main problem in a manual method is to add wlan0 to /etc/NetworkManager/conf.d/10-ignore-interfaces.conf and restart Network manager ... this way hostapd gets access to this wireless adaptor in first place. I think this is the main problem you are facing. Second is correct hostapd configuration.
Dmitriy Zhuk Posted March 18, 2018 Author Posted March 18, 2018 (edited) My folder /etc/NetworkManager/conf.d is empty. I have attached my hostapd.conf I run hostapd -dd /etc/hostapd.conf There is my output: Spoiler root@bananapim2plus:~# hostapd -dd /etc/hostapd.conf random: Trying to read entropy from /dev/random Configuration file: /etc/hostapd.conf ctrl_interface_group=0 nl80211: Could not add multicast membership for vendor events: -2 (No such file or directory) nl80211: Supported cipher 00-0f-ac:1 nl80211: Supported cipher 00-0f-ac:5 nl80211: Supported cipher 00-0f-ac:2 nl80211: Supported cipher 00-0f-ac:4 nl80211: Supported cipher 00-0f-ac:6 nl80211: Using driver-based off-channel TX nl80211: TDLS supported nl80211: Use separate P2P group interface (driver advertised support) nl80211: Enable multi-channel concurrent (driver advertised support) nl80211: interface wlan0 in phy phy0 nl80211: Set mode ifindex 3 iftype 3 (AP) nl80211: Setup AP(wlan0) - device_ap_sme=1 use_monitor=0 nl80211: Subscribe to mgmt frames with AP handle 0xb70891e8 (device SME) nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=04 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=0501 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=0504 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=06 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=08 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=09 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=0a nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=11 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb70891e8 match=7f nl80211: Enable Probe Request reporting nl_preq=0xb7088cc0 nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0xb7088cc0 match= rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0 nl80211: Could not re-add multicast membership for vendor events: -2 (No such file or directory) nl80211: Add own interface ifindex 3 (ifidx_reason -1) nl80211: if_indices[16]: 3(-1) nl80211: Add own interface ifindex 7 (ifidx_reason 3) nl80211: if_indices[16]: 3(-1) 7(3) nl80211: Adding interface wlan0 into bridge br0 phy: phy0 BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits) wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE Previous country code 00, new country code UA Continue interface setup after channel list update ctrl_iface not configured! random: Got 20/20 bytes from /dev/random RTM_NEWLINK: ifi_index=7 ifname=br0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 () nl80211: Interface down (br0/br0) nl80211: Not the main interface (wlan0) - do not indicate interface down wlan0: Event INTERFACE_STATUS (5) received Unknown event 5 RTM_NEWLINK: ifi_index=7 ifname=br0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 () nl80211: Interface down (br0/br0) nl80211: Not the main interface (wlan0) - do not indicate interface down wlan0: Event INTERFACE_STATUS (5) received Unknown event 5 RTM_NEWLINK: ifi_index=3 ifname=wlan0 master=7 operstate=6 ifi_family=7 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) nl80211: Add ifindex 7 for bridge br0 nl80211: Add own interface ifindex 7 (ifidx_reason 3) nl80211: ifindex 7 already in the list RTM_NEWLINK: ifi_index=7 ifname=br0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 () nl80211: Interface down (br0/br0) nl80211: Not the main interface (wlan0) - do not indicate interface down wlan0: Event INTERFACE_STATUS (5) received Unknown event 5 RTM_NEWLINK: ifi_index=3 ifname=wlan0 master=7 operstate=6 ifi_family=7 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) nl80211: Add ifindex 7 for bridge br0 nl80211: Add own interface ifindex 7 (ifidx_reason 3) nl80211: ifindex 7 already in the list RTM_NEWLINK: ifi_index=3 ifname=wlan0 master=7 operstate=6 ifi_family=7 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) nl80211: Add ifindex 7 for bridge br0 nl80211: Add own interface ifindex 7 (ifidx_reason 3) nl80211: ifindex 7 already in the list RTM_NEWLINK: ifi_index=7 ifname=br0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x11003 ([UP][LOWER_UP]) wlan0: Event INTERFACE_STATUS (5) received Unknown event 5 RTM_NEWLINK: ifi_index=7 ifname=br0 operstate=6 linkmode=0 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) wlan0: Event INTERFACE_STATUS (5) received Unknown event 5 Channel list update timeout - try to continue anyway nl80211: Regulatory information - country=00 nl80211: 2402-2472 @ 40 MHz 20 mBm nl80211: 2457-2482 @ 40 MHz 20 mBm (no IR) nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR) nl80211: 5170-5250 @ 40 MHz 20 mBm (no IR) nl80211: 5735-5835 @ 40 MHz 20 mBm (no IR) nl80211: Added 802.11b mode based on 802.11g information Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=20 dBm Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=12 freq=2467 MHz max_tx_power=20 dBm Allowed channel: mode=0 chan=13 freq=2472 MHz max_tx_power=20 dBm hw vht capab: 0x0, conf vht capab: 0x0 Completing interface initialization Mode: IEEE 802.11g Channel: 5 Frequency: 2432 MHz DFS 0 channels required radar detection nl80211: Set freq 2432 (ht_enabled=1, vht_enabled=0, bandwidth=20 MHz, cf1=2432 MHz, cf2=0 MHz) * freq=2432 * vht_enabled=0 * ht_enabled=1 * sec_channel_offset=0 * channel_type=1 RATE[0] rate=10 flags=0x1 RATE[1] rate=20 flags=0x1 RATE[2] rate=55 flags=0x1 RATE[3] rate=110 flags=0x1 RATE[4] rate=60 flags=0x0 RATE[5] rate=90 flags=0x0 RATE[6] rate=120 flags=0x0 RATE[7] rate=180 flags=0x0 RATE[8] rate=240 flags=0x0 RATE[9] rate=360 flags=0x0 RATE[10] rate=480 flags=0x0 RATE[11] rate=540 flags=0x0 hostapd_setup_bss(hapd=0xb70885d8 (wlan0), first=1) wlan0: Flushing old station entries nl80211: flush -> DEL_STATION wlan0 (all) wlan0: Deauthenticate all stations nl80211: sta_remove -> DEL_STATION wlan0 ff:ff:ff:ff:ff:ff --> 0 (Success) wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0 wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0 wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0 wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0 Using interface wlan0 with hwaddr b0:f1:ec:0d:23:d6 and ssid "ARMBIAN" Deriving WPA PSK based on passphrase SSID - hexdump_ascii(len=7): 41 52 4d 42 49 41 4e ARMBIAN PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED] PSK (from passphrase) - hexdump(len=32): [REMOVED] Get randomness: len=32 entropy=0 GMK - hexdump(len=32): [REMOVED] Get randomness: len=32 entropy=0 Key Counter - hexdump(len=32): [REMOVED] WPA: Delay group state machine start until Beacon frames have been configured nl80211: Set beacon (beacon_set=0) nl80211: Beacon head - hexdump(len=58): 80 00 00 00 ff ff ff ff ff ff b0 f1 ec 0d 23 d6 b0 f1 ec 0d 23 d6 00 00 00 00 00 00 00 00 00 00 64 00 31 04 00 07 41 52 4d 42 49 41 4e 01 08 82 84 8b 96 0c 12 18 24 03 01 05 nl80211: Beacon tail - hexdump(len=117): 07 06 55 41 20 01 0d 14 2a 01 00 32 04 30 48 60 6c 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00 2d 1a 0c 00 1f ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 18 00 50 f2 02 01 01 00 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00 nl80211: ifindex=3 nl80211: beacon_int=100 nl80211: dtim_period=2 nl80211: ssid - hexdump_ascii(len=7): 41 52 4d 42 49 41 4e ARMBIAN * beacon_int=100 * dtim_period=2 nl80211: hidden SSID not in use nl80211: privacy=1 nl80211: auth_algs=0x1 nl80211: wpa_version=0x2 nl80211: key_mgmt_suites=0x2 nl80211: pairwise_ciphers=0x10 nl80211: group_cipher=0x10 nl80211: SMPS mode - off WPA: Start group state machine to set initial keys WPA: group state machine entering state GTK_INIT (VLAN-ID 0) Get randomness: len=16 entropy=0 GTK - hexdump(len=16): [REMOVED] WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0) wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=3 addr=0xb6f453a4 key_idx=1 set_tx=1 seq_len=0 key_len=16 nl80211: KEY_DATA - hexdump(len=16): [REMOVED] broadcast key nl80211: Set wlan0 operstate 0->1 (UP) netlink: Operstate: ifindex=3 linkmode=-1 (no change), operstate=6 (IF_OPER_UP) Failed to set TX queue parameters for queue 0. Failed to set TX queue parameters for queue 1. Failed to set TX queue parameters for queue 2. Failed to set TX queue parameters for queue 3. wlan0: interface state COUNTRY_UPDATE->ENABLED wlan0: AP-ENABLED wlan0: Setup of interface done. RTM_NEWLINK: ifi_index=3 ifname=wlan0 master=7 operstate=6 ifi_family=7 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) nl80211: Add ifindex 7 for bridge br0 nl80211: Add own interface ifindex 7 (ifidx_reason 3) nl80211: ifindex 7 already in the list Maybe this additional information can help... hostapd.conf Edited March 18, 2018 by Igor add spoiler
Igor Posted March 18, 2018 Posted March 18, 2018 1 hour ago, Dmitriy Zhuk said: My folder /etc/NetworkManager/conf.d is empty. I have attached my hostapd.conf I run hostapd -dd /etc/hostapd.conf You are wasting time ... until you don't tell Network manager to give you access to the device. This step is important. https://askubuntu.com/questions/21914/how-can-i-make-networkmanager-ignore-my-wireless-card
Dmitriy Zhuk Posted March 18, 2018 Author Posted March 18, 2018 3 hours ago, Igor said: You are wasting time ... until you don't tell Network manager to give you access to the device. This step is important. https://askubuntu.com/questions/21914/how-can-i-make-networkmanager-ignore-my-wireless-card Do you mean, I need add [keyfile] unmanaged-devices=mac:00:19:e0:57:86:af to file /etc/NetworkManager/NetworkManager.conf? By the way, without telling Network manager, I can to connect to WiFi modem via wpa_supplicant. Is it OK?
Dmitriy Zhuk Posted March 21, 2018 Author Posted March 21, 2018 I have created file /etc/NetworkManager/conf.d/10-ignore-interfaces.conf with echo "[keyfile]" > /etc/NetworkManager/conf.d/10-ignore-interfaces.conf echo "unmanaged-devices=interface-name:wlx0013ef6c46e3" >> /etc/NetworkManager/conf.d/10-ignore-interfaces.conf service network-manager restart I run hostapd -dd /etc/hostapd.conf and also no AP
Igor Posted March 21, 2018 Posted March 21, 2018 I almost forgot this. With legacy kernel you need to load module (dhd, ap6211 or ap6212) with op_mode=2 while on mainline kernel this is not needed.
Dmitriy Zhuk Posted March 22, 2018 Author Posted March 22, 2018 I have cache/sources/linux-sun8i/sun8i/drivers/net/wireless/bcmdhd/dhd.ko But I don't have ap6212.ko and ap6211.ko How can I to insmod it?
Dmitriy Zhuk Posted March 22, 2018 Author Posted March 22, 2018 Igor, thank you for this hint. I have the small success. I have done rmmod dhd modprobe dhd op_mode=2 After it, I can scan and see my SSID via mobile phone. But, when I trying to connect to it, my phone can't obtain IP address. Do I have error on my hostapd.conf? Or do I need other actions for successful connecting?
Igor Posted March 23, 2018 Posted March 23, 2018 7 hours ago, Dmitriy Zhuk said: But, when I trying to connect to it, my phone can't obtain IP address. Since you don't know how to setup thing it is better to use armbian-config way. It does everything ... except switching this mode. In case you want to do it manually, use google. There are tons of manuals around. You need to setup DHCP server or put network into bridge mode which will make use of your current DHCP server ...
Dmitriy Zhuk Posted March 25, 2018 Author Posted March 25, 2018 I have resolved this problem due to this forum: https://www.raspberrypi.org/forums/viewtopic.php?t=17702 But I have the question. This method works: rmmod dhd modprobe dhd op_mode=2 But this method does't work: echo 2 > /sys/module/dhd/parameters/op_mode Why? How can I to change some script in sources in order to this module insert with op_mode=2 by default?
Dmitriy Zhuk Posted March 25, 2018 Author Posted March 25, 2018 And I have the second question. When I run hostapd as daemon in background (hostapd -B /etc/hostapd.conf), how can I stop the hostapd? The one way (I think wrong way) I can ps -ef | grep hostapd and then hill the precess.
Dmitriy Zhuk Posted March 25, 2018 Author Posted March 25, 2018 These methods don't work: root@bananapim2plus:~# ps -ef | grep hostapd root 1061 1 0 23:55 ? 00:00:00 hostapd -B /etc/hostapd.conf root 1148 948 0 23:57 pts/0 00:00:00 grep hostapd root@bananapim2plus:~# systemctl stop hostapd root@bananapim2plus:~# ps -ef | grep hostapd root 1061 1 0 23:55 ? 00:00:00 hostapd -B /etc/hostapd.conf root 1154 948 0 23:57 pts/0 00:00:00 grep hostapd root@bananapim2plus:~# service hostapd stop root@bananapim2plus:~# ps -ef | grep hostapd root 1061 1 0 23:55 ? 00:00:00 hostapd -B /etc/hostapd.conf root 1172 948 0 23:58 pts/0 00:00:00 grep hostapd
Dmitriy Zhuk Posted March 30, 2018 Author Posted March 30, 2018 I have found the solution: kill `pidof hostapd`
Recommended Posts