Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Landy Landy <landysaccount@yahoo.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: netfilter@vger.kernel.org
Subject: Re: Forward ssh to an internal server not working
Date: Wed, 1 Dec 2010 19:27:40 -0800 (PST)	[thread overview]
Message-ID: <728010.64913.qm@web62507.mail.re1.yahoo.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1012020401560.29349@obet.zrqbmnf.qr>


--- On Wed, 12/1/10, Jan Engelhardt <jengelh@medozas.de> wrote:

> From: Jan Engelhardt <jengelh@medozas.de>
> Subject: Re: Forward ssh to an internal server not working
> To: "Landy Landy" <landysaccount@yahoo.com>
> Cc: netfilter@vger.kernel.org
> Date: Wednesday, December 1, 2010, 10:02 PM
> On Thursday 2010-12-02 03:35, Landy
> Landy wrote:
> 
> >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 
> 
> This spts thing. It's redundant and does not protect
> anything.
> 

Even without --sport it doesn't work:


   1    60 DNAT       tcp  --  eth1   *       0.0.0.0/0            190.80.4.42         tcp dpt:22 to:172.16.0.200:22 



      

  reply	other threads:[~2010-12-02  3:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  2:35 Forward ssh to an internal server not working Landy Landy
2010-12-02  3:02 ` Jan Engelhardt
2010-12-02  3:27   ` Landy Landy [this message]
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=728010.64913.qm@web62507.mail.re1.yahoo.com \
    --to=landysaccount@yahoo.com \
    --cc=jengelh@medozas.de \
    --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