#Wifi hotspot with Edimax 7811Un and Raspberry Pi 2 (Raspbian Wheezy) adapted from: http://prograssing.com/news/how-to-setup-a-wlan-hotspot-with-rasperry-pi-2-edimax-7811un-and-huawei-e3372/ and: https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/ ##Step 1: Hostapd for Edimax EW 7811Un sudo apt-get install hostapd dnsmasq wget http://www.juergenkeil.de/download/hostapd-2.2.rtl871xdrv.gz gunzip hostapd-2.2.rtl871xdrv.gz sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.orig sudo mv hostapd-2.2.rtl871xdrv /usr/sbin/hostapd-2.2.rtl871xdrv sudo chmod +x !$ sudo ln -s !$ /usr/sbin/hostapd ##Step 2: Hostapd configuration # 2.1 sudo nano /etc/default/hostapd Change this: #DAEMON_CONF="" With this: DAEMON_CONF="/etc/hostapd/hostapd.conf" ctrl-X + O #save modification # 2.2 configuration file sudo nano /etc/hostapd/hostapd.conf ------------------- /!\ Important parts: driver=rtl871xdrv noscan=1 ------------------- Content: # the name of the WiFi interface we configure interface=wlan0 # we use the specific driver for the Edimax 7811Un driver=rtl871xdrv # the name of the hotspot ssid=Raspoid country_code=BE # use channel 6 channel=6 # QoS support wmm_enabled=1 # WPA2 only wpa=2 # 1=wpa, 2=wep, 3=both auth_algs=1 # the network passphrase wpa_passphrase=jaWPZ57t8nvR # use a pre-shared key wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP wpa_pairwise=CCMP # use AES, instead of TKIP rsn_pairwise=CCMP # accept all MAC addresses macaddr_acl=0 eap_server=0 eapol_key_index_workaround=0 own_ip_addr=127.0.0.1 # use the 2.4GHz band hw_mode=g ieee80211d=1 # 802.11n support ieee80211n=1 ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+][DSSS_CCK-40][MAX-AMSDU-7935] #noscan=1 eap_reauth_period=0 max_num_sta=8 beacon_int=100 # 2.3 configure wlan0 interface sudo nano /etc/network/interfaces ##Step 3: Dnsmasq Configuration #Backup of default conf. sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo nano /etc/dnsmasq.conf Content: interface=wlan0 # Use interface wlan0 bind-interfaces # Bind to the interface to make sure we aren't sending things elsewhere server=8.8.8.8 # Forward DNS requests to Google DNS domain-needed # Don't forward short names bogus-priv # Never forward addresses in the non-routed address spaces. dhcp-range=192.168.0.50,192.168.0.150,12h # Assign IP addresses between 192.168.0.50 and 192.168.0.150 with a 12 hour lease time # Step 4: enable ipv4 forwarding sudo nano /etc/sysctl.conf Simply uncomment the following line: #net.ipv4.ip_forward=1 # Step 5: Share internet connection from eth0 We need to configure a NAT between our wlan0 interface and our eth0 interface. We can do this using the following commands: 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