The method of the Linux system test port connectivity

The method of the Linux system test port connectivity

There are four common methods:
1. Method Telnet
2. wget Method
3. ssh Method
4. curl Method

The following introduced one by one.

1. telnet
Usage: Telnet IP Port
(. 1) connected to the port does not exist  
Telnet 1.1.1.1. 8
    the Trying 1.1.1.1 ...
    Telnet: Connect to address 1.1.1.1: Connection Timed OUT
port (2) existing connections
telnet 1.1. 8000 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) connected to the port does not exist
 wget 1.1.1.1:8  
    --2017-01-24. 11: 38 is: Connecting to 1.1 34-- http://1.1.1.1:8/ .1.1: 8 ... 
    failed The:. Connection Retrying the Timed OUT.


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

3. ssh
Usage: SSH username @ ip Port -v -p
-v debug mode (print journal)
-p specifies the port
where the test is not given, left to the reader test.


4. curl
Usage: curl IP: Port
(. 1) connected to the port does not exist
    no results.
(2) the presence of a connection port
    curl 1.1.1.1:8000
    <! DOCTYPE HTML>
    <HTML>
        <head> XXX </ head>
        <body>
            ......
        </ body>
    </ HTML>

----------------
Disclaimer: This article is CSDN blogger "iw1210 'original article, follow the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/iw1210/article/details/78847363

Guess you like

Origin www.cnblogs.com/cnqfz/p/11416264.html