#1 Le 12/03/2013, à 14:02
- wysiwyg31
Reconnexion automatique avec WPA supplicant
Hello !
J'ai un raspberry pi sous raspbian connecté en réseau par wifi (je pense que la config est similaire sur ce point à un ubuntu serveur).
J'ai suivi les explications ici http://doc.ubuntu-fr.org/wpa pour connecter la bouzin à la freebox en wpa.
Quand je reboote le raspberry, aucun soucis, il se reconnecte tout seul au wifi.
Par contre, si je reboote la box (freebox v5 non degroupé, ca met assez longtemps,plusieurs minutes), le raspberry ne recupere pas tout seul le wifi.
Comme c'est une machine headless (pas d'ecran, pas de clavier), il ne reste plus qu'à faire un hard reset pour la reconnecter au reseau...
Y a til un autre moyen ??
Hors ligne
#2 Le 12/03/2013, à 14:21
- Haleth
Re : Reconnexion automatique avec WPA supplicant
La page de doc donne 15 méthodes.
Concrétement, comment tu fais ?
Chez moi, je balance wpa_supplicant avec la bonne conf, et il spool régulièrement lorsqu'il ne trouve pas le réseau
Ubuntu is an ancien African word which means "I can't configure Debian"
Because accessor & mutator are against encapsulation (one of OOP principles), good OOP-programmers do not use them. Obviously, procedural-devs do not. In fact, only ugly-devs are still using them.
Hors ligne
#3 Le 12/03/2013, à 14:24
- toutafai
Re : Reconnexion automatique avec WPA supplicant
Bonjour,
La doc que tu as suivi ,bien qu'encore foinctionnelle, est obsolète. essaye de modifier ton fichier /etc/network/interfaces pour le faire ressembler a cela :
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
reboot ton rasberry et fait le test de reboot de ta freebox pour voir si ton rasberry se reconnecte ou pas...
Tombé dans l'informatique étant petit, j'en ai fait mon métier. Utilisateur d'Ubuntu depuis novembre 2006, actuellement sous 20.04 x64 (Que d'évolution
depuis Dapper Drake ! Ça rajeunit pas ^^^).
Hors ligne
#4 Le 12/03/2013, à 14:27
- Haleth
Re : Reconnexion automatique avec WPA supplicant
(t'as confondu eth & wlan: le wireless requiert les paramètres de l'access point)
Ubuntu is an ancien African word which means "I can't configure Debian"
Because accessor & mutator are against encapsulation (one of OOP principles), good OOP-programmers do not use them. Obviously, procedural-devs do not. In fact, only ugly-devs are still using them.
Hors ligne
#5 Le 12/03/2013, à 15:48
- wysiwyg31
Re : Reconnexion automatique avec WPA supplicant
Bonjour, Oui, désolé ! j'attendais qu'on me reboote la machine pour pouvoir y aller en ssh et recuperer le contenu des fichiers de config, les voici:
/etc/network/interface:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface default inet dhcp
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
J'ai ajouté les 3 dernières lignes. J'avoue que ce fichier ne m'est pas très parlant.
/etc/wpa_supplicant/wpa_supplicant.conf :
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
network={
ssid="monhotspot"
scan_ssid=1 # nécessaire quand le ssid n'est pas diffusé
proto=WPA RSN
key_mgmt=WPA-PSK
psk="monpassword"
}
(avec"monhostpot" et "monpassword" paramétré correctement, la connexion fonctionne d'ailleurs, sans quoi, je n'aurais pas pu vous copier coller le contenu de ces fichiers.)
J'ai jeté un oeil au syslog, une douzaine de ligne en quelques secondes, mais rien apres:
Mar 12 08:55:05 raspberrypi ifplugd(wlan0)[1599]: Link beat lost.
Mar 12 08:55:07 raspberrypi wpa_supplicant[1605]: wlan0: CTRL-EVENT-DISCONNECTED bssid=36:e0:1d:51:62:00 reason=0
Mar 12 08:55:15 raspberrypi ifplugd(wlan0)[1599]: Executing '/etc/ifplugd/ifplugd.action wlan0 down'.
Mar 12 08:55:16 raspberrypi dhclient: Internet Systems Consortium DHCP Client 4.2.2
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: Internet Systems Consortium DHCP Client 4.2.2
Mar 12 08:55:16 raspberrypi dhclient: Copyright 2004-2011 Internet Systems Consortium.
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: Copyright 2004-2011 Internet Systems Consortium.
Mar 12 08:55:16 raspberrypi dhclient: All rights reserved.
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: All rights reserved.
Mar 12 08:55:16 raspberrypi dhclient: For info, please visit https://www.isc.org/software/dhcp/
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: For info, please visit https://www.isc.org/software/dhcp/
Mar 12 08:55:16 raspberrypi dhclient:
Mar 12 08:55:16 raspberrypi dhclient: Listening on LPF/wlan0/a0:f3:d6:62:09:c1
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: Listening on LPF/wlan0/a0:f3:d6:62:09:c1
Mar 12 08:55:16 raspberrypi dhclient: Sending on LPF/wlan0/a0:f3:d6:62:09:c1
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: Sending on LPF/wlan0/a0:f3:d6:62:09:c1
Mar 12 08:55:16 raspberrypi dhclient: Sending on Socket/fallback
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: Sending on Socket/fallback
Mar 12 08:55:16 raspberrypi dhclient: DHCPRELEASE on wlan0 to 192.168.0.254 port 67
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: client: DHCPRELEASE on wlan0 to 192.168.0.254 port 67
Mar 12 08:55:16 raspberrypi wpa_supplicant[1605]: wlan0: CTRL-EVENT-TERMINATING - signal 15 received
Mar 12 08:55:16 raspberrypi ifplugd(wlan0)[1599]: Program executed successfully.
Hors ligne
#6 Le 12/03/2013, à 15:51
- wysiwyg31
Re : Reconnexion automatique avec WPA supplicant
J'oubliais: j'ai suivi la méthode §3.4 2# Méthode Complète et Propre :
http://doc.ubuntu-fr.org/wpa#methode_complete_et_propre
Hors ligne
#7 Le 27/03/2013, à 20:20
- wysiwyg31
Re : Reconnexion automatique avec WPA supplicant
Pas de solution ?
Je me disais: peut etre qu'une ou deux instruction bien placées dans un fichier cron pour forcer une reconnexion de temps en temps si on la perd ??
Hors ligne
#8 Le 27/03/2013, à 20:25
- Haleth
Re : Reconnexion automatique avec WPA supplicant
J'te donne ma solution:
18% [alex:~] cat /etc/rc.local
[...]
/sbin/wpa_supplicant -Dnl80211 -i wlan0 -c/etc/wpa_supplicant.conf -d &
dhclient -v wlan0
18% [alex:~] cat /etc/network/interface
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
18% [alex:~] cat /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=1
network={
ssid="machin"
proto=RSN
key_mgmt=NONE
wep_key0=key
id_str="home"
priority=1
}
network={
ssid="truc"
key_mgmt=NONE
priority=5
}
Ubuntu is an ancien African word which means "I can't configure Debian"
Because accessor & mutator are against encapsulation (one of OOP principles), good OOP-programmers do not use them. Obviously, procedural-devs do not. In fact, only ugly-devs are still using them.
Hors ligne
#9 Le 27/03/2013, à 20:36
- wysiwyg31
Re : Reconnexion automatique avec WPA supplicant
ca n'a pas l'air très different de ma config, le truc c'est que si je reboote la machine ca marche bien, mais si je reboote la box, la machine ne se reconnecte pas toute seule.
J'ai trouvé une piste ici (je ne suis pas le seul apparement) :
Ils proposent un script comme ceci:
#!/bin/bash
while true ; do
if ifconfig wlan0 | grep -q "inet addr:" ; then
sleep 60
else
echo "Network connection down! Attempting reconnection."
ifup --force wlan0
sleep 10
fi
done
Il faut l'adapter un peu pour le mettre dans un cron toutes les 5 minutes par ex, je pensais à ca (j'enleve le while et les sleeps):
#!/bin/bash
if ifconfig wlan0 | grep -q "inet addr:" ; then
echo"Network ok";
else
echo "Network connection down! Attempting reconnection."
ifup --force wlan0
fi
done
Hors ligne
#10 Le 27/03/2013, à 20:39
- Haleth
Re : Reconnexion automatique avec WPA supplicant
Ouais
La différence, c'est que ton wpa se fait kill par quelqu'un (ifdown ?) alors que le mien est indépendant. Il pool sans arrêt, tant qu'il n'a pas de connexion.
Ubuntu is an ancien African word which means "I can't configure Debian"
Because accessor & mutator are against encapsulation (one of OOP principles), good OOP-programmers do not use them. Obviously, procedural-devs do not. In fact, only ugly-devs are still using them.
Hors ligne