You are not logged in.

#1 2007-10-15 14:14:43

fiod
Member
Registered: 2007-04-02
Posts: 205

Automatic port forwarding?

Hey,

Suppose I have a network with 5 computers. Lets say they are all behind a router (meaning, with only one IP is available to the world).

Now lets say I want to launch sshd every time on a different computer, thus making that specific
computer available to the world via ssh.

Is there an automatic way to tell the router to which computer it should forward port 22?
I think I heard that UPNP is something similar to what I need. Am I correct?
How do I set it up in arch?

Thanks
Fiod

Offline

#2 2007-10-15 18:33:14

hungsonbk
Member
Registered: 2007-05-26
Posts: 105
Website

Re: Automatic port forwarding?

Hi mate,

I think the question here is very simple. You don't need any dynamic port forwarding at the router. The answer is at the ssh function, called Local port forwarding.

My Example will be like this:

your local network have 5 PC which the private ip address:
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
10.0.0.5

Your public IP address is 20.0.0.1, for example. At the router, you need to set up a static port forwarding, so the all request at port 22 to the public IP address will be forwarded to 10.0.0.1, for example. So now from the internet you can ssh to 10.0.0.1.

If you want to ssh to 10.0.0.2, for example, you need to open a command line  and use the follwing command:

#ssh -L 5678:10.0.0.2:22 username@20.0.0.1

username is the user you use to login 10.0.0.1

After logging in 10.0.0.1, on you computer, open another command line in another window and use the following command:

#ssh username1@127.0.0.1 -p 5678

now, username1 is the username on 10.0.0.2

To forward to other PCs in you network, you do the same steps. I suggest you use a different port, rather than port 22 at ssh server to avoid script kiddies trying to brute force your password.

Cheers.

Offline

#3 2007-10-16 19:10:30

fiod
Member
Registered: 2007-04-02
Posts: 205

Re: Automatic port forwarding?

Thanks a lot!

Will try to implement..

Thanks again, you helped me tons!

Offline

Board footer

Powered by FluxBB