QuickLinksPart 1 – How to create a Wireless Network On Your RPiPart 3 – How to make your RPi into a Router

In this part, we will turn the Raspberry Pi into a Wireless Access point.
All it will do is forward packets from the WiFi adapter to ethernet and vice versa. It will allow you to access your network via WiFi without needing a WiFi router.

To do this, we need to bridge the ethernet and wifi connections, and tell hostapd that we are now using a bridge connection.
In /etc/hostapd/hostapd.conf, we need to add the following line.
bridge=br0

Notice the “auto br0″ is commented out. This is so the bridge does not come up automatically, as once the bridge is up, you will not be able to remotely access the Raspberry Pi until the bridge is brought down or until the bridge gets an IP address.

Once the lines are in /etc/network/interfaces, you can type in ifup br0 as root to bring up the bridge. If you are ssh’ed into the Pi, this will drop your connection.
Once it’s up, the Raspberry Pi will forward anything from the WiFi to ethernet and vice versa.

This let’s the Raspberry Pi act as a Wireless Access Point without any sort of routing. On a WiFi device, you will be able to connect to RaspAP, and it will act is if it was on the network, i.e. it will get an IP address from your normal router.

If you have found this post useful, please consider donating by pressing on the button below. Donating will help keep this site up and running

33 Responses to “How To : Use The Raspberry Pi As A Wireless Access Point/Router Part 2”

Hi I would like to create a network bridge between the ethernet port and the wireless usb adapter on my raspberry pi for my xbox. Are the instructions above all I need to do to set that up? I’m not interested in an access point, I just want to connect to the internet through my raspberry pi’s wireless connection via the ethernet port. It’s simple to do in windows but not so easy in linux.

So you want to connect the XBox to the Ethernet port on the Pi, and then use the Wifi to connect to a wireless network ?
Easier way is to make the Pi into a wireless router/bridge.
Same way as the Router post (Part 3), except swap wlan0 and eth0
Harder way, is to make it into a bridge. I haven’t actually tried making it into a bridge, but it’s something along the lines of –
install wpasupplicant
connect the wifi
setup a bridge
use ebtables to change the mac address of any packets going out to the mac address of your xbox.

I was trying to do the same stuff as dave does with wireless bridge way. But I did not succeeded And I do not have local screen/keybord on the RasPi (I am using VNC as I do not have HDMI screen at home). So, what I know is – that when I make br0 interface from wlan0 and eth0, I’m able to ssh into the box only when I do connect ethernet to the switch directly, but what I wanted was, to have wifi connected to the AP and use ethernet interface as an LAN plug (without cable); I do need the same network for my endpoint, I do not like to be NATting the trafic (it would be 4th NAT on the route 😉

Ah I see.
If you have a bridge, you don’t need dnsmasq. The bridge will pass packets from the ethernet out to the WiFi network-connected computers.
You only need dnsmasq if you are using the Pi as a standalone access point, or as a router.

I don’t remember what driver i used and unfortunately I can’t check as my Pi is buggered at the moment. The SD Card socket broke and I haven’t had time to fix it yet.

Awesome write-up, I am working on getting my Raspberry Pi to serve American Netflix to my home in Canada (through a SSH tunnel to my hosting provider in the states). The basic setup of my network is a pi running dnmasq and serving as a caching name server for my internal LAN and routing to my ISP provided modem (gateway). The second part of my project is to use a wifi dongle as an AP on the pi, set up dnsmasq to dish out IP’s on that interface on a different subnet, then route all traffic on that subnet through the tunnel the the states.. the apple-tv connecting to that WiFi network instead of my other WiFi network used for regular run of the mill Canadian content. Anways, I got everything configured before I realized that hostapd doesn’t work with r8712u based chipsets (8191SU on the D-link DWA-130 I’m using). I’ll let you know how it goes once I get a different dongle.

Fantastic write-up, many thanks.
A note for others who may have encountered errors with hostapd failing to start – after some hunting around I found the “-d” parameter you can pass to hostapd to help get details on any issues.
My issue was that the hostapd.conf file had a passphrase of 6 characters only and it was complaining that a minimum of 8 chars were needed for the passphrase.
Changed that and all is working now so happy days.

Great work! I am currently implementing it in a pandaboard with ubuntu 12.04. When I try to do the ifup br0, I am getting br0 already exist. Though, ifconfig doesn´t show any br0. Checking forums,
I tried ifconfig br0 up. and add a ip static ( I am not using dnsmasq so far).

In another pc (windows). I connect to the wireless network, I made a ping to the device ip and it connects. But, when I tried the other hand, ping from the device to the pc. it doesn´t connect. However, I can access a web service in the device by broswer using the ip static which I assigned.

I guess the bridge functionality is not working. The reason for not using dnsmasq is that I am getting an error: failed to bind DCHP.

Thanks for the quick reply. I managed to create the bridge. Both client and bridge can see each other using ping. however, I can´t used ssh to connect to bridge from client. I get a network refused. similar, the bridge can´t connect to client using ssh.