Linux Test method port is in communication -bash: telnet: command not found

telnet command is generally used to detect the use of a port, the newly installed linux system or Mac system may not support the telnet command, so we need to install it

1.linux installation:

yum install telnet

2.mac installation need to use a package manager brew

brew install telnet

 

Linux several common method of communication test port

  • 1 telnet method
  • 2 wget method
  • 3 ssh method
  • 4 curl method

1 telnet

# Usage: the Telnet ip Port 
# (1) the Telnet connection port does not exist in   
the Telnet 1.1.1.1 8 
    Trying 1.1.1.1 ...
    the Telnet: Connect to address 1.1.1.1 : the Timed OUT Connection
 # (2) the Telnet port link exists 
the Telnet 8000 1.1.1.1 
    Trying 1.1.1.1 ...
    Connected to 1.1.1.1.
    Escape character is '^]'.
    Connection closed by foreign host.

2 wget

# Usage: wget ip: Port 
# (1) there is no port
 wget 1.1.1.1:8  
    --2017-01-24 11:38:34-- http://1.1.1.1:8/   Connecting to 1.1.1.1:8... 
    failed: Connection timed out. Retrying.

# (2) the presence of port
 wget 1.1.1.1:8000
    --2017-01-24 11:39:03--  http://1.1.1.1:8000/
    Connecting to 1.1.1.1:8000... connected.
    HTTP request sent, awaiting response... 200 OK

3 ssh

# Usage: SSH username @ ip -v -p Port 
- v debug mode (print journal).
 - the p-designated port
There is no test is given, left to the reader test

4 curl

# Usage: curl IP: Port 
# (. 1) does not exist port 
    not obtain results
 # (2) There is a port 
    curl 1.1.1.1:8000 
    < DOCTYPE HTML!> 
    <HTML > 
        <head > XXX </ head> 
        <body >
            ......
        </body>
    </html>

Guess you like

Origin www.cnblogs.com/yoyowin/p/12145807.html