#!/bin/bash

ip=192.168.6.

for i in $(seq 1 254)

do

ping -c 1 $ip$i > /dev/null

if [ $? -eq 0 ]; then

echo $ip$i >> /root/ip

fi

done