I have two servers hosted in IDC. I can only use ports 20/21/22/23/3389/33101-33109 to establish connections between two servers. The IDC network device will block any other packets whose source or destination port is not in the 20/21/22/23/80/3389/33101-33109 list/range. But the source port of SSH is random.
Using the command
ssh username@server -p remote_port
one can easily specify a remote port.
So is there an ssh
command parameter or some other way to specify a local source port so I can use, for example, port 33101 to establish the SSH connection?
Best Answer
You can not specify the source port for ssh client.
But you can use
nc
as a proxy, like this:From How can i set the source port for SSH on unbuntu server? (on ServerFault).