^ Internet
|
+--------+-------+
|Livebox |
|----------------|
|192.168.1.1 |
+---+DHCP |
| +----------------+ +-----------------+
| |Ordinateur |
| |-----------------|
|Filaire +-------->|192.168.2.10 |
| | +-----------------+
| +--------------------+ |
| |Raspberry Pi | |
| |--------------------| |Sans-fil
| |stationpa | |
+---+eth0:192.168.1.16 | |
|wlan0:192.168.2.1 | | +----------------+
| DHCP+---+ |Téléphone |
+--------------------+ | |----------------|
+-------->|192.168.2.11 |
+----------------+
1) Ajout de la clé ssh publique :
[~] ➔ ssh-copy-id -i ~/.ssh/id_rsa.pub pi@192.168.1.16
[~] ➔ ssh pi@192.168.1.16
2) Vérification :
pi@stationpa ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0846:9041 NetGear, Inc. WNA1000M 802.11bgn [Realtek RTL8188CUS]
3) Vérication de la connexion réseau en filaire :
pi@stationpa ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:ee:8f:13
inet adr:192.168.1.16 Bcast:192.168.1.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4040 errors:0 dropped:0 overruns:0 frame:0
TX packets:2866 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:4322690 (4.1 MiB) TX bytes:313040 (305.7 KiB)
wlan0 Link encap:Ethernet HWaddr 10:0d:7f:bd:a9:2b
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
4) Installation de paquetage de base :
pi@stationpa ~ $ sudo apt-get install vim htop links screen mc git
5) Installation d'un serveur Lamp : https://miniordi.hacktech.dev/2013/09/17/installation-dun-serveur-linux-apache-mysql-php/ 6) Installation du paquetage de gestion de point d'accés : 6.1) Répertoire de travail :
pi@stationpa ~ $ mkdir HOTSPOT
pi@stationpa ~ $ cd HOTSPOT/
6.2) Récupération du code source :
pi@stationpa ~/HOTSPOT $ git clone https://github.com/jenssegers/RTL8188-hostapd.git
pi@stationpa ~/HOTSPOT $ cd RTL8188-hostapd/hostapd/
6.3) Compilation :
pi@stationpa ~/HOTSPOT/RTL8188-hostapd/hostapd $ sudo make
6.4) Installation :
pi@stationpa ~/HOTSPOT/RTL8188-hostapd/hostapd $ sudo make install
pi@stationpa ~/HOTSPOT/RTL8188-hostapd/hostapd $ cd
pi@stationpa ~ $
Lien : http://jenssegers.be/blog/43/Realtek-RTL8188-based-access-point-on-Raspberry-Pi 7) Configuration de l'interface : Ouvrir :
/etc/network/interfaces
Chercher :
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Remplacer par :
auto lo
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet static
address 192.168.2.1
netmask 255.255.255.0
8) Configuration du fichier du point d'accés : Configuration pour un réseau sans-fil ouvert.
pi@stationpa ~ $ sudo cp /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.orig
Ouvrir :
/etc/hostapd/hostapd.conf
Ajouter :
interface=wlan0
ssid=stationpa
channel=10
auth_algs=1
driver=rtl871xdrv
ieee80211n=1
hw_mode=g
device_name=RTL8192CU
manufacturer=Realtek
Ouvrir :
/etc/default/hostapd
Chercher :
#DAEMON_CONF=""
Remplacer par :
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Ouvrir :
/etc/sysctl.conf
Chercher :
#net.ipv4.ip_forward=1
Remplacer par :
net.ipv4.ip_forward=1
9) Installation du paquetage de service DHCP/DNS :
pi@stationpa ~ $ sudo apt-get install dnsmasq
10) Configuration : Ouvrir :
/etc/dnsmasq.conf
Supprimer tout. Ajouter :
interface=wlan0
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-authoritative
dhcp-option=1,255.255.255.0
dhcp-option=3,192.168.2.1 # default gateway
dhcp-option=6,192.168.2.1 # dns server
dhcp-range=192.168.2.10,192.168.2.99,255.255.255.0,72h
log-queries
log-dhcp
log-facility=/var/log/dnsmasq
11) Lancement du serveur hotspotd :
pi@stationpa ~ $ sudo service hostapd restart
[ ok ] Stopping advanced IEEE 802.11 management: hostapd.
[ ok ] Starting advanced IEEE 802.11 management: hostapd.
12) Mettre une adresse ip sur le sans-fil :
pi@stationpa ~ $ sudo ifconfig wlan0 up
pi@stationpa ~ $ sudo ifconfig wlan0 192.168.2.1
13) Vérification :
pi@stationpa ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:ee:8f:13
inet adr:192.168.1.16 Bcast:192.168.1.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5636 errors:0 dropped:0 overruns:0 frame:0
TX packets:4075 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:4444761 (4.2 MiB) TX bytes:545946 (533.1 KiB)
wlan0 Link encap:Ethernet HWaddr 10:0d:7f:bd:a9:2b
inet adr:192.168.2.1 Bcast:192.168.2.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
14) Lancement du DHCP :
pi@stationpa ~ $ sudo service dnsmasq restart
[ ok ] Restarting DNS forwarder and DHCP server: dnsmasq.
15) Connexion avec un téléphone portable ou un ordinateur portable sur le point d'accés : stationpa Adresse réseau : <192.168.2.1> 16) Liens : http://lookingfora.name/2012/12/08/raspberry-pi-creer-un-point-dacces-wifi-avec-portail-captif/ http://www.magdiblog.fr/boa-pi-carjukebox/configuration-reseau-et-point-dacces-wifi/ http://famory-toure.blogspot.fr/2013/05/raspberry-comme-hotspot-wifi.html