In this post i am going to explain about how to find if a port is opened or not in remote Linux / Unix box.
This may be achieved by using three command prompt tool. They are
- telnet,
- nmap and
- nc.
Telnet:
Using the telnet command we may trace whether the remote machine port is opened or not.
Sample example is given below
Sample example is given below
[root@client ~]#telnet yahoo.com 443
Trying 72.30.38.140…
Connected to yahoo.com (72.30.38.140).
Escape character is ‘^]’.
Trying 72.30.38.140…
Connected to yahoo.com (72.30.38.140).
Escape character is ‘^]’.
If the output is like connected to yahoo.com(remote machine) and in the next line Escape character is ‘^]’ . It clearly tells that 443 is a open port for domain yahoo.com
[root@client ~]# telnet yahoo.com 22
Trying 72.30.38.140…
telnet: connect to address 72.30.38.140: Connection timed out
Trying 72.30.38.140…
telnet: connect to address 72.30.38.140: Connection timed out
In the above example i am trying to find whether ssh port 22 is opened for yahoo.com(remote machine).
Its showing Trying 72.30.38.140(server IP) and connection timed out. It clearly shows that the remote host is not reachable.
Its showing Trying 72.30.38.140(server IP) and connection timed out. It clearly shows that the remote host is not reachable.
Netcat(nc)
Using the nc command also we may trace whether the remote host port is opened or closed.
Sample example is given below.
Sample example is given below.
[root@client ~]# nc -z google.com 80
Connection to google.com 80 port [tcp/http] succeeded!
Connection to google.com 80 port [tcp/http] succeeded!
-z —–> Specifies that nc should just scan for listening daemons, without sending any data to them.
nmap:
nmap is the best way to find the port check. It shall gives you all the details you are expecting.
Sample example for nmap.
Sample example for nmap.
[root@client ~]# nmap -v -A -p 80,443 google.com
Comments
Post a Comment