Lancer l'utilitaire de configuration :
sudo raspi-config
Configurer le réseau Wifi en allant dans le menu « Network Options » puis « Wifi ». Répondre aux questions :
Renseigner le fichier /etc/wpa_supplicant/wpa_supplicant.conf.
Les informations sont à ajouter après les 2 premières lignes :
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR
network={
ssid="xxx"
psk="xxx"
}
Si le Wifi utilise une clef WEP ajouter la ligne suivante après la ligne psk :
key_mgmt=NONE
Pour éviter d'indiquer le mot de passe en clair dans le fichier on utilisera la commande :
sudo wpa_passphrase <SSID>
puis on indiquera le mot de passe correspondant. En réponse on obtiendra une clef PSK à renseigner dans le fichier de configuration à la place du mot de passe en clair.
systemctl stop wpa_supplicant systemctl stop bluetooth systemctl stop hciuart
systemctl disable wpa_supplicant systemctl disable bluetooth systemctl disable hciuart
Ouvrir le fichier /boot/config.txt sur Raspberry PI OS ou /boot/firmware/config.txt sur Ubuntu Mate et ajouter les lignes suivantes après la ligne #Additional overlays and parameters are documented /boot/overlays/README
dtoverlay=disable-wifi dtoverlay=disable-bt
Redémarrer le raspberry PI.
sudo apt install dnsmasq
interface wlan0
static ip_address=192.168.4.1/24
interface=wlan0 dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
sudo apt install hostapd
# This is the name of the WiFi interface we configured above interface=wlan0 # Use the nl80211 driver with the brcmfmac driver driver=nl80211 # This is the name of the network ssid=<SSID du réseau> # Use the 2.4GHz band hw_mode=g # Use channel 6 channel=6 # Enable 802.11n ieee80211n=1 # Enable WMM wmm_enabled=1 # Enable 40MHz channels with 20ns guard interval ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] # Accept all MAC addresses macaddr_acl=0 # Use WPA authentication auth_algs=1 # Require clients to know the network name ignore_broadcast_ssid=0 # Use WPA2 wpa=2 # Use a pre-shared key wpa_key_mgmt=WPA-PSK # The network passphrase wpa_passphrase=<mot de passe> # Use AES, instead of TKIP rsn_pairwise=CCMP
DAEMON_CONF="/etc/hostapd/hostapd.conf"
sudo systemctl unmask hostapd sudo systemctl restart hostapd dnsmasq
Visiblement le hotspot ne démarre pas automatiquement au démarrage du PI. Ajout dans la crontab d'un redémarrage du service 5s après le démarrage.
@reboot sleep 5 && /usr/bin/systemctl restart hostapd
sudo iwlist wlan0 scan | egrep 'Cell |Encryption|Quality|Last beacon|ESSID'