When using the Ethernet and a wireless adapter, is it possible to set up the device as a wireless router? If so, what software (and/or additional hardware) would be needed?
7 Answers
In principle, yes. You can follow any tutorial for setting up a Linux PC as a router.
Useful Tutorials
- 15,638
- 15
- 69
- 113
I'll show steps for Arch Linux because that's the distro I'm familiar with, but instructions for Raspbian shouldn't be very different.
Note that not all wlan0 interfaces support AP mode.
The setup would be
(eth0)<---RPI--->(wlan0)
where the RPI is the router (and AP) providing wireless internet from ethernet.
Install needed software and drivers.
pacman -S wireless_tools wpa_supplicant hostapd
Build the Router.
Build the AP
Edit /etc/hostapd/hostapd.conf (self explained). Start it with rc.d start hostapd and add it to the Daemons array if you want it to start when you boot the RPI.
The wireless router should be now working.
- 273
- 1
- 3
- 11
From my experience of trying to getting my Raspberry Pi working with a RTL8188CU based tiny wifi dongle, there are more troubles than you thought.
The major difference here is: The power supply of pi's onboard usb is not enough, since each usb limits to 140mA on pi. While this is enough for using the pi as a "client" connecting to real wifi routers, it is usually not enough to act as one. Although one could probably put the dongle into master mode, it could be very unstable. A possible solution is to bypass the poly fuses. But I have not tried that.
Even if the power supply is enough, the linux driver for the wifi dongle is the next problem. The driver in the "official linux kernel" cannot put my dongle as a client. I had to download a driver from Realtek website (the script here is very helpful). Then a program called hostapd is needed to make it a working AP. Someone failed on that. I didn't succeed either, even on a desktop with latest arch linux.
In the end, I just gave up. I suggest buying a proper wireless router is the way to go. The pi is just not designed for this kind of task.
- 131
- 2
Easily with the RALink RT5370, which works straight in the Pi even with the polyfuses.
I got hostapd installed, set a static IP address on my wifi interface, then setup hostapd with ssid and psk.
Then I used dnsmasq to hand out IP addresses and it worked ok for me.
Full instructions here on my blog - http://sirlagz.net/?p=589
- 2,692
- 15
- 14
Yes, it is definitely possible and there are SD images ready for it: http://www.pi-point.co.uk/
- 121
- 1
In addition to the good points in the other answers: get a WiFi device with good Linux support. You want one that works in access-point or managed mode. Many devices do not work in this mode in Linux, even if they work fine as a client. How well a device works depends on the state of the device driver. Before you buy anything, check the state of the various drivers at linuxwireless.org. Choose a driver with good support (at least the AP mode), then find a device containing that chip.
I got a TL-WN722N USB device supported by the ath9k_htc driver. This works very well with hostapd and WPA2 encryption. I wrote a blog post on my wlan router setup here. Regarding the CPU demands mentioned in the comments of the question: I have not had problems with high CPU load. With iperf, I measured 22 Mbit/s throughput over WLAN from a laptop to the Pi, when the connection speed was reported as 54 Mbit/s. I don't quite know how much one can expect, or where the bottleneck is in my setup.
- 2,261
- 19
- 17
Yes, it is possible, and there are now projects that have done this sort of thing for you, so all you have to do is load a distro (just like Raspbian). There are also a lot of other networking related projects you may want to consider.
It's also possible to set up the Pi to act as a more advanced router to do fancy things like route your traffic through a VPN and/or Tor. Adafruit wrote a how-to guide back in the day, calling their project 'Onion Pi'. Lifehacker gives a detailed how-to on turning the Pi into a VPN proxy.
Sadly, pfSense will not get ported to the Pi, at least the way I interpolate their message boards. it makes sense though, since the networking on the Pi is based off of USB.
There are also other SBC projects that take different approaches (Beaglebone), and travel routers that do similar things (Invisibox, Anonabox, P.O.R.T.A.L., etc.).
Now that the Pi 3 is out, I can imagine we'll see some interesting developments in this area. As it turns out, you can improve the speed of your Pi with a USB Gigabit adapter.
- 1,120
- 2
- 11
- 34