[Toulibre] S O S Raspberry Pi comme hotspot WiFi - RÉSOLU :-)
jlp
jlp31 at free.fr
Mar 4 Fév 18:24:35 CET 2014
bonsoir
si ça peut profiter à d'autres :
FICHIER /etc/network/interfaces QUI NE FONCTIONNE PAS :
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
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
up iptables-restore < /etc/iptables.ipv4.nat
FICHIER /etc/network/interfaces QUI FONCTIONNE :
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
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
up iptables-restore < /etc/iptables.ipv4.nat
honteux d'avoir dû faire le singe... :-(
JLP
Le vendredi 31 janvier 2014 19:43:57 jlp a écrit :
> bonsoir
>
> en suivant quelques tutos j'ai connecté un TP-LINK TL-WN722N sur
> un Raspberry Pi sur lequel était déjà installé un serveur https
>
> je peux me connecter avec une tablette android qui prend l'adresse
> 10.0.0.22 (ça déconne déjà, voir plus bas)
>
> avec la tablette android je peux surfer en https sur le serveur web
> du Raspberry Pi
>
> mais je ne peux pas aller sur internet avec la tablette android
>
> je n'arrive plus à voir quelle connerie j'ai pu faire, c'est d'autant
> plus pénible que ça avait fonctionné du premier coup l'année
> dernière...
>
> toute aide bienvenue, merci !
>
> JLP
>
>
>
>
> sudo apt-get -y install hostapd udhcpd
>
> brancher le TP-LINK TL-WN722N
>
> sudo vi /etc/network/interfaces
> iface wlan0 inet static
> address 10.0.0.1
> netmask 255.255.255.0
>
> 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
> up iptables-restore < /etc/iptables.ipv4.nat
>
> sudo vi /etc/iptables.ipv4.nat
> # Generated by iptables-save v1.4.14 on Fri Jan 31 16:05:36 2014
> *filter
>
> :INPUT ACCEPT [8:416]
> :FORWARD ACCEPT [0:0]
> :OUTPUT ACCEPT [8:1408]
>
> -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j
> ACCEPT -A FORWARD -i wlan0 -o eth0 -j ACCEPT
> COMMIT
> # Completed on Fri Jan 31 16:05:36 2014
> # Generated by iptables-save v1.4.14 on Fri Jan 31 16:05:36 2014
> *nat
>
> :PREROUTING ACCEPT [0:0]
> :INPUT ACCEPT [0:0]
> :OUTPUT ACCEPT [1:196]
> :POSTROUTING ACCEPT [0:0]
>
> -A POSTROUTING -o eth0 -j MASQUERADE
> COMMIT
> # Completed on Fri Jan 31 16:05:36 2014
>
> sudo vi /etc/hostapd/hostapd.conf
> interface=wlan0
> ssid=MY_SSID
> hw_mode=g
> channel=6
> auth_algs=1
> wmm_enabled=0
>
> wpa=2
> wpa_passphrase=MY_PASSWORD
> wpa_key_mgmt=WPA-PSK
> wpa_pairwise=TKIP
> rsn_pairwise=CCMP
>
> sudo vi /etc/default/hostapd
> DAEMON_CONF="/etc/hostapd/hostapd.conf"
>
> sudo vi /etc/sysctl.conf
> kernel.printk = 3 4 1 3
> net.ipv4.ip_forward=1
> vm.swappiness=1
> vm.min_free_kbytes = 8192
>
> sudo vi /etc/default/udhcpd
> # Comment the following line to enable
> # DHCPD_ENABLED="no"
>
> # Options to pass to busybox' udhcpd.
> #
> # -S Log to syslog
> # -f run in foreground
>
> DHCPD_OPTS="-S"
>
> sudo vi /etc/udhcpd.conf
> # Sample udhcpd configuration file (/etc/udhcpd.conf)
>
> # The start and end of the IP lease block
>
> start 10.0.0.100 # start 192.168.0.20 #default:
> 192.168.0.20 end 10.0.0.199 # end 192.168.0.254 #default:
> 192.168.0.254
>
>
> # The interface that udhcpd will use
>
> interface wlan0 # interface eth0 #default: eth0
>
>
> # The maximim number of leases (includes addressesd reserved
> # by OFFER's, DECLINE's, and ARP conficts
>
> #max_leases 254 #default: 254
>
>
> # If remaining is true (default), udhcpd will store the time
> # remaining for each lease in the udhcpd leases file. This is
> # for embedded systems that cannot keep time between reboots.
> # If you set remaining to no, the absolute time that the lease
> # expires at will be stored in the dhcpd.leases file.
>
> #remaining yes #default: yes
>
>
> # The time period at which udhcpd will write out a dhcpd.leases
> # file. If this is 0, udhcpd will never automatically write a
> # lease file. (specified in seconds)
>
> #auto_time 7200 #default: 7200 (2 hours)
>
>
> # The amount of time that an IP will be reserved (leased) for if a
> # DHCP decline message is received (seconds).
>
> #decline_time 3600 #default: 3600 (1 hour)
>
>
> # The amount of time that an IP will be reserved (leased) for if an
> # ARP conflct occurs. (seconds
>
> #conflict_time 3600 #default: 3600 (1 hour)
>
>
> # How long an offered address is reserved (leased) in seconds
>
> #offer_time 60 #default: 60 (1 minute)
>
> # If a lease to be given is below this value, the full lease time is
> # instead used (seconds).
>
> #min_lease 60 #defult: 60
>
>
> # The location of the leases file
>
> #lease_file /var/lib/misc/udhcpd.leases #defualt:
> /var/lib/misc/udhcpd.leases
>
> # The location of the pid file
> #pidfile /var/run/udhcpd.pid #default: /var/run/udhcpd.pid
>
> # Everytime udhcpd writes a leases file, the below script will be called.
> # Useful for writing the lease file to flash every few hours.
>
> #notify_file #default: (no script)
>
> #notify_file dumpleases # <--- useful for debugging
>
> # The following are bootp specific options, setable by udhcpd.
>
> #siaddr 192.168.0.22 #default: 0.0.0.0
>
> #sname zorak #default: (none)
>
> #boot_file /var/nfs_root #default: (none)
>
> # The remainer of options are DHCP options and can be specifed with the
> # keyword 'opt' or 'option'. If an option can take multiple items, such
> # as the dns option, they can be listed on the same line, or multiple
> # lines. The only option with a default is 'lease'.
>
> #Examles
> opt dns 212.27.48.10 # opt dns 192.168.10.2 192.168.10.10
> option subnet 255.255.255.0
> opt router 10.0.0.1 # opt router 192.168.10.2
> # opt wins 192.168.10.10
> # option dns 129.219.13.81 # appened to above DNS servers
> for a total of 3 option domain local
> option lease 864000 # 10 days of seconds
>
>
> # Currently supported options, for more info, see options.c
> #opt subnet
> #opt timezone
> #opt router
> #opt timesrv
> #opt namesrv
> #opt dns
> #opt logsrv
> #opt cookiesrv
> #opt lprsrv
> #opt bootsize
> #opt domain
> #opt swapsrv
> #opt rootpath
> #opt ipttl
> #opt mtu
> #opt broadcast
> #opt wins
> #opt lease
> #opt ntpsrv
> #opt tftp
> #opt bootfile
> #opt wpad
>
> # Static leases map
> #static_lease 00:60:08:11:CE:4E 192.168.0.54
> #static_lease 00:60:08:11:CE:3E 192.168.0.44
>
> sudo service hostapd restart
>
> sudo service udhcpd restart
--
--------8<--------8<--------8<--------8<--------8<--------
Jean-Louis Patané
jlp31 at free.fr
http://jlp31.free.fr/cv.html
DES OUTILS GRATUITS POUR PROMOUVOIR MON CV :
http://jlp31.free.fr/cvware/index.html
LA MUSIQUE ADOUCIT LES MOEURS :
http://junkofunk.free.fr/
http://jlpmusic.free.fr/
http://eindharmoniemuret.free.fr/
http://harmoniedauterive.free.fr/
http://jlp31.free.fr/musique.html
--------8<--------8<--------8<--------8<--------8<--------
Plus d'informations sur la liste de diffusion Toulouse-ll