faberC
Posts: 2
Joined: Sat Jun 09, 2018 6:07 pm

Rpi3 Access point (repeater) on stretch with external adapter

Sat Jun 09, 2018 8:38 pm

Following the official tutorial here: https://www.raspberrypi.org/documentati ... s-point.md
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)
Install the required software:

Code: Select all

sudo apt-get install dnsmasq hostapd
Later you will also install iptables-persistent


To configure the static IP address, edit the dhcpcd configuration file with:

Code: Select all

sudo nano /etc/dhcpcd.conf
Go to the end of the file and edit it so that it looks like the following:

Code: Select all

interface wlan0
  nohook wpa_supplicant
  static ip_address=192.168.4.1/24
Now restart the dhcpcd daemon and set up the new wlan0 configuration:

Code: Select all

sudo service dhcpcd restart
Configuring the dnsmasq.conf:

Code: Select all

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig  
sudo nano /etc/dnsmasq.conf
Type or copy the following information into the dnsmasq configuration file and save it:

Code: Select all

interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
Configuring the access point host software (hostapd)

Code: Select all

sudo nano /etc/hostapd/hostapd.conf
edit:

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
Change the ssid end wpa_passphrase for network AP name and password that you want

We now need to tell the system where to find this configuration file.

Code: Select all

sudo nano /etc/default/hostapd
Find the line with #DAEMON_CONF, and replace it with this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Now start up the services:

Code: Select all

sudo systemctl start hostapd
sudo systemctl start dnsmasq
Edit /etc/sysctl.conf and uncomment this line:

Code: Select all

net.ipv4.ip_forward=1
if you already have iptables rules do:

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
If not, run the following commands to create the network translation between the port wlan1 and wlan0:

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
Now install iptables-persistent:

Code: Select all

sudo apt-get install iptables-persistent
You'll get two 'config' screens, say Yes to both

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
and enjoy it!

ejolson
Posts: 2748
Joined: Tue Mar 18, 2014 11:47 am

Re: Rpi3 Access point (repeater) on stretch with external adapter

Sun Jun 10, 2018 4:30 pm

I recently set up a similar access point. For reliable operation I needed to disable power saving on both the USB and built-in WiFi devices. It is interesting that you make no mention of needing to do this.

faberC
Posts: 2
Joined: Sat Jun 09, 2018 6:07 pm

Re: Rpi3 Access point (repeater) on stretch with external adapter

Sun Jun 10, 2018 8:23 pm

ejolson wrote:
Sun Jun 10, 2018 4:30 pm
I recently set up a similar access point. For reliable operation I needed to disable power saving on both the USB and built-in WiFi devices. It is interesting that you make no mention of needing to do this.
hi, i had this working on jessie.
but when I updated, my settings in the file / etc / networks / interfaces no longer work

I had no problems with power menagemant

but due to his comment, I improvised in this way:

create a script

sudo nano /home/pi/poff

add this:

#!/bin/sh
sudo iw dev wlan0 set power_save off
sudo iw dev wlan1 set power_save off

chmod in the file:

chmod 751 /home/pi/poff

In dhcpd.conf file, at the botom add:

script /home/pi/poff

it's terrible but it works :D

Return to “General discussion”