Skip to content

Instantly share code, notes, and snippets.

@gbleu
Last active November 10, 2015 13:53
Show Gist options
  • Save gbleu/98b2ecf711c1f15a8257 to your computer and use it in GitHub Desktop.
Save gbleu/98b2ecf711c1f15a8257 to your computer and use it in GitHub Desktop.
# http://raspberrypihq.com/how-to-turn-a-raspberry-pi-into-a-wifi-router/
# http://fspot.org/plk/piratebox-raspberry-pi.html
# http://fspot.org/plk/hotspot-wifi.html
sudo apt-get install rpi-update
sudo rpi-update
sudo apt-get update
sudo apt-get upgrade
dmesg | more
sudo apt-get install iw
iw list
# Supported interface modes: AP
sudo apt-get install hostapd
sudo touch /etc/hostapd/hostapd.conf
sudo nano /etc/hostapd/hostapd.conf
# http://doc.ubuntu-fr.org/hostapd
# Paste hostapd.conf
sudo nano /etc/default/hostapd
# DAEMON_CONF="/etc/hostapd/hostapd.conf"
sudo apt-get install isc-dhcp-server
sudo nano /etc/dhcp/dhcpd.conf
sudo nano /etc/default/isc-dhcp-server
# INTERFACES="wlan0"
sudo ifdown wlan0
sudo nano /etc/network/interfaces
# Paste interfaces
# http://sirlagz.net/2013/02/10/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-3b/
sudo nano /etc/default/ifplugd
# INTERFACES="eth0"
# HOTPLUG_INTERFACES="eth0"
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
sudo nano /etc/sysctl.conf
# net.ipv4.ip_forward=1
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo ifup wlan0
sudo service isc-dhcp-server start
sudo service hostapd start
sudo update-rc.d hostapd enable
sudo update-rc.d isc-dhcp-server enable
# interface wlan du Wi-Fi
interface=wlan0
# nl80211 avec tous les drivers Linux mac80211
driver=nl80211
# Nom du spot Wi-Fi
ssid=XXX
# mode Wi-Fi (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
hw_mode=g
# canal de fréquence Wi-Fi (1-14)
channel=6
# wpa2
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=XXX
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# Beacon interval in kus (1.024 ms)
beacon_int=100
# DTIM (delivery trafic information message)
dtim_period=2
# Maximum number of stations allowed in station table
max_num_sta=255
# RTS/CTS threshold; 2347 = disabled (default)
rts_threshold=2347
# Fragmentation threshold; 2346 = disabled (default)
fragm_threshold=2346
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.20;
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local-network";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
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 192.168.10.1
netmask 255.255.255.0
up iptables-restore < /etc/iptables.ipv4.nat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment