Debian 6 - iptables

I’m totally new to Linux, decided to try and learn it so I got a Linode 512 with Linux Debian 6 to learn on.

Learning about iptables I found the below on Google:

First make iptables rules and made sure they work.

Second is to save those rules to a configuration file

iptables-save > /root/scripts/iptables.save

Save custom scripts and required files in the /root/scripts/ folder.

Google showed me how to make the scripts folder.

Third make a script that loads the iptables rules at reboot

echo "#!/bin/bash" > /etc/network/if-up.d/iptables
echo "iptables-restore < /root/scripts/iptables.save > >> /etc/network/if-up.d/iptables
chmod +x /etc/network/if-up.d/iptables

Now I have done one and two but don’t know how to do step three.

I got a program called programmers note pad but what do I save the file as, and is “/etc/network” the correct path/location for Linode?

Thanks

Sarah

7 Replies

I recommend the package "ufw" for doing firewall crap. Manual IPTables makes my brain hurt.

some ufw versions do some funky things with linode kernels (there was a post about this a few weeks ago, can't remember if it was resolved), I prefer shorewall.

@obs:

some ufw versions do some funky things with linode kernels (there was a post about this a few weeks ago, can't remember if it was resolved), I prefer shorewall.
It was here. Not really resolved, the OP went with shorewall. +1 for shorewall, I use it everywhere I can't use pf.

I recommend just learning basic IPTABLES.

It's not that hard (for the basic stuff) and you have the advantage of knowing exactly what's being done. Front ends are nice, until they bork something up and you have to dig into the raw IPTABLES to fix it. Might as well avoid the middle step.

Sorry it took so long to get back to you all for the responses you gave, was on a short vacation.

I learned how to do the iptables from the command line and learned what nano is and where to save the file.

I do have a cron question but will start a new topic for that if I cant sort it latter today.

Thanks

@obs:

some ufw versions do some funky things with linode kernels (there was a post about this a few weeks ago, can't remember if it was resolved), I prefer shorewall.

ufw works for me but I use Ubuntu not Debian.

Of course learning iptables is a great idea, you can do much more with it when you need to.

you can either add the script to /etc/rc.local, or you can see

man update-rc.d 

for how to completely customize you boot scripts.

Reply

Please enter an answer
Tips:

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] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct