Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Ethan Treviño" <etrevino@mec.edu>
To: netfilter@lists.netfilter.org
Subject: Problem with configuration script
Date: Thu, 22 May 2003 09:27:41 -0400	[thread overview]
Message-ID: <000001c32065$ecee45d0$6400a8c0@ethan> (raw)

[-- Attachment #1: Type: text/plain, Size: 3397 bytes --]

Hey,
I have a RedHat 9 system with a Iptables 1.2.7a installed on it.  My
system runs DHCPD off of eth0 (which also is the only ethernet card on
that system).  I want the DHCP clients to be able to access the internet
using DHCP server, so I've been trying to set up NAT.  However, whenever
I run the script (copied below) I get the following error:
 
[root@male sysconfig]# ./myfilters 
iptables: Invalid argument
iptables v1.2.7a: Unknown arg `-j'
Try `iptables -h' or 'iptables --help' for more information.
./myfilters: line 38: ACCEPT: command not found
 
What changes do I need to make to this script to allow my system to
operate as a NAT server to my DHCP clients?
 
Thanks,
Ethan
 
//////////////////////////////////myfilters/////////////////////////////
/////////////////////////////////////
# set default (policy) rules
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
 
#IP spoofing, deny and packets on the internal network that has an
external source address.
iptables -A INPUT -j LOG -i eth0 \! -s 192.168.1.0/24
iptables -A INPUT -j DROP -i eth0 \! -s 192.168.1.0/24
iptables -A FORWARD -j DROP -i eth0 \! -s 192.168.1.0/24
 
# IP spoofing, deny any outside packets (any not on eth1) that have the
source address of the internal network
iptables -A INPUT -j DROP \! -i eth0 -s 192.168.1.0/24
iptables -A INPUT -j FORWARD \! -i eth0 -s 192.168.1.0/24
 
# IP spoofing, deny any outside packets with localhost address
# (packets not on the lo interface (any on eth0 or eth1) that have the
source address of localhost)
iptables -A INPUT -j DROP -i \! lo -s 127.0.0.0/255.0.0.0
iptables -A FORWARD -j DROP -i \! lo -s 127.0.0.0/255.0.0.0
 
# allow all incoming messages for users on your firewall system
iptables -A INPUT -j ACCEPT -i lo
 
# allow communication to the Web server (address 10.0.0.2), port www
# iptables -A INPUT -j ACCEPT -p tcp -i eth0 --dport www -s 10.0.0.2
 
# Allow established connections from Web servers to internal network
#iptables -A INPUT -m state --state ESTABLISHED,RELATED -i eth0 -p tcp
#--sport www -s 10.0.0.2 -d 192.168.1.0/24 -j ACCEPT
 
# Prevent new connection from Web servers to internal network
#iptables -A OUTPUT -m state --state NEW -o eth0 -p tcp --sport www
#-d 192.168.1.0/24 -j DROP
 
# allow established and related outside communications to your system
# allow outside communication to the firewall, except for ICMP packets
iptables -A INPUT -m state --state ESTABLISHED,RELATED -i eth0 -p \!
icmp -j
ACCEPT
 
# prevent outside initiated connections
iptables -A INPUT -m state --state NEW -i eth0 -j DROP
iptables -A FORWARD -m state --state NEW -i eth0 -j DROP
 
# allow all local communication to and from the firewall on eth0 from
the local network
iptables -A INPUT -j ACCEPT -p all -i eth0 -s 192.168.1.0/24
 
# Set up masquerading to allow internal machines access to outside
network
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
 
# Accept ICMP Ping (0 and 8) and Destination unreachable (3) messages
# Others will be rejected by INPUT and OUTPUT DROP policy
iptables -A INPUT -j ACCEPT -p icmp -i eth0 --icmp-type echo-reply -d
209.80.243.199
iptables -A INPUT -j ACCEPT -p icmp -i eth0 --icmp-type echo-request -d
209.80.243.199
iptables -A INPUT -j ACCEPT -p icmp -i eth0 --icmp-type
destination-unreachable -d 209.80.243.199
 
# Turn on IP Forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

[-- Attachment #2: Type: text/html, Size: 6167 bytes --]

                 reply	other threads:[~2003-05-22 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000001c32065$ecee45d0$6400a8c0@ethan' \
    --to=etrevino@mec.edu \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox