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:
- turn off network manager service as it interferes with virtual interfaces
- turn down wlan0 using ifconfig wlan0 down
- create access point interface and assign it a different mac and ip address
- turn on hostapd at this access interface
- 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
- turn on dnsmasq at the access interface.
- create new interface assign it separate mac address and connect it to the network by assigning essid and using dhclient to obtain ip address.
- 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