Introduction: WiFi - Access Point Out of a Raspberry Pi (Repeater)
What do you need?
A Raspberry Pi, model B.
A boot SD card for the Raspberry Pi.
A USB WiFi device that supports "Access Point" mode.
An Ethernet cable to connect to the local network.
How does it work?
The Raspberry Pi is configured as a WiFi Hotspot, just like you would see in an internet cafe. It allows you to connect to the internet over WiFi using the Raspberry Pi as the bridge to the internet. The basic steps are
- Enable a WiFi Access Point and broadcast on the channel of your choice
- Assign dynamic IP addresses to any device that connects to WiFi network
- Join the WiFi and Ethernet networks together by using Network Address Translation
Step 1:
1. Install the necessary software.
sudo aptitude install hostapd hostap-utils iw bridge-utils
2.Edit the file Hostapd:
sudo nano /etc/init.d/hostapd
and add to (DAEMON_CONF=) the following line:
DAEMON_CONF=/etc/hostapd/hostapd.conf
Save nano(CTRL+O)and Exit(CTRL+X)
3.Configure Hostapd.conf
You can create an open network, or a WPA-secured network, or a WPA-secured network. A secure network is recommended to prevent unauthorized use andtampering, but you can also create an open network. To create a WPA-secured network, edit the file /etc/hostapd/hostapd.conf (create it if it doesn't exist) and add the following lines:
sudo nano /etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapd
###############################
# Basic Config
###############################
macaddr_acl=0 auth_algs=1
# Most modern wireless drivers in the kernel need driver=nl80211
driver=nl80211
##########################
# Local configuration...
##########################
interface=wlan0
bridge=br0
hw_mode=g
ieee80211n=1
channel=1
ssid=RaspberryPI_AP
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=MY_PASSPHRASE
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Save nano(CTRL+O)and Exit(CTRL+X)
Important:
!! Change ssid=, channel=, and wpa_passphrase= to values of your choice. SSID is the hotspot's name
!! which is broadcast to other devices, channel is what frequency the hotspot will run on,
!! wpa_passphrase is the password for the wireless network
(If you would like to create an open network, put the following text into /etc/hostapd/hostapd.conf:)
sudo nano /etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapd
###############################
# Basic Config
###############################
macaddr_acl=0 auth_algs=1
# Most modern wireless drivers in the kernel need driver=nl80211
driver=nl80211
##########################
# Local configuration...
##########################
interface=wlan0
bridge=br0
ssid=RaspberryPI_AP
hw_mode=g
ieee80211n=1
channel=1
auth_algs=1
wmm_enabled=0
Save nano(CTRL+O)and Exit(CTRL+X)
Step 2:
Configure Bridge
1.Change /etc/network/interfaces and add the following lines:
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.1.11
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge-ports eth0 wlan0
Save nano(CTRL+O)and Exit(CTRL+X)
Finish:
Restart Raspberry ore try to runn this commands:
sudo service hostapd restart

Participated in the
Weekend Projects Contest
16 Comments
6 years ago
Any tips on doing a wifi repeater/extender? I'd like to wirelessly connect a pi zero w to my network but also have it act as an access point.
I would think this should be easier since the pi doesn't have to run a dhcp server, it just needs to bridge the connection to the router it's already connected to.
The device that connects to the pi would need to know the network password, but the upside is that it would always know the ip of the pi access point!
None of the info I've been able to find seems to have this scenario:
https://gist.github.com/tcg/0c1d32770fcf6a0acf448b7358c5d059
http://imti.co/post/145442415333/raspberry-pi-3-wifi-station-ap
https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/
Reply 3 years ago
hello snoop, I have made a project of Wifi extender using pi zero w which is much simpler than this instructable. Also you do nnot need to install any addtional packages. Check it out https://www.instructables.com/id/Truly-WiFi-Extender/
6 years ago
no luck using pi2 model b and modmypi adapter. Can you explain why you don't set up any DHCP or NAT in your solution? These steps appear in other guides. I've read loads and there isn't much consensus.
Reply 6 years ago
You don´t set up any DHCP or NAT in this solution because you use the router (not the Pi) as DHCP server and you don´t want have a seperate LAN NAT and Wireless NAT.
7 years ago
i did all the steps and after reboot my wifi adapter does not work and then i have to reflash raspbian again
7 years ago
hi, how can i do this tutorial but with 2 wifi dongles ? I dont have ethernet connection.
7 years ago
I have that exact wifi adapter:
I am interested on this whole process if I was to buy this yagi type of
antenna I could get a cable that allows me to connect to a wifi adapter
so I can possibly get free wifi. I would like this as a backup internet
in case my block has an outage I still have internet to work from home.
Is there a wifi extender type that I can plug it into instead of one
depended on a computer to be on? If it has to go through a computer of
sorts do you know if I can someone connect it to a low power device for
example Raspberry Pi 3 so I can then connect it to usb to ethernet on
another available port on raspberry pi and connect Ethernet to router? Will the instructions provided allow to broadcast the signal?
thanks in advance.
7 years ago
Great tutorial. However, when I connect to the AP, I have no internet connection. Tried to enable ip_forward as well, but still doesn't work.
8 years ago
how many conecctions support ?
8 years ago on Introduction
By the way......
using RPI 2B and works like a charm... while other ideas's did'nt work at all or died after a reboot.... this one is just perfect.... but would like to SSH to it.....
8 years ago on Introduction
Is it possible to ssh to the AP ???? tried PuTTY but nojoy
8 years ago on Step 2
does not work.. I did all steps 2 times.... and I checked after each step to make sure it was done right
Reply 8 years ago on Introduction
Try a different WIFI dongle
9 years ago on Introduction
I'm interested in Internet billing capability. Is that possible?
thanks
9 years ago on Introduction
Hi! I have a little question: I want to use raspi as AP but i also want to connect my raspi directly to network cable which is actually a PPPoE network. I've tried to change eth0 with ppp0 but i don't get any result... is it something wrong? thanks
10 years ago on Introduction
Wanted to say thnak you, I was just looking for something like this. Finding a lot of articles suggesting making a Raspberry pi into an access point, pi-point for example, that then set up the R/pi as a NAT router. This looks a lot more like an AP. Since the AP I'm using at the moment has become unreliable, I'm hoping that I'll be able to use hardware I have on hand to turn an R/pi into a replacement. If all works, I'll update here.