检测port是否开启

检测本地主机port是否开启

  1. 明明服务已经开启,但是就是不能用,需要查看port是否开启。netstat命令

    选项:

    -r 列出路由表

    -n 不进行ip与主机解析

    -a 列出所有的链接状态

    -t tcp

    -u udp

    -l 监听

    -p 列出pid和program的文件名



    [root@www ~]# netstat -tulnp | grep 1187

    tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      1187/smbd

    tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      1187/smbd

    tcp        0      0 :::139                      :::*                        LISTEN      1187/smbd

    tcp        0      0 :::445                      :::*                        LISTEN      1187/smbd

  2. 使用telnet命令查本机端口是否启动


    [root@www ~]# telnet localhost 25

       Trying ::1...

       Connected to localhost.

       Escape character is '^]'.

       220 www.localdomain ESMTP Postfix

       ^]

       telnet> quit

       Connection closed.


检测远程主机端口是否开启,也是telnet命令

[root@www ~]# telnet 10.107.230.18 80

Trying 10.107.230.18...

Connected to 10.107.230.18.

Escape character is '^]'.

^]

telnet> quit

Connection closed

猜你喜欢

转载自blog.51cto.com/12107790/2104998