Skip to contentSkip to conversation

Placement of Iptable Scripts

DISCUSSION Bob Hillegas 1 participant 1 message Jul 8, 2002 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

The best place I have found to place such script is immediately after bringing up the interface. Especially on interfaces that get their ip address changes by the ISP.

Redhat looks for (in /etc/sysconfig/network-scripts/ifup) and executes if found, /sbin/ifup-local. Define it and put into it a reference to the script that builds your rules. If you face the dhcp problem, pass the interface name to the script as an argument and parse the ip address from an invocation of /sbin/inconfig.

If your interface ip is non-changing, run the script, execute /etc/rc.d/init.d/iptables save

You will get those same rules back every time your system does an /etc/rc.d/init.d/iptables start

One note: an iptables start only invokes the actual iptables rules. Other commands commonly embedded in such "define scripts", such as, echo 1 > /proc/../../etc/etc, don't get issued.

Signature · 3 lines
----------------------------------
Bob Hillegas
[email protected]
Quoted 14 lines · On Thu, 4 Jul 2002 [email protected] wrote:

From: [email protected]
To: [email protected]
Subject: Placement of Iptable Scripts
Date: Thu, 4 Jul 2002 21:57:16 -0500

I'm relatively new to iptables and have the following question.

where is the best place to place my iptable bash script so that it loads my iptable chains and rules when my server reboots?

Thanks!

Mark