Home  >  Q&A  >  body text

网络 - 一台linux的机器, 如何简单的检测他是否能连接到外网?

大家都是用什么方法.

程序是python写的.

高洛峰高洛峰2744 days ago1102

reply all(14)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:36:43

    curl -l http://www.baidu.com

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:36:43

    Why not ping NetEase? NetEase is angry

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:36:43

    Ping a commonly used website, such as: ping www.baidu.com

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:36:43

    PING uses the ICMP protocol, and many hosts will directly discard ICMP packets.

    After reading everyone’s answers, wget or curl are more commonly used. These two are based on the HTTP protocol, and of course they can be used normally.
    In addition, I also provide a more commonly used tool, using telnet. For example, telnet www.baidu.com 80

    reply
    0
  • Cancelreply