Eu tenho trabalhado com o suplicante do wpa por dias agora e finalmente cheguei ao ponto em que não consigo encontrar nenhuma pista nova no google. então aqui está o problema: eu só instalei uma nova placa wifi tl-wn881nd pci-e tp-link no meu PC desktop executando debian wheezy. wlan0
afirma estar conectado (ish? veja abaixo) ao ponto de acesso, ifconfig
informa o endereço IP estático correto que eu atribuí, mas eu não consigo pingar o ponto de acesso e syslog
diz que há um erro com o aperto de mão.
em primeiro lugar, eu li que network-manager
pode mexer com as coisas. Tenho quase certeza que isso não é um problema para mim:
$ which NetworkManager
##### blank #####
$ dpkg -l | grep -i network-manager
rc network-manager 0.9.4.0-10 amd-64 network management framework (daemon and userspace tools)
ii network-manager-openvpn 0.9.4.0-1 amd-64 network management framework (OpenVPN plugin core)
as especificações do meu computador são:
$ uname -a
Linux mypc 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
$ sudo dmidecode | grep -iA3 '^system information'
System Information
Manufacturer: Dell Inc.
Product Name: OptiPlex 745
Version: Not Specified
e as especificações do cartão Wi-Fi são:
$ lspci | grep -i wireless
02:00.0 Network controller: Atheros Communications Inc. AR9287 Wireless Network Adapter (PCI-Express) (rev 01)
verifiquei se o cartão de Wi-Fi está ativo:
$ sudo ip link set wlan0 up
$ sudo ip link show wlan0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisk mq state DORMANT mode DORMANT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
e o cartão é capaz de encontrar meu ssid:
$ sudo iw wlan0 scan
BSS xx:xx:xx:xx:xx:xx (on wlan0) -- associated
TSF: 2639667559 ysec (0d, 00:43:59)
freq:2412
beacon interval: 100
capability: ESS Privacy ShortSlotTime (0x0411)
signal: -56.00 dBm
last seen: 692 ms ago
Information elements from Probe Response frame:
SSID: aphanumeric_with_underscores
Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0
DS Parameter set: channel 1
ERP: Use_Protection Barker_Preamble_Mode
Extended supported rates: 6.0 12.0 24.0 48.0
HT capabilities:
Capabilities: 0x106e
HT20/HT40
SM Power Save disabled
RX HT20 SGI
RX HT40 SGI
No RX STBC
Max AMSDU length: 3839 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 4 usec (0x05)
HT RX MCS rate indexes supported: 0-7, 32
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 1
* secondary channel offset: no secondary
* STA channel width 20MHz
* RIFS: 0
* HT protection: non-HT mixed
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
RSN:* Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: (0x0000)
WMM:* Parameter version 1
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
Extended capabilities: HT Information Exchange Supported
Country: AL Environment: Indoor/Outdoor
Channels [1 - 13] @ 15 dBm
eu leio em algum lugar que você pode colocar as opções do wpa_supplicant diretamente em /etc/network/interfaces
, então aqui está o meu:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use 'auto wlan0' since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove 'auto wlan0' from this file just to get a
# command prompt again!
iface wlan0 inet static
wpa-ssid "aphanumeric_with_underscores"
wpa-psk "my wpa2 password"
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
e observe que atualmente não há arquivo wpa_supplicant.conf
:
$ ls /etc/wpa_supplicant.conf
ls: cannot access /etc/wpa_supplicant.conf: No such file or directory
$ ls /etc/wpa_supplicant/*
action_wpa.sh functions.sh ifupdown.sh
agora se reiniciar a interface wlan0
:
$ sudo ifdown wlan0
$ sudo ifup wlan0
o endereço IP foi atribuído corretamente:
$ ifconfig
lo ...
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr 192.168.1.50 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::16cc:20ff:feea:4578/64 Scope:Link
UP BROADCAST MULTICAST NTU:1500 Metric:1
RX packets:3075 errors:0 dropped:0 overruns:0 frame:0
TX packets:4028 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:347475 (339.3KiB) TX bytes:586219 (572.4KiB)
mas aqui está o problema: a interface wlan0
parece estar ativa, mas não consigo acessar a Internet e nem consigo fazer o ping no ponto de acesso:
$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.50 icmp_seq=2 Destination Host Unreachable
From 192.168.1.50 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 0 received, +2 errors, 100% packet loss, time 2015ms
e quando olho em /var/log/syslog
, vejo alguns erros desagradáveis:
Mar 18 01:23:11 mypc kernel: [ 148.242137] wlan0: authenticate with xx.xx.xx.xx.xx.xx (try 1)
Mar 18 01:23:11 mypc kernel: [ 148.244009] wlan0: authenticated
Mar 18 01:23:11 mypc kernel: [ 148.265967] wlan0: associate with xx.xx.xx.xx.xx.xx (try 1)
Mar 18 01:23:11 mypc kernel: [ 148.287770] wlan0: RX AssocResp from xx.xx.xx.xx.xx.xx (capab=0x411 status=0 aid=1)
Mar 18 01:23:11 mypc kernel: [ 148.287774] wlan0: associated
Mar 18 01:23:11 mypc kernel: [ 148.287774] wlan0: associated
Mar 18 01:23:11 mypc wpa_supplicant[4473]: wlan0: Associated with xx.xx.xx.xx.xx.xx
Mar 18 01:23:11 mypc kernel: [ 148.297421] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Mar 18 01:23:11 mypc kernel: [ 148.297651] cfg80211: Calling CRDA for country AL
Mar 18 01:23:11 mypc kernel: [ 148.303008] cfg80211: Regulatory domain changed to country: AL
Mar 18 01:23:11 mypc kernel: [ 148.303013] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 01:23:11 mypc kernel: [ 148.303018] cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 01:23:11 mypc kernel: [ 148.303022] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 01:23:11 mypc kernel: [ 148.303026] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 01:23:11 mypc kernel: [ 148.303029] cfg80211: (5490000 KHz - 5710000 KHz @ 80000 KHz), (N/A, 2700 mBm)
Mar 18 01:23:19 mypc kernel: [ 155.819739] wlan0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 15)
Mar 18 01:23:19 mypc wpa_supplicant[4473]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Mar 18 01:23:19 mypc wpa_supplicant[4473]: wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=15
alguém sabe como eu posso consertar isso e pingar meu ponto de acesso via wlan0
?
modificação 1: tentando dhcp em vez de um ip estático
eu alterei /etc/network/interfaces
da seguinte forma:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use 'auto wlan0' since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove 'auto wlan0' from this file just to get a
# command prompt again!
iface wlan0 inet dhcp
wpa-ssid "aphanumeric_with_underscores"
wpa-psk "my wpa2 password"
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
(note que wpa_supplicant.conf
ainda não existe na modificação 1), e agora eu recebo alguns novos erros na linha de comando quando eu trago a interface:
$ sudo ifup wlan0
Operation failed.
Failed to bring up wlan0
e o syslog mostra as mesmas mensagens de falha repetidamente como antes:
Mar 18 08:59:01 mypc kernel: [ 2493.163777] ADDRCONF(NETDEV_UP): wlan0: link is not ready
Mar 18 08:59:02 mypc wpa_supplicant[6151]: wlan0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='alphanumeric_with_underscores' freq=2412 MHz)
Mar 18 08:59:02 mypc kernel: [ 2493.974111] wlan0: authenticate with xx:xx:xx:xx:xx:xx (try 1)
Mar 18 08:59:02 mypc kernel: [ 2493.976083] wlan0: authenticated
Mar 18 08:59:02 mypc wpa_supplicant[6151]: wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='aphanumeric_with_underscores' freq=2412 MHz)
Mar 18 08:59:02 mypc kernel: [ 2493.998016] wlan0: associate with xx:xx:xx:xx:xx:xx (try 1)
Mar 18 08:59:02 mypc kernel: [ 2494.019518] wlan0: RX ReassocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0 aid=2)
Mar 18 08:59:02 mypc kernel: [ 2494.019523] wlan0: associated
Mar 18 08:59:02 mypc wpa_supplicant[6151]: wlan0: Associated with xx:xx:xx:xx:xx:xx
Mar 18 08:59:02 mypc kernel: [ 2494.028721] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Mar 18 08:59:02 mypc kernel: [ 2494.028873] cfg80211: Calling CRDA for country: AL
Mar 18 08:59:02 mypc kernel: [ 2494.033830] cfg80211: Regulatory domain changed to country: AL
Mar 18 08:59:02 mypc kernel: [ 2494.033835] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 08:59:02 mypc kernel: [ 2494.033839] cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:02 mypc kernel: [ 2494.033843] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:02 mypc kernel: [ 2494.033846] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:02 mypc kernel: [ 2494.033849] cfg80211: (5490000 KHz - 5710000 KHz @ 80000 KHz), (N/A, 2700 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.499716] wlan0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 15)
Mar 18 08:59:09 mypc wpa_supplicant[6151]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Mar 18 08:59:09 mypc wpa_supplicant[6151]: wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=15
Mar 18 08:59:09 mypc kernel: [ 2501.536289] cfg80211: Calling CRDA to update world regulatory domain
Mar 18 08:59:09 mypc kernel: [ 2501.541764] cfg80211: World regulatory domain updated:
Mar 18 08:59:09 mypc kernel: [ 2501.541770] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 08:59:09 mypc kernel: [ 2501.541775] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541779] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541782] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541786] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541790] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541794] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm)
Mar 18 08:59:10 mypc wpa_supplicant[6151]: wlan0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='aphanumeric_with_underscores' freq=2412 MHz)
Mar 18 08:59:10 mypc kernel: [ 2502.434112] wlan0: authenticate with xx:xx:xx:xx:xx:xx (try 1)
Mar 18 08:59:10 mypc kernel: [ 2502.436071] wlan0: authenticated
etc
e observe que o eth0 funciona bem com o dhcp, então não há problemas com o próprio dhcp.
modificação 2: tente usar o hash psk de wpa_passphrase
$ wpa_passphrase myssid mypassword
network={
ssid="myssid"
#psk="mypassword"
psk=xxxxxxxxxxxx...
}
use este novo psk em /etc/network/interfaces
:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use 'auto wlan0' since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove 'auto wlan0' from this file just to get a
# command prompt again!
iface wlan0 inet dhcp
wpa-ssid "aphanumeric_with_underscores"
wpa-psk xxxxxxxxxxxxxxxx
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
tente novamente:
$ sudo iplink set wlan0 down
$ sudo iplink set wlan0 up
$ sudo ifup wlan0
cat: /var/run/wpa_supplicant.wlan0.pid: No such file or directory
Operation failed.
Failed to bring up wlan0.
hmm erro interessante nesse momento. investigar:
$ sudo su
# cd /var/run/wpa_supplicant/
# ls -l
total 0
srwxrwx--- 1 root root 0 Mar 18 09:26 wlan0
# cat wlan0
cat: wlan0: No such device or address
/var/log/syslog
ainda está apresentando os mesmos erros.
modificação 3: defina um ssid e uma senha muito básicos
eu defino o ssid para abc
e senha para abcdefgh
:
$ wpa_passphrase abc abcdefgh
network={
ssid="abc"
#psk="abcdefgh"
psk=ba89407e92b8efec11c227e3cce9f25c8dcc4b3651fe2be02d91d9ebda96e913
}
mas os resultados são os mesmos que para a modificação 1 e a modificação 2, não importa qual dessas chaves pré-compartilhadas eu coloquei em /etc/network/interfaces
$ sudo ip link set wlan0 down
$ sudo ip link set wlan0 up
$ sudo ip link show wlan0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DORMANT mode DEFAULT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
$ sudo ifdown wlan0
ifdown: interface wlan0 not configured
$ sudo rm /var/run/wpa_supplicant/wlan0
$ sudo ifup wlan0
wpa_supplicant: ctrl_interface socket not found at /var/run/wpa_supplicant/wlan0
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Operation failed.
Failed to bring up wlan0.
modificação 4: use o wpa_supplicant no modo de depuração na linha de comando
remova todas as configurações do wpa de /etc/network/interfaces
:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface wlan0 inet dhcp
agora crie o arquivo wpa_supplicant.conf
:
$ sudo sh -c 'wpa_passphrase abc abcdefgh > /etc/wpa_supplicant/wpa_supplicant.conf'
edite o arquivo para conter as seguintes informações:
ap_scan=1
ctrl_interface=DIR=/var/run/wpa_supplicant
ctrl_interface_group=0
network={
proto=WPA2
pairwise=CCMP
group=CCMP
key_mgmt=WPA-PSK
ssid="abc"
#psk="abcdefgh"
psk=ba89407e92b8efec11c227e3cce9f25c8dcc4b3651fe2be02d91d9ebda96e913
}
execute wpa_supplicant
diretamente:
$ sudo ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
$ sudo ip link set wlan0 up
$ sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:00:00:00:00:00
wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:00:00:00:00:00
wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWSCAN]: Device or resource busy
wlan0: Failed to initiate AP scan
wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:00:00:00:00:00
wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
^Cwlan0: CTRL-EVENT-TERMINATING - signal 2 received
e novamente, com um pouco mais de verbosidade de depuração:
$ sudo wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -f /tmp/wpa_supplicant.tl-wn881nd.errors
veja a saída aqui .
de ioctl[SIOCSIWENCODEEXT]: Invalid argument
, parece que pode haver uma incompatibilidade entre a placa wifi e o kernel? se sim, então como posso diagnosticar e corrigir isso?