Wednesday, September 1, 2010

To Check Port is open or not

Before trying to connect a remote server it is better to check that sever is listening at the expected port ( Example mysql listens at 3306 and ssh 20 )

>telnet ip port

For example ip address 123.34.23.37 and I want to do ssh which listen by default 22
So need to check whether port 22 is listening then command would be :
>telnet 123.34.23.37 22
Above command will return some junk characters then it means open.
Otherwise it will return "telnet: Unable to connect to remote host: Connection refused"
that means its not opened..
Possible reasons : firewall is blocking or no service at that port to listen.

No comments: