3

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.

After doing some research, I found this tutorial, Click here.

I try to follow the answer provided adityap174:

  1. turn off network manager service as it interferes with virtual interfaces
  2. turn down wlan0 using ifconfig wlan0 down
  3. create access point interface and assign it a different mac and ip address
  4. turn on hostapd at this access interface
  5. 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
  6. turn on dnsmasq at the access interface.
  7. create new interface assign it separate mac address and connect it to the network by assigning essid and using dhclient to obtain ip address.
  8. if necessary perform ip masquerading through iptables command

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.

Software I install: hostapd and dnsmasq

I use wlan0 as station and myAcc as AP.

My command:

 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 > /etc/iptables.ipv4.nat
 iptables-restore < /etc/iptables.ipv4.nat 
 sudo service dnsmasq start 

In hostapd.conf:

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

In dnsmasq.conf:

interface=wlan0
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv 
dhcp-range=172.24.1.50,172.24.1.150,12h

In sysctl.conf, net.ipv4.ip_forward has set to 1

4

2 回答 2

3

This post has solution for your question. It configures Raspberry Pi with 1 Access Point and many wireless connections.

It explains which lines to edit in hostapd and dnsmasq.

于 2017-08-04T07:06:10.497 回答
1

Try to install isc-dhcp-server

sudo apt-get install isc-dhcp-server

To have a dhcp server on your interface you want to use as access point. You can see this and learn how to configure it:

https://help.ubuntu.com/community/isc-dhcp-server

于 2016-06-02T14:21:36.707 回答