zoukankan      html  css  js  c++  java
  • Linux 系统测试端口连通性的方法

    Linux 系统测试端口连通性的方法

    有四种常用方法:

    1. telnet 方法
    2. wget 方法
    3. ssh 方法
    4. curl 方法

    1.telnet 用法:telnet ip port

    #1.连接不存在的端口 
    telnet 1.1.1.1 8
     Trying 1.1.1.1...
     telnet: connect to address 1.1.1.1: Connection timed out
    #2.连接存在的端口
    telnet 1.1.1.1 8000
     Trying 1.1.1.1...
     Connected to 1.1.1.1.
     Escape character is '^]'.
     Connection closed by foreign host.
    

    2.wget 用法:wget ip:port

    #1.连接不存在的端口
     wget 1.1.1.1:8  
     --2020-01-24 11:38:34-- http://1.1.1.1:8/   Connecting to 1.1.1.1:8... 
     failed: Connection timed out. Retrying.
    
    #2.连接存在的端口
     wget 1.1.1.1:8000
        --2020-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 用法:ssh -v -p port username@ip

    -v 调试模式(会打印日志)
    -p 指定端口

    4.curl 用法:curl ip:port

    #1.连接不存在的端口
    	#没有结果
    #2.连接存在的端口
     curl  1.1.1.1:8000
     <!DOCTYPE html>
     <html>
         <head>xxx</head>
         <body>
             ......
         </body>
     </html>
    
  • 相关阅读:
    PAT B1021 个位数统计 (15)
    PAT B1006 换个格式输出整数 (15)
    PAT A1058 A+B in Hogwarts (20)
    PAT A1027 Colors in Mars (20)
    PAT A1019 General Palindromic Number (20 分)
    PAT B1022 D进制的A+B
    J2EE
    MVC
    数据库长连接短连接
    twisted
  • 原文地址:https://www.cnblogs.com/mumuda/p/15469066.html
Copyright © 2011-2022 走看看