I had problems with bridge-utils and reading several tutorials I finally got.
This tuturial is pretty much the same as the link above but it works.
Running on RPI-3 fresh and updated Stretch release.
In this case, I use the external adapter wlan1 to connect to my router because the reception is better
being as follows:
- wlan0 is the access point (Rpi internal wifi adapter )
- wlan1 is the client (wifi dongle USB)
Code: Select all
sudo apt-get install dnsmasq hostapd
To configure the static IP address, edit the dhcpcd configuration file with:
Code: Select all
sudo nano /etc/dhcpcd.conf
Code: Select all
interface wlan0
nohook wpa_supplicant
static ip_address=192.168.4.1/24
Code: Select all
sudo service dhcpcd restart
Code: Select all
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf
Code: Select all
interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
Code: Select all
sudo nano /etc/hostapd/hostapd.conf
Code: Select all
interface=wlan0
driver=nl80211
ssid=NameOfNetwork
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mypassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
We now need to tell the system where to find this configuration file.
Code: Select all
sudo nano /etc/default/hostapd
Code: Select all
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Code: Select all
sudo systemctl start hostapd
sudo systemctl start dnsmasq
Code: Select all
net.ipv4.ip_forward=1
Code: Select all
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo iptables -X
Code: Select all
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
sudo iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT
Code: Select all
sudo apt-get install iptables-persistent
The iptables-persistent tool will automatically reload the configuration on boot for you
if the ethernet cable is connected unplug it to avoid problems.
Reboot:
Code: Select all
reboot