1. #!/bin/bash
    2. for i in {1..254}
    3. do
    4. ping -c2 i0.3 -W1 192.168.4.$i &>/dev/null
    5. if [ $? -eq 0 ];then
    6. echo "192.168.4.$i is up"
    7. else
    8. echo "192.168.4.$i is down"
    9. fi
    10. done