Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] iptables: port forwarding



 --- Nguyen Vu Hung <vuhung@example.com> wrote:
> So I wanted to forward packet from 130.153.xxx.yyy(
> client side), tcp
> protocol, port 80 to where ssh-server listen. On the
> server side, I did:
> 
> bash-2.05# /sbin/iptables -t nat -A PREROUTING -i
> eth0 -p tcp --dport
> 80 -s 130.153.xxx.yyy -j REDIRECT --to-ports 22
> 
> and from client, I tried to connect:
> 
> $ssh -p 80 vuhung@example.com
> 
> but I got a connection timeout error :(

I think your server replied with source port 22(ssh).
But it must be masqueraded to 80.

So, try this:
iptables -t nat -A POSTROUTING -p tcp --sport 22 
-d 130.153.xxx.yyy 
-j SNAT --to IP.Address.Of.The.Server:80

---------
Susumu ISHIZUKA <sufiyanjp@example.com>

__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links