[WBEL-users] iptables - where and how to insert the rules ?

John Morris jmorris@beau.org
Fri, 3 Dec 2004 18:29:18 -0600 (CST)


On Fri, 3 Dec 2004, Mário Gamito wrote:

>  From what i saw in iptables ctl, the rules should be in 
> /etc/sysconfig/iptables, right ?
> But when i insert them in that file, i always get an error from 
> "/etc/init.d/iptables start", saying it doesn't recognize the text.

Have a look at the rules that get put there by default.  They are in the
same format that iptables-save outputs which is basically the arguments
that go after the iptables command with a few additional bits like the
name of the table and a commit command at the end of each table.  Here is
an example of one with a little extra stuff in it:

*nat
-A POSTROUTING -s 10.1.1.0/24 -j MASQUERADE
COMMIT
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -i vmnet1 -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport ntp -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport x11 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT


-- 
John M.      http://www.beau.org/~jmorris        This post is 100% M$ Free!
Geekcode 3.1:GCS C+++ UL++++$ P++ L+++ W++ w--- Y++ b++ 5+++ R tv- e* r