Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

print_ip_range

cidr="192.168.0.1/24"

# range is bounded by network (-n) & broadcast (-b) addresses.
lo=$(ipcalc -n $cidr |cut -f2 -d=)
hi=$(ipcalc -b $cidr |cut -f2 -d=)

read a b c d <<< $(echo $lo |tr . ' ')
# echo $a.$b.$c.$d
read e f g h <<< $(echo $hi |tr . ' ')
# echo $e.$f.$g.$h


for ip in {$a..$e}.{$b..$f}.{$c..$g}.{$d..$h};
do
    echo $ip
done;

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.