On the Net

|Main Blog|Yearning|  

Words of God


About Linux News and OpenSource




and below are my posts....


Friday, October 19, 2007

Making your ssh server to act as a gateway by port forwarding

Ok, this is quick. My objective is to access the web, webmin and ssh of serverX. See below the text diagram.


[My Linux desktop]<-->[Routers]<-->[ssh server]<-->[routers]<-->[serverX]


Here's how.

-Create a file named config inside your $HOME/.ssh/

#.ssh/config
User root
LocalForward 20000 10.9.2.6:80
LocalForward 22000 10.9.2.6:22
LocalForward 20001 10.9.2.6:10000

I'm accessing as root, and the IP Add is the IP of serverX, you may put the hostname if you have it on you host file or dns. Ok, when finished on the file, if I connect to the ssh server..

[root@my desktop ~]# ssh -l root ssh-server
root@ssh-server's password:
[root@ssh-server ~]#

After able to established an ssh connection, on my local terminal, those ports listed on the file will open.

tcp 0 0 127.0.0.1:20000 0.0.0.0:* LISTEN 26163/ssh
tcp 0 0 127.0.0.1:20001 0.0.0.0:* LISTEN 26163/ssh
tcp 0 0 127.0.0.1:22000 0.0.0.0:* LISTEN 26163/ssh
tcp 0 0 127.0.0.1:46279 127.0.0.1:22000 ESTABLISHED 26166/ssh
tcp 0 0 127.0.0.1:22000 127.0.0.1:46279 ESTABLISHED 26163/ssh
tcp 0 0 127.0.0.1:40487 127.0.0.1:20000 TIME_WAIT -
tcp 0 0 ::1:20000 :::* LISTEN 26163/ssh
tcp 0 0 ::1:20001 :::* LISTEN 26163/ssh
tcp 0 0 ::1:22000 :::* LISTEN 26163/ssh

Then you can just access those locally and you are going to be connected to the serverX via ssh. If you wish to access serverX web server, just open a the your browser with url

http://127.0.0.1:20000

or if you wish to open the webmin, then type

http://127.0.0.1:20001


Note: Don not dis engaged your ssh connection to the ssh server, else you wont be able to connect on those 2xxxx ports.

Well, its not an original trick, just found those by searching, I just need to compile for future reference.


Thanks.

10 Comments:

  • Hello.. Do you know how to Add Adsense Code Inside Single Post Only in XML Template? Visit your blog to learn how.. Have a nice thursday!

    By Blogger Hapi, at 4:19 PM  

  • hello... hapi blogging... have a nice day! just visiting here....

    By Blogger Hapi, at 8:30 AM  

  • Download Forum Poster V3 3.0 at FileAfro.com

    http://www.fileafro.com/view_forum-poster-v3-30.html

    By Blogger File, at 9:00 AM  

  • hello... you may submit this blog to my webBlog Directory, keyworddir.info.. have a nice day!

    Keyword Directory

    By Blogger Keyword, at 10:30 PM  

  • By Blogger natasha, at 1:30 PM  

  • Looking for Sex Partner in Davao City? Visit Here!

    By Blogger indavao, at 9:43 AM  

  • hi.. just dropping by here... have a nice day! http://kantahanan.blogspot.com/

    By Blogger tagskie, at 9:00 PM  

  • Hi... Looking ways to market your blog? try this: http://bit.ly/instantvisitors

    By Blogger JanuskieZ, at 3:30 AM  

  • thanks,this is my site
    http://kaminyoon.blogspot.com/.. be a follower..more wedding ideas!

    By Blogger joven, at 7:00 AM  

  • http://loveumuch143.blogspot.com/..learn how to love more deeper...be a follower..thanks..

    By Blogger joven, at 7:00 AM  

Post a Comment

Links to this post:

Create a Link

<< Home