LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   iptables slackware questions (https://www.linuxquestions.org/questions/slackware-14/iptables-slackware-questions-135656/)

moger 01-17-2004 01:57 AM

iptables slackware questions
 
When I make iptable rules, I run "iptables-save" but when I log back on all the rules are gone. How do you save your iptables entry so it's there on startup?

Also, I remember RedHat having a file with all the rules in it. Does slackware have something like this? What if I want to delete a rule? Is there a way I can go into a file and delete it?

ugenn 01-17-2004 02:23 AM

Somewhere along your initscripts, you have to run iptables-restore. I'm not sure how Slack handles this, there should be a firewall specific initscript that you can add that line to, otherwise, add the command to your rc.local (or equivalent) file.

spurious 01-17-2004 02:23 AM

You save your iptables script in /etc/rc.d/rc.firewall. Search this site for 'Slackware' and 'rc.firewall'

moger 01-17-2004 02:33 AM

Thanks

dirstyGuy 01-17-2004 07:07 AM

Bettter were to write functions (start, stop, restart) in the /etc/rc.d/rc.firewall script, so u can delete those rules in the function stop. This is the slackware way of doing thing ?!

Code:

#!/bin/sh
# /etc/rc.d/rc.firewall

IPT=/usr/sbin/iptables

# Reset all previous iptables rules
firewall_stop() {
  $IPT -F
  $IPT -t nat -F
  $IPT -t mangle -F
  $IPT --delete-chain
  $IPT -t nat --delete-chain
  echo "All tables, rules are reset"
}

firewall_start() {
  echo "firewall start"
}

case "$1" in
'start')
  firewall_start
  ;;
'stop')
  firewall_stop
  ;;
'restart')
  firewall_restart
  ;;
'reload')
  firewall_reload
  ;;
'status')
  firewall_status
  $IPT -nL ;;
*)
  echo "usage $0 start|stop|restart|reload|status"
esac



All times are GMT -5. The time now is 09:28 PM.