Thank you all for your support.I found this article useful
http://www.debian-administration.org/articles/73
Ya portforwarding via IPTABLES is required.
and this post was also helpful after I got a clue to forward ports
http://www.linuxforums.org/forum/lin...orwarding.html
If some one comes for the same problem here
It should be some thing like this
Code:
iptables -A PREROUTING -i eth1 -p tcp -m tcp --dport 3000 -j DNAT --to-destination 192.168.1.9:22
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 3000 -j ACCEPT
iptables -A FORWARD -i eth1 -p tcp -m tcp --dport 3000 -j ACCEPT
The destination and ports will change according to your internal setup.The above IPTABLE rule will be used on the machine that is your router or Gateway.To forward a request coming on port 3000 on router to a machine internal 192.168.1.9 at port 22 where SSH runs.
192.168.1.9 is the IP of internal machine which I want to access from internet via outside.I have used port 3000 you can use any from 1024 onwards.
Suppose you are at a coffee shop outside and you want to access your machine behind the router
you will do
Code:
ssh Public IP of router:3000 -lusername
The following article is also useful
Code:
http://www.hackorama.com/network/portfwd.shtml