Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pascal Italiaander <pc-secure@home.nl>
To: Craig <elitesyntax@yahoo.com>, netfilter@lists.netfilter.org
Subject: Re: iptable question
Date: Wed, 18 Jun 2003 20:32:29 +0200	[thread overview]
Message-ID: <200306182032.29294.pc-secure@home.nl> (raw)
In-Reply-To: <20030618134048.90305.qmail@web14708.mail.yahoo.com>

Op woensdag 18 juni 2003 15:40, schreef Craig:
> How can i debug my iptables script?

put "set -x" on top of your script.
like this:

 #!/bin/sh

set -x

 # The location of the IPTables binary file on your
 system.
 IPT="/sbin/iptables"

 # The Internet interface. For ADSL or Dialup users,
 this should be "ppp0".
 # For a cable modem connection, this will probably be
 "eth0".
 INT="ppp0"

 # Out with the old stuff.
 $IPT -F
 $IPT -F INPUT
 $IPT -F OUTPUT
 $IPT -F FORWARD
 $IPT -F -t mangle
 $IPT -F -t nat
 $IPT -X

 # These will setup our policies.
 $IPT -P INPUT DROP
 $IPT -P OUTPUT ACCEPT
 $IPT -P FORWARD ACCEPT

 # Use this for NAT or IP Masquerading.
 echo 1 > /proc/sys/net/ipv4/ip_forward
 $IPT -t nat -A POSTROUTING -o $INT -j MASQUERADE

 # This rule protects your fowarding rule.
 $IPT -A FORWARD -i $INT -m state --state NEW,INVALID
 -j DROP

 # Port forwarding looks like this.
 #$IPT -t nat -A PREROUTING -i $INT -p tcp --dport 25
 -j DNAT --to 192.168.0.50
 #$IPT -t nat -A PREROUTING -i $INT -p tcp --dport 53
 -j DNAT --to 192.168.0.50
 #$IPT -t nat -A PREROUTING -i $INT -p udp --dport 53
 -j DNAT --to 192.168.0.50
 # These two redirect a block of ports, in both udp and
 tcp.
 #$IPT -t nat -A PREROUTING -i $INT -p tcp --dport
 2300:2400 -j DNAT --to 192.168.0.50
 #$IPT -t nat -A PREROUTING -i $INT -p udp --dport
 2300:2400 -j DNAT --to 192.168.0.50

 # This rule will accept connections from local
 machines.
 $IPT -A INPUT -i lo -j ACCEPT
 $IPT -A INPUT -s 192.168.0.0/24 -d 0/0 -p all -j
 ACCEPT

 # Drop bad packets.
 $IPT -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j
 DROP
 $IPT -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
 $IPT -A INPUT -p tcp --tcp-flags ALL
 SYN,RST,ACK,FIN,URG -j DROP
 $IPT -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
 $IPT -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j
 DROP
 $IPT -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j
 DROP

 # Drop icmp, but only after letting certain types
 through.
 $IPT -A INPUT -p icmp --icmp-type 0 -j ACCEPT
 $IPT -A INPUT -p icmp --icmp-type 3 -j ACCEPT
 $IPT -A INPUT -p icmp --icmp-type 11 -j ACCEPT
 $IPT -A INPUT -p icmp --icmp-type 8 -m limit --limit
 1/second -j ACCEPT
 $IPT -A INPUT -p icmp -j DROP


 =====
 EliteSyntax  www.linuxnewbie.org

have fun.
Pascal


  parent reply	other threads:[~2003-06-18 18:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-18 13:40 iptable question Craig
2003-06-18 15:20 ` Alistair Tonner
2003-06-18 15:37   ` Elitesyntax
2003-06-18 17:26 ` Geffrey Velasquez
2003-06-18 18:32 ` Pascal Italiaander [this message]
2003-06-19  3:42   ` Elitesyntax

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=200306182032.29294.pc-secure@home.nl \
    --to=pc-secure@home.nl \
    --cc=elitesyntax@yahoo.com \
    --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