Step-by-step iptables configuration guide?

I swear there used to be a step-by-step guide for configuring iptables in the Linode Library. It took you through creating the configuration files, and getting iptables to start up at each boot. Now all I can find is a document that tells you a lot about iptables commands but not how to set everything up for a basic firewall and have it enabled after every boot.

Also, what do we need to do to secure IPv6?



2 Replies

There is a very minimal iptables how to in the linode library.

ip6tables for ipv6.

Once you set the iptables rules using the commands in the Linode Library, log in as root and run the following command (or use sudo):

root@li283-45:~# iptables-save > /root/default.fw

You can change default.fw to whatever you want to call the file. It doesn't need to be in /root either, just put it in a place where nobody can access it.

Some distributions will have the file called "/etc/rc.local", if you have it, you can add the command "iptables-restore /root/default.fw" (remove the quotes), replacing /root/default.fw with the firewall file. It will execute anything in /etc/rc.local at boot. You should also be able to do an init script, though I'm not experienced with writing init scripts, so I'm not going to attempt a sample script in case it messes up for you.

(edited to remove stray code tag)


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct