Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Nathan March <nmarch@overdrawn.net>
To: netfilter@lists.netfilter.org
Subject: Suse 9.1 port forwarding woes
Date: Mon, 10 Jan 2005 12:28:53 -0800	[thread overview]
Message-ID: <41E2E585.9040308@overdrawn.net> (raw)

Despite my best attempts, I cannot seem to get port forwarding working 
on a suse 9.1 machine using iptables.

My firewall.sh:

#!/bin/bash

IPTABLES='/usr/sbin/iptables'

EXTIF='eth0'
INTIF1='eth1'
INTIF2='eth2'

/bin/echo 1 > /proc/sys/net/ipv4/ip_forward

$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -X

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

$IPTABLES -A FORWARD -m state --state ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -p icmp -m state --state RELATED -j ACCEPT


$IPTABLES -A FORWARD -i $INTIF1 -o $EXTIF -m state --state 
NEW,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF2 -o $EXTIF -m state --state 
NEW,ESTABLISHED -j ACCEPT

$IPTABLES -A INPUT --protocol tcp --dport 22 -j ACCEPT
$IPTABLES -A INPUT --protocol tcp --dport 25 -j ACCEPT
$IPTABLES -A INPUT --protocol tcp --dport 143 -j ACCEPT

$IPTABLES -A FORWARD -i eth0 -d 192.168.0.3 --protocol tcp --dport 80 -j 
ACCEPT
$IPTABLES -A PREROUTING -i eth0 -t nat -p tcp --dport 80 -j DNAT --to 
192.168.0.3:80


After the script runs:
linux:~ # iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:imap

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state 
ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere            state RELATED
ACCEPT     all  --  anywhere             anywhere            state 
NEW,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            state 
NEW,ESTABLISHED
ACCEPT     tcp  --  anywhere             192.168.0.3         tcp 
dpt:http flags:FIN,SYN,RST,ACK/SYN state NEW

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        
linux:~ # iptables -t nat --list
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination        
DNAT       tcp  --  anywhere             anywhere            tcp 
dpt:http to:192.168.0.3

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination        
MASQUERADE  all  --  anywhere             anywhere           

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Anyone have any ideas what I'm doing wrong?

Thanks,
Nathan


             reply	other threads:[~2005-01-10 20:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10 20:28 Nathan March [this message]
2005-01-10 20:32 ` Suse 9.1 port forwarding woes Jason Opperisano
  -- strict thread matches above, loose matches on Subject: below --
2005-01-11  1:30 Nathan March
2005-01-11 12:41 ` Jason Opperisano

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=41E2E585.9040308@overdrawn.net \
    --to=nmarch@overdrawn.net \
    --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