title: Raspberry PI 3: Wireless hotspot (from WiFi to WiFi instead of ethernet to WiFi)
body: <p>I would like to turn my Raspberry PI 3 into something like WiFi signal amplifier, Wireless repeater/extender or WiFi hotspot which can amplify weak WiFi signal.</p>
  
  <p>After doing some research, I found this tutorial, Click <a href="https://superuser.com/questions/615664/creating-wifi-access-point-on-a-single-interface-in-linux" title="this text appears when you mouse over">here</a>.</p>
  
  <p>I try to follow the answer provided adityap174:</p>
  
  <ol>
  <li>turn off network manager service as it interferes with virtual interfaces</li>
  <li>turn down wlan0 using ifconfig wlan0 down</li>
  <li>create access point interface and assign it a different mac and ip address</li>
  <li>turn on hostapd at this access interface</li>
  <li>use dnsmasq to assign the connecting clients at this interface, ip addresses and give the default gateway as the ip of the station interface to be created</li>
  <li>turn on dnsmasq at the access interface.</li>
  <li>create new interface assign it separate mac address and connect it to the network by assigning essid and using dhclient to obtain ip address.</li>
  <li>if necessary perform ip masquerading through iptables command</li>
  </ol>
  
  <p>I creates the new interface and the AP appears perfectly, but I fail to obtain the IP address when I try to connect the AP.</p>
  
  <p>Software I install: hostapd and dnsmasq</p>
  
  <p>I use wlan0 as station and myAcc as AP. </p>
  
  <p>My command:</p>
  
  <pre><code> sudo systemctl disable NetworkManager.service
   sudo ifconfig wlan0 down 192.168.27.1 up
   sudo iw phy phy0 interface add myAcc type __ap
   sudo ifconfig myAcc hw ether A4:17:FE:6E:00:53
   sudo ifconfig myAcc 192.168.27.1 up
   sudo nano /etc/hostapd/hostapd.conf
   sudo service hostapd start
  
   sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig  
   sudo nano /etc/dnsmasq.conf 
   sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE  
   sudo iptables -A FORWARD -i wlan0 -o myAcc -m state --state RELATED,ESTABLISHED -j ACCEPT  
   sudo iptables -A FORWARD -i myAcc -o wlan0 -j ACCEPT
   sudo sh -c "iptables-save &gt; /etc/iptables.ipv4.nat
   iptables-restore &lt; /etc/iptables.ipv4.nat 
   sudo service dnsmasq start 
  </code></pre>
  
  <p>In hostapd.conf:</p>
  
  <pre><code>interface=myAcc 
  driver=nl80211
  ssid=AP001
  hw_mode=g
  channel=6
  wmm_enabled=1
  ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
  macaddr_acl=0
  auth_algs=1
  ignore_broadcast_ssid=0
  wpa=2
  wpa_key_mgmt=WPA-PSK
  wpa_passphrase=12345678
  rsn_pairwise=CCMP
  </code></pre>
  
  <p>In dnsmasq.conf:</p>
  
  <pre><code>interface=wlan0
  bind-interfaces
  server=8.8.8.8
  domain-needed
  bogus-priv 
  dhcp-range=172.24.1.50,172.24.1.150,12h
  </code></pre>
  
  <p>In sysctl.conf, net.ipv4.ip_forward has set to 1</p>