Which firewall settings should I use for Geth as a non-miner using Linux Ubuntu 15.10?

Is there a way to check that the firewall settings are correct? If so, how do I check and set the firewall settings in the Terminal?

Should I use ufw and iptables and if so, how?

If someone has a one-liner CLI command for iptables that would be great.

Any official recommendations from core devs or other skilled coders with expertise regarding recommended firewall settings?

These are my current iptables settings. Output from sudo iptables -L



1 Answer 1


You'll need to forward both TCP and UDP port 30303 for Geth to work.

The simplest thing to do would be just to open these ports to all traffic, which I imagine is what most people do. If you don't want to do that, then you could try confining traffic to certain peers, but that would require you to:

  • Open the ports to all traffic;
  • Wait for a set of peers to be found, and check their addresses using admin.peers;
  • Restrict traffic to those addresses using a firewall ruleset.

However, given the likely transient nature of those peers, you'd end up having to regularly change your ruleset.

  • Hi Richard. Do you have a CLI on-liner for iptables per chance? Now I have just enabled ufw and ipconfig without making any changes from the default and I wonder what to do next.
    – Vesa
    Jul 12, 2016 at 5:57
  • These are my current iptables settings. Output from sudo iptables -L pasted.co/288f28f6
    – Vesa
    Jul 12, 2016 at 6:12
  • I don't believe there are any official recommendations for firewall settings. What are you trying to achieve? What firewall settings do you use for other non-Ethereum applications? What traffic do you want to block? At the minute your settings are permissive - connecting to the Ethereum network should just work. I should have asked these questions before posting my answer! :) Jul 12, 2016 at 13:00

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.