This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
linux:network:access_point_-_hostapd [2013/07/09 16:37] tkilla |
linux:network:access_point_-_hostapd [2013/09/11 23:56] (current) tkilla |
||
---|---|---|---|
Line 18: | Line 18: | ||
" | " | ||
- | in this case, " | + | ..in this case, " |
Line 24: | Line 24: | ||
apt-get update | apt-get update | ||
- | apt-get install hostapd dnsmasq | + | apt-get install hostapd dnsmasq |
- | + | ||
- | ===== Configure hostapd ===== | + | |
- | Edit / | + | ===== Configure hostapd ===== |
+ | |||
+ | Edit **/ | ||
**First test:** | **First test:** | ||
Line 37: | Line 37: | ||
ssid=test | ssid=test | ||
channel=1 | channel=1 | ||
+ | |||
+ | Scan for wlans and check, if the SSID " | ||
+ | |||
**Complete config** | **Complete config** | ||
- | change | + | Change |
interface=wlan0 | interface=wlan0 | ||
Line 55: | Line 58: | ||
wpa_pairwise=TKIP | wpa_pairwise=TKIP | ||
rsn_pairwise=CCMP | rsn_pairwise=CCMP | ||
+ | |||
+ | |||
+ | ===== Configure network interfaces ===== | ||
+ | |||
+ | Edit **/ | ||
+ | |||
+ | auto lo | ||
+ | |||
+ | # configure LAN for DHCP autoconf: | ||
+ | iface lo inet loopback | ||
+ | iface eth0 inet dhcp | ||
+ | | ||
+ | # set a static IP for the WLAN card: | ||
+ | iface wlan0 inet static | ||
+ | address 10.0.0.1 | ||
+ | netmask 255.255.255.0 | ||
+ | | ||
+ | # address of the uplink-router | ||
+ | gateway 192.168.1.1 | ||
===== Configure dnsmasq ===== | ===== Configure dnsmasq ===== | ||
- | This is used, because | + | dnsmasq |
- | Edit / | + | Edit **/ |
# disables dnsmasq reading any other files like / | # disables dnsmasq reading any other files like / | ||
Line 70: | Line 92: | ||
dhcp-range=10.0.0.3, | dhcp-range=10.0.0.3, | ||
| | ||
- | # dns addresses to send to the clients | + | # dns addresses to send to the clients |
+ | # GOOGLE DNS-SERVERS | ||
server=8.8.8.8 | server=8.8.8.8 | ||
server=8.8.4.4 | server=8.8.4.4 | ||
- | ===== Init script to start hostapd ===== | + | ===== Init script to start hostapd |
- | + | ||
- | Save this script to / | + | |
- | + | ||
- | # | + | |
- | #Initial wifi interface configuration | + | |
- | ifconfig $1 up 10.0.0.1 netmask 255.255.255.0 | + | |
- | sleep 2 | + | |
- | + | ||
- | ########### | + | |
- | if [ -z "$(ps -e | grep dnsmasq)" | + | |
- | then | + | |
- | | + | |
- | fi | + | |
- | ########### | + | |
- | + | ||
- | #Enable NAT | + | |
- | iptables --flush | + | |
- | iptables --table nat --flush | + | |
- | iptables --delete-chain | + | |
- | iptables --table nat --delete-chain | + | |
- | iptables --table nat --append POSTROUTING --out-interface $2 -j MASQUERADE | + | |
- | iptables --append FORWARD --in-interface $1 -j ACCEPT | + | |
- | + | ||
- | #Thanks to lorenzo | + | |
- | #Uncomment the line below if facing problems while sharing PPPoE | + | |
- | #iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu | + | |
- | + | ||
- | sysctl -w net.ipv4.ip_forward=1 | + | |
- | + | ||
- | #start hostapd | + | |
- | hostapd / | + | |
- | #killall dnsmasq | + | |
- | + | ||
- | + | ||
- | ===== Run the script ===== | + | |
- | + | ||
- | reboot | + | |
- | + | ||
- | Make the script executable: | + | |
- | chmod a+x /root/bin/ | + | Download this init script: {{: |
+ | and save it to **/etc/init.d/ | ||
- | run the script | + | Run the rcconf runlevel init script |
- | | + | |
+ | reboot & good luck | ||
===== Source ===== | ===== Source ===== |