Iptables setup

Chris Peterman kyral at ubuntu.com
Sun Jun 18 13:57:23 UTC 2006


Well, what I have doen on all my boxes (regardless of distro) is to make out 
the iptables rules then do "iptables-save > /etc/somefile (replace "somefile" 
with your name of choice, I like "iptables-up-rules")

Then in /etc/network/interfaces, below the eth0 (or whatever your interface 
is) I put "pre-up iptables-restore < /etc/somefile" (again replace somefile 
with whatever you named your file) This loads the iptables rules as the 
interface is coming up. Anytime you modfiy your rules just do "iptables-save 
> /etc/somefile" and next time you reboot..

Also its important to use > and not >>. We want to clobber the file this time, 
NOT append to it! :D

On Sunday 18 June 2006 09:38, Daniel Carrera wrote:
> Hello,
>
> Which init script is a good place to add iptables rules? One option is:
>
> /etc/init.d/networking
>
> But that might get overwritten in a future upgrade. Another option is to
> make a new file:
>
> /etc/init.d/daniels_iptables_rule
>
> And add appropriate links in /etc/rc*
>
> Opinions?
>
> Cheers,
> Daniel.
> --
> http://opendocumentfellowship.org
>    "The reasonable man adapts himself to the world; the
>    unreasonable man tries to adapt the world to himself.
>    Therefore all progress depends on unreasonable men."
>          -- George Bernard Shaw

-- 
~ Chris "Kyral" Peterman
Computer Science Undergraduate
Clarkson University
Associate Member of the Free Software Foundation
Ubuntu Member
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060618/60193b0f/attachment.sig>


More information about the ubuntu-users mailing list