Linux Netfilter discussions
 help / color / mirror / Atom feed
From: David at roamware <david@roamware.co.uk>
To: netfilter@vger.kernel.org
Subject: Failing to get forwarding to work fully.
Date: Sun, 03 Feb 2008 16:53:59 +0000	[thread overview]
Message-ID: <47A5F1A7.4030308@roamware.co.uk> (raw)

Hi,

I have tried to get this iptables script on my Centos 4.4 machine 
working, with some help, but still have not succeeded in forwarding port 
722 to a machine on the LAN attached to the machine running iptables 
attached to the internet. The logging of the FORWARD packets just before 
drop tells me they are being forwarded. I also made sure the the LAN 
attached machine on eth0 does accept ssh -D 722 once I logged into the 
public facing machine via ssh. So I kinda assume it is the return packet 
that is the problem, but cannot see why. Ideas? 333.333.333.333 is 
substituted for the public IP addr, 111.111.111.111  222.222.222.222 are 
machines I want to be the only ones that can access. eth0 is the LAN NIC 
and eth1 is the public facing NIC.

# Generated by iptables-save v1.2.11 on Thu Dec 15 17:00:25 2005
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
-A INPUT -i eth0 -j LOG --log-level debug
-A INPUT -i lo -j ACCEPT
-A INPUT -s 192.168.0.0/255.255.255.0 -i eth0 -j ACCEPT
-A INPUT -s 192.168.0.0/255.255.255.0 -i eth1 -j DROP
-A INPUT -s 111.111.111.111 -p tcp --dport 22 -j ACCEPT
-A INPUT -s 222.222.222.222 -p tcp --dport 22 -j ACCEPT
-A INPUT -p ipv6-crypt -j ACCEPT
-A INPUT -p ipv6-auth -j ACCEPT
-A INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A INPUT -p udp -m udp --dport 631 -j ACCEPT
-A INPUT -d
333.333.333.333 -i eth1 -p icmp -m icmp --icmp-type any -j ACCEPT
-A INPUT -d 333.333.333.333 -i eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth1 -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --tcp-flags SYN,RST,ACK SYN -m limit --limit 5/sec -j ACCEPT
-A INPUT -p tcp -m multiport --dports 21,22,443,80,8080 -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j LOG --log-level debug
-A FORWARD -d 192.168.0.0/255.255.255.0 -i eth1 -o eth0 -p tcp -m multiport --dports 22,3306 -m state --state NEW -j ACCEPT
-A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -o eth1 -j ACCEPT
-A FORWARD -j LOG --log-prefix "FORWARD DROP: "
-A FORWARD -j DROP
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -s 333.333.333.333 -d 192.168.0.0/255.255.255.0 -o eth0 -j ACCEPT
-A OUTPUT -s 192.168.0.0/255.255.255.0 -d 192.168.0.0/255.255.255.0 -o eth0 -j
ACCEPT
-A OUTPUT -d 192.168.0.0/255.255.255.0 -o eth1 -j DROP
-A OUTPUT -s 333.333.333.333 -o eth1 -j ACCEPT
-A OUTPUT -j DROP
COMMIT
# Completed on Thu Dec 15 17:00:25 2005
# Generated by iptables-save v1.2.11 on Thu Dec 15 17:00:25 2005
*nat
:PREROUTING ACCEPT [2:208]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -d 333.333.333.333 -p tcp -j LOG --log-level debug
-A PREROUTING -i eth1 -p tcp -d 333.333.333.333 --dport 3307 -j DNAT --to-destination 192.168.0.223:3306
-A PREROUTING -i eth1 -p tcp -d 333.333.333.333 --dport 722 -j DNAT --to-destination 192.168.0.223:22
-A POSTROUTING -o eth1 -j SNAT --to-source 333.333.333.333
COMMIT


David



             reply	other threads:[~2008-02-03 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 16:53 David at roamware [this message]
2008-02-03 17:19 ` Failing to get forwarding to work fully Rob Sterenborg
2008-02-03 22:40   ` David at roamware
2008-02-04  6:29     ` Rob Sterenborg
  -- strict thread matches above, loose matches on Subject: below --
2008-02-03 16:52 David Wynter

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=47A5F1A7.4030308@roamware.co.uk \
    --to=david@roamware.co.uk \
    --cc=netfilter@vger.kernel.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