problems with iptables redirect of ssh

Luca Ferrari fluca1978 at infinito.it
Mon Jan 28 15:39:58 UTC 2008


On Monday 28 January 2008 Ruben Laban's cat, walking on the keyboard, wrote:

> It most likely works, just not to/from localhost. The PREROUTING chain is
> *not* used for such local traffic. If you'd test from another box in your
> lan, it will most likely show you the desired results.

Yeah, thanks you were right! It does not work for localhost. Now, more 
difficult: if I'd like to forward ssh to another host, the following line 
should work

$IPTABLES -t nat -I PREROUTING -p tcp --dport 2222  -j DNAT --to 
192.168.1.4:22

but when I try to connect from another host to the port 2222 I get blocked 
(i.e., the connection waits) and nothing happens.....Any suggestion?

Thanks,
Luca





More information about the ubuntu-users mailing list