自动找出本地网关地址,然后检查网关具体丢包的情况

check.bat

#!/bin/bash

# Get the gateway IP
gateway=$(ip route show default | awk '/default/ {print $3}')

# Use ping to check the gateway connection and get the packet loss statistics
result=$(ping -c 10 $gateway | awk -F, '/packet loss/ {print $3}')

# Extract the packet loss percentage
loss=$(echo $result | awk '{print $1}' | tr -d '%')

# Check the packet loss percentage
if [ $loss -gt 10 ]; then
  echo "The gateway is experiencing high packet loss ($loss%)."
else
  echo "The gateway is working properly ($loss%)."
fi
阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6