Configuring the Raspberry Pi as a WiFi repeater¶
These changes apply to raspbian stretch installs. Details may vary with different versions.
Here’s a quick-and-dirty test to get wifi-ethernet bridging working at the command line.
I completed this process on a RPi 3B running raspbian lite stretch. I am able to connect to the RPi AP using my MacBook Air and access the Internet with no issues. The same basic procedure may work with a 2nd interface in wifi station (client) mode, but I’ll have to do more testing.
I added an Edimax adapter that I used previously as an AP as wlan1 for this test. YMMV using other wifi adapters. The adapter to be used as your AP must support that function. Edit to substitute your own interface names as needed.
Additional work will be required to get everything to work on boot.
This procedure will disconnect any existing network connection on the Raspberry Pi, so you need to be on the Raspberry Pi console after step 2.
sudo apt install hostapd bridge-utils
Temporarily clear existing IP address on
sudo ip addr flush dev eth0
br0bridge interface with:
sudo brctl add br0
eth0interfaces (or whatever your actual interface names are) to the bridge
sudo brctl addif br0 eth0 wlan1 (ignore the error - this is key)
Bring up the
sudo ip link set dev br0 up
Unplug and re-plug the Ethernet cable to get a new address for
br0from your dhcp server. Or:
sudo dhclient -r sudo dhclient
hostapdwith the properly configured hostapd.conf (see below) with:
sudo hostapd ./hostapd.conf
interface=wlan1 driver=nl80211 bridge=br0 wmm_enabled=0 hw_mode=g # Advertise capabilities ieee80211d=1 channel=8 macaddr_acl=0 auth_algs=1 # broadcast ssid ignore_broadcast_ssid=0 ssid=YourSSID # wpa: 1=wpa 2=wpa2 3=both wpa=2 wpa_passphrase=YourPSK wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Again, expect far better performance using a device intended for such use. The GLi routers with external antennas work very well, as do others. A wifi repeater with little range is painful to use.