Batch Test local area network host online scripts

Source: Internet
Author: User

Batch Test local area network host online scripts

Because there are many hosts and many VLANs in the LAN, you can always know the number of online hosts and write scripts to check the online hosts.

The result is that the host is displayed in green online and the host is displayed in red offline.

Usage:./ping IP segment for example:./ping 192.168.0

#! /Bin/bashNETWORK = $ 1for HOST in $ (seq 1 254) do ping-c 1-w 1 $ NETWORK. $ HOST &>/dev/null & result = 0 | result = 1 if ["$ result" = 0]; then echo-e "\ 033 [32; 1 m $ NETWORK. $ HOST is up! \ 033 [0 m "else echo-e" \ 033 [; 31 m $ NETWORK. $ HOST is down! \ 033 [0 m "fidone

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.