All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Perry <wlperry@williamperry.com>
To: netfilter@lists.netfilter.org
Subject: no connection
Date: Sat, 19 May 2007 19:53:55 -0700	[thread overview]
Message-ID: <464FB843.5030605@williamperry.com> (raw)

I am using the following iptables script:
# eth0 is the Local network
# eth1 is the External network
 
*filter
:INPUT   DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT  DROP [0:0]
 
#allow traffic from the firewall to go out
-A FORWARD -i eth0 -o eth1 -j ACCEPT
-A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# allow local loopback connections
-A INPUT -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
 
# Allow all connections to the local network
-A INPUT -i eth0 -s 123.123.123.0/24 -j ACCEPT
-A OUTPUT -o eth0 -d 123.123.123.0/24 -j ACCEPT
 
# drop INVALID connections
-A INPUT   -m state --state INVALID -j DROP
-A OUTPUT  -m state --state INVALID -j DROP
-A FORWARD -m state --state INVALID -j DROP
 
# allow all established and related
-A INPUT   -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT  -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# allow connectionsto my ISP's DNS servers
-A OUTPUT   -d 206.13.31.12 -m state --state NEW -p udp --dport 53 -o 
eth1 -j ACCEPT
-A FORWARD  -d 206.13.31.12 -m state --state NEW -p udp --dport 53 -i 
eth0 -o eth1 -j ACCEPT
 
-A OUTPUT   -d 206.13.28.12 -m state --state NEW -p udp --dport 53 -o 
eth1 -j ACCEPT
-A FORWARD  -d 206.13.28.12 -m state --state NEW -p udp --dport 53 -i 
eth0 -o eth1 -j ACCEPT
 
# allow outgoing conections web servers
-A OUTPUT  -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -p tcp 
--dport http -o eth1 -j ACCEPT
-A FORWARD -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -p tcp 
--dport http -o eth1 -i eth0 -j ACCEPT
 
-A OUTPUT  -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -p tcp 
--dport https -o eth1 -j ACCEPT
-A FORWARD -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -p tcp 
--dport https -o eth1 -i eth0 -j ACCEPT
 
# allow outgoing conections ntp
-A OUTPUT  -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -p tcp 
--dport 123 -o eth1 -j ACCEPT
-A FORWARD -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -p tcp 
--dport 123 -o eth1 -i eth0 -j ACCEPT
 
# Log all other attempts to out-going connection
-A OUTPUT   -o eth1 -j LOG --log-level info --log-prefix "[ATTEMPTED] "
-A FORWARD  -o eth1 -j ACCEPT
 
-A FORWARD  -j LOG --log-level info --log-prefix "[FWD-] "
-A FORWARD  -o eth0 -j ACCEPT
 
COMMIT
 
*nat
-A POSTROUTING -o eth1 -j SNAT --to 71.133.232.116
 
#port forward port 80
-A PREROUTING -d 71.133.232.116 -i eth1 -p tcp -m tcp --dport 80 -j DNAT 
--to-destination 123.123.123.2:80
 
COMMIT
 
#----
I was expecting the firewall (external ip 71.133.232.116) to send the 
packets to the web server (123.123.123.2), but it appears that the 
packets are not going anywhere.

Test:
use a machine whose gateway is not 71.133.232.116 and execute:
wget http://71.133.232.116/

1. On the log file of the firewall, I see a log record indicating that 
the "[FWD-]" log was hit.
2. On the web server, I see no record in the access log file.
3. No response is received to the wget command.

Isn't the prerouting command enough to get the packets to go? What do I 
need to do to get iptables to actually send the packet?
-- 
William Perry



                 reply	other threads:[~2007-05-20  2:53 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=464FB843.5030605@williamperry.com \
    --to=wlperry@williamperry.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.