Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Landy Landy <landysaccount@yahoo.com>
To: netfilter@vger.kernel.org
Subject: Forward ssh to an internal server not working
Date: Wed, 1 Dec 2010 18:35:09 -0800 (PST)	[thread overview]
Message-ID: <241512.372.qm@web62506.mail.re1.yahoo.com> (raw)

Hello.

Can someone please tell me why I cannot access a machine inside my LAN from outside? These are my rules to try to accomplish that task:

$iptables -t nat -A PREROUTING -i $EXT_IFACE -p tcp \
        -s $UNIVERSE --sport $UNPRIVPORTS -d $EXT_IP --dport 22 \
        -j DNAT --to-destination 172.16.0.200:22

$iptables -A FORWARD -i $EXT_IFACE -o $LAN_IFACE -p tcp \
        -s $UNIVERSE --sport $UNPRIVPORTS -d 172.16.0.200 --dport 22 \
        -m state --state NEW -j ACCEPT

$iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

What am I doing wrong?

When I try to ssh from outside our network I can see it gets to the prerouting but, nothing gets forwared:

Chain PREROUTING (policy ACCEPT 1223 packets, 93798 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  374 19224 REDIRECT   tcp  --  eth0   *       172.16.0.0/16        0.0.0.0/0           tcp spts:1024:65535 dpt:80 redir ports 3128 
    0     0 REDIRECT   tcp  --  eth0   *       172.16.0.0/16        172.16.0.1          tcp spts:1024:65535 dpt:8080 redir ports 80 
    0     0 REDIRECT   tcp  --  eth1   *       0.0.0.0/0            190.80.4.42         tcp spts:1024:65535 dpt:8080 redir ports 80 
    3   180 DNAT       tcp  --  eth1   *       0.0.0.0/0            190.80.4.42         tcp spts:1024:65535 dpt:22 to:172.16.0.200:22 

Thanks in advanced for your help.


      

             reply	other threads:[~2010-12-02  2:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  2:35 Landy Landy [this message]
2010-12-02  3:02 ` Forward ssh to an internal server not working Jan Engelhardt
2010-12-02  3:27   ` Landy Landy
2010-12-02  3:29     ` Jan Engelhardt
2010-12-02  3:42       ` Landy Landy

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=241512.372.qm@web62506.mail.re1.yahoo.com \
    --to=landysaccount@yahoo.com \
    --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