14

Can I use the Raspberry Pi as a Linux firewall?

Can anyone tell me the best way of doing this? Including network connection details and hardware I may need.

2
  • Once configured, please could you publish some metrics? I reckon the RPi might be alright, but remember the network connection is only 100M. Commented Jun 28, 2012 at 6:24
  • 2
    Not only that, but it's over the usb interface which is shared with all usb stuffs. OpenWRT is honestly a better option
    – user606723
    Commented Jun 28, 2012 at 19:25

1 Answer 1

12

You will want to add a second network connection to you Pi (either a usb to ethernet or WiFi dongle. Then you will want to install iptables and configure it as a home router.

Having said that you will likely have performance issues going this route. In the end you may be better off picking up an older router that supports dd-wrt that allows you to customize the way your router works (traffic shaping, DNS server etc.)

5
  • 2
    I wouldn't use iptables directly. I would use shorewall or ufw to set up the firewall. You strictly doesn't need two network connections, you can run run more then one IPv4-net on same connector.
    – Anders
    Commented Jun 28, 2012 at 0:07
  • 3
    @anders you are correct you don't need a second network adapter, the second offers slightly better security. I agree a new user may want to use one of the frontends for iptables (like shorewall) rather than iptables directly (I am an old guy and have a set of rules deployed with puppet). Commented Jun 28, 2012 at 0:17
  • 2
    I would thoroughly encourage people to try to configure iptables - I learnt a lot about networks the first time I did it, and as long as the network configuration is relatively simple, it's not that hard either. IMHO home networks aren't at that much risk anyway, but be careful allowing traffic to flow from WiFi connections to other PCs. Commented Jun 28, 2012 at 6:22
  • Alex, I would if what you want to learn is firewalling. If not, then shorewall or even ufw is a better choice. There are really so many things to consider so it's better to use others knowled here. But it's not that hard to look at the output from sudo iptables -L if you are interested. Don't forget to use ip6tables to firewall your IPv6 net. ufw has rules for that to.
    – Anders
    Commented Jun 29, 2012 at 17:21
  • This guide is about setting up the Pi as a router/firewall with iptables, using a USB ethernet adapter and the on-oard one. I used that guide but connect to the internet with a GSM modem. Works well!
    – Frepa
    Commented Nov 5, 2012 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.