<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Actually, let me refine this a bit...</div><div><br></div><div>Set your rules up the way you want them once. </div><div><br></div><div>Then use iptables-save and redirect the output to a file.</div><div><br></div><div>Then use a script (either the if-up.d and interfaces file method you found, or the if-pre-up.d method I use) to load those rules at boot time.</div><div><br></div><div>Or you could be really fancy and pull the rules from a mysql database at bootup :)</div><div><br></div><br><div><div>On Jan 16, 2009, at 4:43 PM, Ken Ratliff wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>assuming it's debian, this is how I do it -</div><div><br></div><div><div>In /etc/network/if-pre-up.d, I have a scrip called iptables that contains the following - </div><div><br></div><div>#!/bin/bash</div><div>/sbin/iptables-restore < /etc/iptables.up.rules</div><div>echo Restoring iptables rules...</div><div><br></div><div>And my iptables.up.rules is of this format -</div><div><br></div><div>*filter</div><div><div>:fail2ban-ssh - [0:0]</div><div>-A INPUT -p tcp -m tcp --dport 22 -j fail2ban-ssh</div><div>-A fail2ban-ssh -j RETURN</div><div># Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0</div><div>-A INPUT -i lo -j ACCEPT</div><div>-A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT</div><div><br></div><div><br></div><div># Accepts all established inbound connections</div><div>-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</div><div><br></div><div><br></div><div># Allows all outbound traffic</div><div># You can modify this to only allow certain traffic</div><div>-A OUTPUT -j ACCEPT</div><div><br></div><div><br></div><div># Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)</div><div>-A INPUT -p tcp --dport 80 -j ACCEPT</div><div>-A INPUT -p tcp --dport 443 -j ACCEPT</div><div><br></div><div>And so on and so forth. </div><div><br></div><div>So it brings the fire wall rules up before it brings the interfaces up, and I can use the script to add or restore rules as needed. Just have to be careful not to do something stupid that will lock me out.</div><div><br></div></div></div><div><div>On Jan 16, 2009, at 3:38 PM, Paul Cartwright wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I setup a web server, and ran this command:<br> iptables -I INPUT -p tcp -m state --state NEW --dport 80 -i eth0 -j ACCEPT<br><br>so now you can get to my web server from other PCs.. but when I rebooted, I <br>had to run that command again.<br>where do I put this command, so it will be there NEXT time I reboot??<br><br>I setup nginx and gallery2 to put up almost instant pictures on a web site..<br>fast and easy ( when iptables lets you GET to it..)<br><br>-- <br>Paul Cartwright<br>Registered Linux user # 367800<br>Registered Ubuntu User #12459<br>_______________________________________________<br>Ale mailing list<br><a href="mailto:Ale@ale.org">Ale@ale.org</a><br><a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a><br></div></blockquote></div><br></div>_______________________________________________<br>Ale mailing list<br><a href="mailto:Ale@ale.org">Ale@ale.org</a><br><a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a><br></blockquote></div><br></body></html>