-1

Currently I have a debian install with a shell script which has the following content (as an example):

# Setup iptables
IPT="/sbin/iptables"

# Flush old rules, old custom tables
$IPT --flush
$IPT --delete-chain

# Set default policies for all three default chains
$IPT -P INPUT DROP
$IPT -P FORWARD DROP
$IPT -P OUTPUT ACCEPT

I was wondering if, instead of putting these rules in a shell script, I could have them in a file such as iptables.rules instead? This raises two further questions:

  1. Would I need to modify the contents of the script
  2. Where would I need to link the rules file to
Jimmy
  • 269
  • 4
  • 7
  • 23

2 Answers2

0

everything you need to know is here

http://www.tldp.org/LDP/abs/html/

after you have your init script to your liking, you can install it in /etc/init (varies depending on distro) so your processes will survive a reboot

EDIT:

iptables is a special case, where once you have your rules to your liking, you can run

sudo service iptables save

and your rules will be saves accross reboots

nandoP
  • 2,021
  • 14
  • 15
0

I think the answers you are looking for might be here: https://wiki.debian.org/iptables

Basically, the answer is yes. I'm just wondering what you are trying to accomplish. Like nandoP said, you can just use 'iptables save' to save your rules and make them persistent. If you want to save a template rules file to duplicate firewall settings across a few systems you can use your saved rules file as input for iptables-restore.

Dinger
  • 1