Hello list,

I don't know if this is a rather dump question or not. I've looked through 
the FAQ and through Rusty's guides. In the latter I found the text that 'it 
wasn't really supported' to do NAT on connections originating on the box 
itselfs.

Basically: i want to do this

On my box X, i initiate an ssh connection to box Y on port 22. Before the 
connection is actually made the port must be 'rewritten' to 5000. (no, i 
can't use the ssh -p parameter), then the connection can be made.

I've tried many different setups with rules, but I can't get it correct.

If i'm correct it should be something like this:

iptables -t nat -A OUTPUT -p tcp --destination dest.box.ip --dport 22 -j DNAT 
--to-destination dest.box.ip:5000

this rule repeated twice, once for UDP and once for TCP.

IPTables accepts the input, but it doesn't work when I initate a connection 
with ssh dest.box.ip

Any ideas/patches/... to try?

Thanks!

DK

Reply via email to