Configuring the Raspberry Pi as a WiFi repeater

Note

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.

Note

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.

  1. Install hostapd and brutils with:

    sudo apt install hostapd bridge-utils
    
  2. Temporarily clear existing IP address on eth0 with:

    sudo ip addr flush dev eth0
    
  3. Create the br0 bridge interface with:

    sudo brctl add br0
    
  4. Add the wlan1 and eth0 interfaces (or whatever your actual interface names are) to the bridge br0 with:

    sudo brctl addif br0 eth0 wlan1
    
      (ignore the error - this is key)
    
  5. Bring up the br0 interface with:

    sudo ip link set dev br0 up
    
  6. Unplug and re-plug the Ethernet cable to get a new address for br0 from your dhcp server. Or:

    sudo dhclient -r
    sudo dhclient
    
  7. Bring up hostapd with the properly configured hostapd.conf (see below) with:

    sudo hostapd ./hostapd.conf
    

Here’s my 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.

The Raspberry Pi Forums and Blog are an invaluable aid for figuring out some of these steps on recent versions of raspbian.

Contact and feedback

You can find me on Reddit where I lurk in many of the raspberry pi-related subreddits.

Last updated on Oct 23, 2018