Estou usando o hostapd para compartilhar outra conexão wifi através do meu raspberry pi zero w bult no cartão wifi. Após a inicialização do raspberry pi, posso ver meu SSID no meu telefone e até me conectar a ele e usá-lo por alguns segundos. Em seguida, o SSID simplesmente desaparece.
O status do hostapd não mostra nada de errado:
pi@raspberrypi:~ $ sudo service hostapd status
● hostapd.service - LSB: Advanced IEEE 802.11 management daemon
Loaded: loaded (/etc/init.d/hostapd; generated; vendor preset: enabled)
Active: active (running) since Sun 2018-08-05 16:55:06 UTC; 6min ago
Docs: man:systemd-sysv-generator(8)
Process: 557 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/hostapd.service
└─597 /usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf
Aug 05 16:55:04 raspberrypi systemd[1]: Starting LSB: Advanced IEEE 802.11 management daemon...
Aug 05 16:55:06 raspberrypi hostapd[557]: Starting advanced IEEE 802.11 management: hostapd.
Aug 05 16:55:06 raspberrypi systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.
Aqui está o meu dmesg:
[ 9.951912] bcm2835_alsa bcm2835_alsa: card created with 8 channels
[ 10.988983] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[ 11.023394] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[ 11.023812] usbcore: registered new interface driver brcmfmac
[ 11.550743] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[ 11.551907] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05-26 10:53:55 Inc Data: 9.10.39 Inc Compiler: 1.29.4 Inc ClmImport: 1.36.3 Creation: 2017-10-23 03:47:14
[ 12.469798] Indeed it is in host mode hprt0 = 00001101
[ 14.180038] uart-pl011 20201000.serial: no DMA platform data
[ 14.366758] usb 1-1: reset high-speed USB device number 2 using dwc_otg
[ 14.366994] Indeed it is in host mode hprt0 = 00001101
[ 16.080543] Adding 102396k swap on /var/swap. Priority:-2 extents:1 across:102396k SSFS
[ 16.161385] mt7601u 1-1:1.0: ASIC revision: 76010001 MAC revision: 76010500
[ 16.252009] mt7601u 1-1:1.0: Warning: unsupported EEPROM version 0d
[ 16.252028] mt7601u 1-1:1.0: EEPROM ver:0d fae:00
[ 16.771510] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[ 16.776815] usbcore: registered new interface driver mt7601u
[ 18.456287] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[ 18.625722] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 18.625756] brcmfmac: power management disabled
[ 18.753324] Bluetooth: Core ver 2.22
[ 18.753500] NET: Registered protocol family 31
[ 18.753508] Bluetooth: HCI device and connection manager initialized
[ 18.753534] Bluetooth: HCI socket layer initialized
[ 18.753548] Bluetooth: L2CAP socket layer initialized
[ 18.753612] Bluetooth: SCO socket layer initialized
[ 18.781182] Bluetooth: HCI UART driver ver 2.3
[ 18.781197] Bluetooth: HCI UART protocol H4 registered
[ 18.781202] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 18.786141] Bluetooth: HCI UART protocol Broadcom registered
[ 19.362969] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 19.362997] Bluetooth: BNEP filters: protocol multicast
[ 19.363027] Bluetooth: BNEP socket layer initialized
[ 20.245972] wlan1: authenticate with 48:ee:0c:1f:d8:73
[ 20.308671] wlan1: send auth to 48:ee:0c:1f:d8:73 (try 1/3)
[ 20.310399] wlan1: authenticated
[ 20.313517] wlan1: associate with 48:ee:0c:1f:d8:73 (try 1/3)
[ 20.317906] wlan1: RX AssocResp from 48:ee:0c:1f:d8:73 (capab=0x411 status=0 aid=7)
[ 20.362268] wlan1: associated
[ 21.491599] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
[ 32.303384] nf_conntrack version 0.5.0 (7168 buckets, 28672 max)
[ 33.692972] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
wlan1
é o wireless no qual o raspberry pi está conectado. wlan0
é o próprio wifi embutido da framboesa. Não vejo erros.
Aqui está /var/log/syslog
:
Aug 5 16:55:06 raspberrypi kernel: [ 33.692972] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Aug 5 16:55:06 raspberrypi hostapd[557]: Starting advanced IEEE 802.11 management: hostapd.
Aug 5 16:55:06 raspberrypi dnsmasq[599]: started, version 2.76 cachesize 150
Aug 5 16:55:06 raspberrypi systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.
Aug 5 16:55:06 raspberrypi dnsmasq[599]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Aug 5 16:55:06 raspberrypi dnsmasq-dhcp[599]: DHCP, IP range 192.168.4.2 -- 192.168.4.20, lease time 1d
Aug 5 16:55:06 raspberrypi dnsmasq[599]: reading /run/dnsmasq/resolv.conf
Aug 5 16:55:06 raspberrypi dnsmasq[599]: using nameserver 192.168.25.1#53
Aug 5 16:55:06 raspberrypi dnsmasq[599]: read /etc/hosts - 5 addresses
Aug 5 16:55:06 raspberrypi dnsmasq[600]: Too few arguments.
Aug 5 16:55:06 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Aug 5 16:55:06 raspberrypi systemd[1]: Reached target Multi-User System.
Aug 5 16:55:06 raspberrypi systemd[1]: Reached target Graphical Interface.
Aug 5 16:55:06 raspberrypi systemd[1]: Starting Update UTMP about System Runlevel Changes...
Aug 5 16:55:06 raspberrypi systemd[1]: Reached target Host and Network Name Lookups.
Aug 5 16:55:06 raspberrypi systemd[1]: Started Update UTMP about System Runlevel Changes.
Aug 5 16:55:06 raspberrypi systemd[1]: Startup finished in 1.995s (kernel) + 32.367s (userspace) = 34.362s.
Aug 5 16:55:07 raspberrypi avahi-daemon[188]: Joining mDNS multicast group on interface wlan0.IPv6 with address fe80::ba27:ebff:feaa:1f8.
Aug 5 16:55:07 raspberrypi avahi-daemon[188]: New relevant interface wlan0.IPv6 for mDNS.
Aug 5 16:55:07 raspberrypi avahi-daemon[188]: Registering new address record for fe80::ba27:ebff:feaa:1f8 on wlan0.*.
Aug 5 16:55:28 raspberrypi systemd[1]: Time has been changed
Aug 5 16:55:28 raspberrypi systemd[1]: apt-daily-upgrade.timer: Adding 27min 26.673226s random time.
Aug 5 16:55:28 raspberrypi systemd-timesyncd[173]: Synchronized to time server [2a01:4f8:110:30e1::9]:123 (2.debian.pool.ntp.org).
Aug 5 16:55:28 raspberrypi systemd[1]: apt-daily.timer: Adding 7h 36min 12.296585s random time.
Aug 5 17:01:05 raspberrypi systemd[1]: Created slice User Slice of pi.
Aug 5 17:01:05 raspberrypi systemd[1]: Started Session c1 of user pi.
Aug 5 17:01:05 raspberrypi systemd[1]: Starting User Manager for UID 1000...
Aug 5 17:01:06 raspberrypi systemd[668]: Listening on GnuPG cryptographic agent and passphrase cache.
Aug 5 17:01:06 raspberrypi systemd[668]: Listening on GnuPG cryptographic agent (access for web browsers).
Aug 5 17:01:06 raspberrypi systemd[668]: Listening on GnuPG cryptographic agent and passphrase cache (restricted).
Aug 5 17:01:06 raspberrypi systemd[668]: Reached target Timers.
Aug 5 17:01:06 raspberrypi systemd[668]: Reached target Paths.
Aug 5 17:01:06 raspberrypi systemd[668]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Aug 5 17:01:06 raspberrypi systemd[668]: Reached target Sockets.
Aug 5 17:01:06 raspberrypi systemd[668]: Reached target Basic System.
Aug 5 17:01:06 raspberrypi systemd[668]: Reached target Default.
Aug 5 17:01:06 raspberrypi systemd[668]: Startup finished in 178ms.
Aug 5 17:01:06 raspberrypi systemd[1]: Started User Manager for UID 1000.
Aug 5 17:02:40 raspberrypi wpa_supplicant[373]: wlan1: WPA: Group rekeying completed with 48:ee:0c:1f:d8:73 [GTK=CCMP]
também não vejo erros
ATUALIZAÇÃO: O problema parece acontecer somente depois que alguém se conecta à rede. As últimas mensagens no syslog são
Aug 5 17:39:27 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.11: associated
Aug 5 17:39:27 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 RADIUS: starting accounting session 5B672BEA-00000000
Aug 5 17:39:27 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: pairwise key handshake completed (RSN)
Aug 5 17:39:27 raspberrypi dnsmasq-dhcp[599]: DHCPDISCOVER(wlan0) 38:80:df:35:8a:d3
Aug 5 17:39:27 raspberrypi dnsmasq-dhcp[599]: DHCPOFFER(wlan0) 192.168.4.16 38:80:df:35:8a:d3
Aug 5 17:39:27 raspberrypi dnsmasq-dhcp[599]: DHCPREQUEST(wlan0) 192.168.4.16 38:80:df:35:8a:d3
Aug 5 17:39:27 raspberrypi dnsmasq-dhcp[599]: DHCPACK(wlan0) 192.168.4.16 38:80:df:35:8a:d3
Aug 5 17:41:35 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.11: disassociated
Aug 5 17:41:35 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.11: disassociated
Mas não vejo erros.
ATUALIZAR:
Aqui está o meu /etc/hostapd/hostapd.conf
arquivo:
interface=wlan0
driver=nl80211
ssid=NameOfNetwork
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AardvarkBadgerHedgehog
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ATUALIZAR:
Aqui está o hostapd com mais verbosidade:
Aug 5 18:21:22 raspberrypi systemd[1]: Started User Manager for UID 1000.
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.11: associated
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: event 1 notification
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: start authentication
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.1X: unauthorizing port
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: sending 1/4 msg of 4-Way Handshake
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: EAPOL-Key timeout
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: sending 1/4 msg of 4-Way Handshake
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: received EAPOL-Key frame (2/4 Pairwise)
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: sending 3/4 msg of 4-Way Handshake
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: received EAPOL-Key frame (4/4 Pairwise)
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.1X: authorizing port
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 RADIUS: starting accounting session 5B674006-00000000
Aug 5 18:21:40 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: pairwise key handshake completed (RSN)
Aug 5 18:21:40 raspberrypi dnsmasq-dhcp[599]: DHCPDISCOVER(wlan0) 38:80:df:35:8a:d3
Aug 5 18:21:40 raspberrypi dnsmasq-dhcp[599]: DHCPOFFER(wlan0) 192.168.4.16 38:80:df:35:8a:d3
Aug 5 18:21:40 raspberrypi dnsmasq-dhcp[599]: DHCPREQUEST(wlan0) 192.168.4.16 38:80:df:35:8a:d3
Aug 5 18:21:40 raspberrypi dnsmasq-dhcp[599]: DHCPACK(wlan0) 192.168.4.16 38:80:df:35:8a:d3
Aug 5 18:21:54 raspberrypi systemd[664]: Time has been changed
Aug 5 18:21:54 raspberrypi systemd[1]: Time has been changed
Aug 5 18:21:54 raspberrypi systemd[1]: apt-daily.timer: Adding 10h 13min 39.087355s random time.
Aug 5 18:21:54 raspberrypi systemd[1]: apt-daily-upgrade.timer: Adding 28min 49.504522s random time.
Aug 5 18:22:27 raspberrypi systemd[1]: Time has been changed
Aug 5 18:22:27 raspberrypi systemd[1]: apt-daily.timer: Adding 55min 40.693498s random time.
Aug 5 18:22:27 raspberrypi systemd[1]: apt-daily-upgrade.timer: Adding 23min 53.062642s random time.
Aug 5 18:22:27 raspberrypi systemd[664]: Time has been changed
Aug 5 18:24:06 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.11: disassociated
Aug 5 18:24:06 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 WPA: event 2 notification
Aug 5 18:24:06 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.1X: unauthorizing port
Aug 5 18:24:14 raspberrypi hostapd: wlan0: STA 38:80:df:35:8a:d3 IEEE 802.11: disassociated
ATUALIZAR:
Eu já havia configurado este raspberry pi com ethernet USB. Agora reinstalei uma nova imagem e apenas configurei o necessário para a funcionalidade do AP sem fio. O problema ainda acontece. Também ainda acontece depois sudo apt update && sudo apt upgrade -y
, então parece mais um bug do que uma configuração errada.
Alguém tem alguma idéia de como depurá-lo?
Ao adicionar ou modificar esses parâmetros,
/etc/hostapd/hostapd.conf
resolvi o problema para mim:No seu /etc/hostapd/hostapd.conf você tem este padrão:
Certifique-se de que esteja desabilitado e não alterado.
Além disso, este artigo do Raspberry.PI: " Obtendo o wifi para funcionar com uma rede oculta " recomenda:
Exemplo: