使用 curl 进行端口测试的方法

66 阅读1分钟

  使用 curl 进行端口测试的方法

  • 测试通过样例
</html>[root@LAPTOP-CHOA4ICV ~]# curl -v 192.168.31.171:81
* About to connect() to 192.168.31.171 port 81 (#0)
*   Trying 192.168.31.171...
* Connected to 192.168.31.171 (192.168.31.171) port 81 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 192.168.31.171:81
> Accept: */*
>
  • 测试不通过样例
[root@LAPTOP-CHOA4ICV ~]# curl -v 192.168.31.171:81
* About to connect() to 192.168.31.171 port 81 (#0)
*   Trying 192.168.31.171...
* Connection refused
* Failed connect to 192.168.31.171:81; Connection refused
* Closing connection 0
curl: (7) Failed connect to 192.168.31.171:81; Connection refused
[root@LAPTOP-CHOA4ICV ~]#