Where is to edit the firewall-rules for iptables and ip6tables correctly?

I want to set myself up the rules for firewall in iptables. But several queries have delivered different file-locations for iptables-rules.

One location is in /usr/local/bin and there is to create file with name fwall-rules as script ?! - But this looks antique ...

Other location is to create file apparently in /etc with name of script iptables.rules ?! (as explained in: )

Where is today fwall-rules to be edited in 18.04 for iptables ?

Are the fwall-rules then included in iptables automatically - or do I need to create a link for this in terminal for Ubuntu ?

When I write as command:

sudo ip6tables -I INPUT -s fe80::b131:5a4d:9ebf:4c36 -j DROP

Where is this then saved ?

1 Answer

You don't really need to bother with file locations as long as you use either UFW or iptables commands to change the firewall rules.

Ubuntu now has UFW - Uncomplicated Firewall - that works as a wrapper for iptables and that makes it easier to enable the firewall and to edit rules. By default, the UFW is turned off and must be turned on with

sudo ufw enable

Rules are added with a simple allow or deny, for example:

sudo ufw allow <port>/<optional: protocol>

Both ports/packets and services can be allowed or denied. See the reference above for details on rules.

For more complex hardware setups - for instance several NICs on the same box - foregoing the simplicity of the UFW and editing iptables directly may be adviseable. This is set out in the How To you referred to: Iptables How To.

8

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like