User Tools

Site Tools


linux:network:access_point_-_hostapd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:network:access_point_-_hostapd [2013/07/09 16:22]
tkilla created
linux:network:access_point_-_hostapd [2013/09/11 23:56] (current)
tkilla
Line 18: Line 18:
 "depends: ath9k_hw,mac80211,ath9k_common,ath,cfg80211" "depends: ath9k_hw,mac80211,ath9k_common,ath,cfg80211"
  
-in this case, "mac80211" is supported+..in this case, "mac80211" is supported
  
  
Line 24: Line 24:
  
   apt-get update   apt-get update
-  apt-get install hostapd dnsmasq +  apt-get install hostapd dnsmasq rcconf
-   +
-===== Configure hostapd =====+
  
  
-Edit /etc/hostapd/hostapd.conf+===== Configure hostapd ===== 
 + 
 +Edit **/etc/hostapd/hostapd.conf**
  
 **First test:** **First test:**
Line 37: Line 37:
   ssid=test   ssid=test
   channel=1    channel=1 
 +
 +Scan for wlans and check, if the SSID "test" is visible.
 +
  
 **Complete config** **Complete config**
  
-change SSID, wpa_passphrase and channel+Change SSID, wpa_passphrase and channel:
  
   interface=wlan0   interface=wlan0
Line 55: Line 58:
   wpa_pairwise=TKIP   wpa_pairwise=TKIP
   rsn_pairwise=CCMP   rsn_pairwise=CCMP
 +
 +
 +===== Configure network interfaces =====
 +
 +Edit **/etc/network/interfaces**:
 +
 +  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 its easier to configure than dhcpd+dnsmasq is used, because it is easier to configure than dhcpd
  
-Edit /etc/dnsmasq.conf and add:+Edit **/etc/dnsmasq.conf** and add:
  
   # disables dnsmasq reading any other files like /etc/resolv.conf for nameservers   # disables dnsmasq reading any other files like /etc/resolv.conf for nameservers
Line 70: Line 92:
   dhcp-range=10.0.0.3,10.0.0.20,12h   dhcp-range=10.0.0.3,10.0.0.20,12h
      
-  # dns addresses to send to the clients - USE GOOGLE DNS-SERVERS+  # dns addresses to send to the clients 
 +  # GOOGLE DNS-SERVERS are used here for testing! - you can set this to DNS servers of your provider or use your gateway
   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 on boot =====
  
-  #!/bin/bash +Download this init script: {{:linux:network:hostapinit.txt|}} 
-  #Initial wifi interface configuration +and save it to **/etc/init.d/hostapdinit** 
-  ifconfig $1 up 10.0.0.1 netmask 255.255.255.0 + 
-  sleep 2 +Run the rcconf runlevel init script configuration tool and enable "hostapdinit" 
-   + 
-  ###########Start dnsmasq, modify if required########## +  rcconf
-  if [ -z "$(ps -e grep dnsmasq)" ] +
-  then +
-   dnsmasq +
-  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 /etc/hostapd/hostapd.conf 1> /dev/null +
-  #killall dnsmasq+
  
 +reboot & good luck
  
 ===== Source ===== ===== Source =====
linux/network/access_point_-_hostapd.1373379749.txt.gz · Last modified: 2013/07/09 16:22 by tkilla