So I've delved into the world of creating my own iptables firewall, but
I keep getting these stupid errors. Pasted below is the command
execution and the iptables script. The reference to timesquare is my
desktop machine, which runs windows XP and remote desktop stuff.

[root@westernwall rc.d]# ./rc.firewallrestrict 
iptables: Bad policy name
iptables: Chain already exists
Bad argument `MASQUERADE'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `ACCEPT'
Try `iptables -h' or 'iptables --help' for more information.

<file rc.firewallrestrict>
#!/bin/sh

#######################################
#  SET VARIABLES 
#######################################
# LOCAL LOOPBACK DEVICE
LB="lo"
# PRIVATE INTERFACE 
INTETH="eth0"
# PRIVATE LAN IP
INTIP="10.0.0.1"
# LOCAL AREA NETWORK
INTNET="10.0.0.0/24"
# INTERNET INTERFACE
PUBETH="eth1"
IPTABLES="/usr/local/sbin/iptables"
TIMESQUARE=10.0.0.5
#######################################
# TURN ON IP FORWARDING
#######################################
echo "1" > /proc/sys/net/ipv4/ip_forward
#######################################
# FLUSH EXISTING RULES
#######################################
$IPTABLES -F
$IPTABLES --flush INPUT 
$IPTABLES --flush OUTPUT
$IPTABLES --flush FORWARD
#######################################
# SET DEFAULT POLICIES
#######################################
$IPTABLES -P INPUT REJECT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
#######################################
# CREATE DEFAULT BLOCK CHAIN 
#######################################
#$IPTABLES -F BLOCK
$IPTABLES -N BLOCK 
$IPTABLES -A BLOCK -j LOG --log-level 1 --log-prefix "FIREWALL: "
#######################################
# SETUP MASQUERADING
#######################################
$IPTABLES -t nat -F
$IPTABLES -t nat -A POSTROUTING -o $PUBETH -s $INTLAN -j MASQUERADE
#######################################
# ALLOW LOCAL ENTITIES 
#######################################
# ALLOW LOOPBACK
$IPTABLES -A INPUT -i $LB -j ACCEPT 
# ALLOW LOCAL AREA NETWORK
$IPTABLES -A INPUT -i $INTETH -s $INTLAN -j ACCEPT
#######################################
# ALLOW SPECIFC TRAFFIC
#######################################
# Allow SMTP Traffic
$IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT
# Allow SSH traffic
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
# Allow WWW traffic
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT 
# Allow IDENT Traffic
$IPTABLES -A INPUT -p tcp --dport 113 -j ACCEPT

# Allow internal remote desktop connections to xp machine
$IPTABLES -A PREROUTING -t nat -p udp -i $PUBETH --dport 3398 -j DNAT
--to $TIMESQUARE:3398 
$IPTABLES -A PREROUTING -t nat -p tcp -i $PUBETH --dport 3398 -j DNAT
--to $TIMESQUARE:3398
$IPTABLES -A PREROUTING -t nat -p tcp -i $PUBETH --dport 81 -j DNAT --to
$TIMESQUARE:80
$IPTABLES -A PREROUTING -t nat -p udp -i $PUBETH --dport 81 -j DNAT --to
$TIMESQUARE:80
# Allow X connctions
#$IPTABLES -A INPUT -i $INTETH -p tcp --dport 6000 -j ACCEPT
#$IPTABLES -A INPUT -i $INTETH -p udp --dport 6000 -j ACCEPT
# Allow SAMBA
#$IPTABLES -A INPUT -i $INTETH -p tcp --dport 137:139 -j ACCEPT
#$IPTABLES -A INPUT -i $INTETH -p udp --dport 137:139 -j ACCEPT
# Allow CUPS Traffic internally
#$IPTABLES -A INPUT -i $INTETH -p tcp --dport 631 -j ACCEPT
# Allow WEBMIN internally
#$IPTABLES -A INPUT -i $INTETH -p tcp --dport 90 -j ACCEPT

#######################################
# ALLOW IN WHAT WE SEND OUT
#######################################
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#######################################
# DENY EVERYTHING NOT ALLOWED
#######################################
$IPTABLES -A INPUT -j BLOCK
#######################################

Any ideas? The masquerade reference is 
Thanks in advance,
jeff


------------------------------
Jeffrey Forman
E-Mail: [EMAIL PROTECTED]
------------------------------


_______________________________________________
Siglinux mailing list
[EMAIL PROTECTED]
http://www.utacm.org/mailman/listinfo/siglinux

Reply via email to