Can someone offer a brief walk-through for firewalling Ubuntu 16 with UFW for tor. I only want to allow tor traffic out on my device. I'm not sure if it's even possible with UFW.

# ufw default deny incoming
# ufw default deny outgoing
# ufw allow out on <wireless interface> to any proto tcp port 9001
# ......?

I'm certain this is wrong. Any info on this would be valued. Cheers.

  • 1
    ufw does not provide sufficient functionality to configure a Tor enforcing connection. Instead you should disable ufw entirely, and use something like ferm, as described here: tor.stackexchange.com/questions/12343/…
    – cacahuatl
    Commented Dec 11, 2017 at 0:06
  • I don't know how to do this on Ubuntu with UFW, but juuust in case you or someone reading this didn't know already, there are operating systems designed to force all of your network traffic to go through tor. They are Tails and Whonix. I don't want to bias your opinion of either so I will just recommend searching for "Tails vs Whonix". Commented Dec 16, 2017 at 7:20
  • use QubesOS - and forget both immature ones you've mentioned ;)
    – Alexey Vesnin
    Commented Nov 25, 2021 at 20:57
  • github.com/ruped24/toriptables2 - it does exactly what you're searching/asking for
    – Alexey Vesnin
    Commented Nov 25, 2021 at 21:01


You must log in to answer this question.

Browse other questions tagged .