1

I have a Linux server to SSH, and the old port number was 1818. Recently there's been a network issue in my country that I had issue reaching my server port 1818. So I decided to change it to another port, like 46000. I then changed it to lower port number like 1994, and it worked well too.

But the issue is time I wait to get the first response when trying to do SSH port number 46000 is much longer than time spending on 1994.

Let me first explain my assumption: when I use ssh root@ip -p1994, my network checks the ports from 1 to 65535, and because 1994 is lower than 46000, so it takes less time to connect than 46000. My assumption is something like this:

check if port is correct:

is 1 SSH port? if no, ignore; else connect.

is 2 SSH port? if no, ignore; else connect.

...

is 1994 SSH port? so I (my network) and the server connect to each other.

While 46000 is much more down in my assumption, then it takes much longer to connect.

Is my assumption for this issue correct? If no, then what is the logic of this delay in connecting?

Thanks in advance

2
  • 2
    Your assumption is wrong. There should be no difference, regardless of the selected port. Mar 20, 2020 at 13:52
  • Thanks, but you mean the time it takes to connect to another server's port number 1 should be the same as 65535? I did not find any articles or question whether my assumption is right or wrong. The you mean they should have the same time? Do you believe there's an issue in my network that takes time?
    – Saeed
    Mar 20, 2020 at 14:05

1 Answer 1

2

Let me first explain my assumption: when I use ssh root@ip -p1994, my network checks the ports from 1 to 65535

This assumption is incorrect. Packets will be sent to port 1994 immediately. No need to do anything like a port scan.

An analogy: there is no need to check every apartment in a residential building before mailing a parcel to a street address. The mail piece just goes straight to the destination.


Ask your service provider which port you can run a ssh service on, ideally 22/tcp. Colocated datacenter hosting or public clouds tend to rely on ssh and allow it. Residential Internet services tend to discourage running "servers".

Not the answer you're looking for? Browse other questions tagged .