Tag: Telnet detects whether the remote port is open
Method one. Common Telnet 118.10.6.128 88 way to test whether the remote host port is open.
Method Two. Nmap ip-p Port test ports
Nmap IP shows all open ports
Determines whether the port is open according to the display Close/open.
Method Three. NC-V Host Port
Port not open return status is not 0
One: Telnet
This method is often used to detect whether a remote port is unobstructed.
Test domain name: # telnet baidu.com 80Trying 123.125.114.144...Connected to Baidu.com (123.125.114.144). #==> appeared connected, indicating that Baidu's 80 port open escape character is ' ^] '. #==> Press "CTRL +]" to exit the area. ^]telnet> quitconnection closed. Test IP Address: # telnet 108.5.16.139 7506Trying 108.5.16.139...Connected to Static-108-5-16-139.nycmny.fios.verizon.net (108.5.16.139). #==> appears connected indicates connectivity, explaining 108.5.16.139 's 7506 Port open escape character is ' ^] '. #==> Press "CTRL +]" to exit ^]telnet> Quitconnection closed.
If the write script checks the port via Telnet, the following method can be used:
# echo-e "\ n" |telnet baidu.com 80|grep connectedconnection closed by foreign host. Connected to Baidu.com (123.125.114.144).
Second: through Nmap to check whether the port is unobstructed
# Nmap Etiantian.org-p starting Nmap 4.11 (http://www.insecure.org/nmap/) at 2012-07-22 17:22 pdtinterest ing ports on 211.100.98.99:port State service80/tcp open Httpnmap finished:1 IP address (1 host up) scanned in 0.417 s Econds
If you write a script through Nmap Check port can use the following method:
Port_count= ' Nmap $ip _add-p $port |grep open|wc-l ' [[$PORT _count-ge 1]] && echo "$ip _add $port is ok." | | echo "$ip _add $port is unknown."
Three: Check by NC command
# nc-w 8.8.8.8 && echo OK | | Echo No OK
This article is from "Operation and maintenance record Mei Ling" blog, please be sure to keep this source http://meiling.blog.51cto.com/6220221/1982402
Using Telnet to detect if a remote port is open under Linux