|
|
SSH: Listen on 2 ports
|
|
|
|
Registered User
Join Date: Mar 2001
Location: Farnborough, UK
Status:
Offline
|
|
Not sure if this is the most appropriate place, but...
My Mac is behind a router, and I use SSH to access it from work. The Mac can be connected to the router by either ethernet cable or wirelessly. I have the router forward WAN port 22 to the Macs wireless IP address.
However when the Mac is connected via ethernet cable (and I turn Airport off) this no longer works as the Mac acquires a different IP address (I have reserved IP addresses for an unrelated reason). Currently I use the routers public web admin interface to change the port forwarding to the other IP address.
In order to avoid this manual step, is there any way to setup the SSH server to listen on more than one port?
I have already tried to forward port 24 to 22 on my Mac. While this work if ssh'ing from the Mac itself, it does not work from work. (However because it doesnt show in the routers logs im guessing that is because I cannot access this port from work.)
Ideas?
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Location: Earth
Status:
Offline
|
|
Set up your wired/wireless networks to use the same IP/subnet mask. Then use the same IP (make sure you turn off airport when you are connected with ethernet).
It looks like your problem is not the port, but the IP address which is changing.
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Mar 2001
Location: Farnborough, UK
Status:
Offline
|
|
Sorry I should have been a little more clear, the router cannot forward from one external port to another internal port. It will only forward the same port number.
Therefore when I say I have forwarded 24 to 22 on the Mac, I mean I have used:
ssh localhost -L 24:localhost:22
When I try 'ssh -p 24 localhost' I can connect. However when I try 'ssh -p 24 domain.name' it fails and does not leave a trace in router log.
Setting the Mac to use the same wired/wireless IP would work but is not really my desired solution. Thanks for tip none the less though.
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2005
Status:
Offline
|
|
sudo vim /etc/sshd_config
Then find the Port option, uncomment it, and add a few more. You can do:
...
Port 22
Port 23
Port 24
...
You'll have to restart sshd for the changes to take effect after you save the file.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Badfort
Status:
Offline
|
|
|
You see, my friends, pirates are the key. - thalo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|