Linux script detects whether the network is unblocked with the specified IP segment

Source: Internet
Author: User

The Linux script detects that the local link specifies whether the IP segment is unblocked, detects the specified IP through the ping command, detects the command execution result, and if 0 is unblocked, if 1 indicates that the network is unblocked, except that the specified machine disables the ping command. The code is as follows:

#!/bin/bash

#

For N in ' seq 121 237 '

Do

Ping-c1 192.168.10. $N &>/dev/null

If [$?-eq 0]

Then

echo "192.168.10. $N is up." >>/mnt/up_list.log

Else

echo "192.168.10. $N is down." >>/mnt/down_list.log

Fi

Done



This article is from the "experience-based staff" blog, please be sure to keep this source http://zhangjianxin.blog.51cto.com/10134758/1676799

Linux script detects whether the network is unblocked with the specified IP segment

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.