0

Under the column "local address" of netstat:

0.0.0.0:22 means that access to port 22 is allowed from any ip addresses.

which ip addresses? ip addresses within my local network or outside my local network.

if 0.0.0.0:22 refers only to ip addresses within my local network, why I can connect to a server from my home computer which has IP address outside the local network of the server.

What does exactly 0.0.0.0:22 mean in terms of which IP addresses can connect to port 22.

3

0.0.0.0:22 in local address column means ssh daemon listen on all local ip.

So, if you have 2 IPs (say 192.168.0.10 and 90.87.65.123), your ssh daemon will listen on both IPs (and, of course on 127.0.0.1). So you can connect to it with both

$ ssh user@192.168.0.10
$ ssh user@90.87.65.123

assuming your computer knows the way to both networks.

If insteed of 0.0.0.0:22, it has been written 192.168.0.10:22, you could have connect with

$ ssh user@192.168.0.10

but not with

$ ssh user@90.87.65.123

In short, it has nothing to do with witch IP can connect but where listens the local daemon

| improve this answer | |
  • Thank you for clarification. Just one comment. When I connect to the server using ssh user@<server ip> from my home computer, <server_ip> is public static ip that I put in ssh command. In this scenario, what does 0.0.0.0:22 mean? I know that <server_ip> is not local ip address. Also, when I to connect to the server using SSH, we do not use local ip addresses something like 10.0.0.x or 192.168.x.x. – Mohi May 19 at 17:07
  • 1
    @Mohi: what you say is not clear for me. I have the impression that you are confusing the translations of addresses (NAT) necessary to reach a server inside a private network and the addresses that listen to the ssh daemon. This 0.0.0.0:22 is not a criterion for accepting connections based on the client's address. The 0.0.0.0:22 only has meaning on the local computer on which the netstat command was run and means that the ssh daemon listens on all the local IPs of this particular computer, this computer which may or may not be reached from the internet depending on the NAT rules of a firewall. – Renaud May 19 at 20:26
  • @Mohi just remember to mark the answer as accepted to credit the one who helped you, if you consider that it did answer what you asked. – Zip May 20 at 20:53
  • @Zip: How I can accept the answers. – Mohi May 21 at 11:00
  • @Mohi try reading on the FAQ – Zip May 21 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.