Raspberry PI as WLAN access point

Diese Seite gibt es auch in Deutsch

As an extension for my home network, I tested the Raspberry PI 3 as a WLAN access point. Due to the integrated WLAN chip, the minicomputer can easily be used as an additional WLAN access point on an Ethernet cable.

I use my existing router as DHCP. The Raspberry serves, in another floor, connected via a network cable, as an additional WLAN receiver, see also: Set up network for home: Expand and improve your LAN / WiFi

Requirement

  • Raspberry PI 3B (with integrated WLAN), or older model with additional USB-WLAN-Stick
  • min. 4GB MicroSD
  • USB charger for power supply
  • PC with SD card slot for uploading the image

Installation

As a base I used a normal Raspbian image:

https://www.raspberrypi.org/downloads/

see also Raspberry Pi startup

For Raspbian the configuration is done in the terminal (shell), see Configuration - Raspbian Image

Alternatively to the Raspbian image you can also use an OpenWRT image directly:

https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi

OpenWRT provides a comfortable WebGUI for the configuration.

Startup OpenWRT:

Image: https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi

The OpenWRT image has 192.168.1.1 fixed as IP address, as user root can be used initially without password to access the WebGui.

Configuration - Raspbian Image

So that the Raspberry does not have to be connected to a monitor after installing the image, remote access can be activated by creating a file named "ssh".

If the Raspberry is connected to the existing router via Ethernet (RJ45), it gets a DHCP address from the router. After the address has been noted by the admin interface of the router, the Raspberry can easily be configured via putty. As user "pi" with the password: "raspberry" is stored.

Of course the password should be changed at the first access by using the command "passwd", see also Raspberry Pi startup

After we have connected via Putty, all available updates should be installed first:

sudo apt-get update
sudo apt-get upgrade

For the configuration of the access point we need the following packages:

Bridge-Utils and hostapd, the latter provides the basis for the function of the access point.

sudo apt-get install hostapd bridge-utils

Configure AccessPoint

The following config file can be created for the configuration of the AccessPoint:

sudo nano /etc/hostapd/hostapd.conf

Don't be surprised, the file is not yet available by default... If it is nevertheless present, it can be completely overwritten with the following content. The parameters for wpa_passphrase and ssid should be adjusted of course:

ssid=RaspberryAP
wpa_passphrase=WLANPASSWORT

driver=nl80211
country_code=DE
ieee80211d=1
hw_mode=g
beacon_int=100
channel=9
ieee80211n=1
ht_capab=[SHORT-GI-20][DSSS_CCK-40]
interface=wlan0
ap_isolate=1
bss_load_update_period=60
disassoc_low_ack=1
preamble=1
wmm_enabled=1
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
auth_algs=1
wpa=2
wpa_pairwise=CCMP
bridge=br0
wpa_key_mgmt=WPA-PSK
okc=0
disable_pmksa_caching=1
macaddr_acl=0

As a base for the settings I used the config file from my Open-WRT-Router (v18.06) and removed not supported settings until the hotspot could be started.

For security reasons, the file should only be read and changed by the owner.

sudo chmod 600 /etc/hostapd/hostapd.conf

The user "pi" can still edit the file.

Now the configuration of the network follows:

sudo nano /etc/network/interfaces
# WLAN
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wireless-power off

# Network-Bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0 # build bridge
bridge_fd 0 # no forwarding delay
bridge_stp off # disable Spanning Tree Protocol

Last but not least, we set up an automatic startup of the AccessPoint:

sudo nano /etc/default/hostapd
RUN_DAEMON=yes
DAEMON_CONF="/etc/hostapd/hostapd.conf"

Troubleshooting

hostapd can also be started with the following command. Information about the start and the connected devices is displayed in the terminal:

sudo hostapd -dd /etc/hostapd/hostapd.conf

2 hotspots at the same time

Additionally I wanted to use a 2nd adapter, so an additional USB-WLAN stick as hotspot. In a single hostapd config I did not get this to work, so I just created a second hostapd.conf file and let it activate on startup of the Raspberry using crontab:

sudo crontab -e
@reboot sudo hostapd -d /etc/hostapd/hostapd2.conf

5GHz

With an appropriate USB Wlan stick it should also be possible to operate the hotspot on 5GHz. Unfortunately I could not get my Edimax EW-7612UAn adapter to do this. The output at startup with hostapd -dd was without noticeable errors, also the hotspot was available, but a connection was not possible. Maybe I will try this again at a later time ...

Deauthenticated due to local deauth request

in cat /var/log/syslog

possible solution?

 apt-get install haveged

without reboot: sudo service hostapd restart

Status

Info:iw dev wlan0 infoPowersave:iw dev wlan0 get power_save

Conclusion

With a measured power consumption of 1-2 watts and low acquisition costs, the Raspberry offers a real alternative to a real access point. The integrated WLAN chip is not capable of 5GHz, but the 2.4GHz WLAN still reached over 40 Mbit in my tests with iperf and is thus sufficient for smooth playback of HD video streams.

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!



Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details