#!/bin/bash set -e # search for gateways on a class-a subnet # e.g. 10.0.0.0/8 echo -n writing to ips1 ips2 ips3 ... rm -f ips1 ips2 ips3 for b in `seq 0 255`; do for c in `seq 0 255`; do echo 10.$b.$c.1 >> ips1 echo 10.$b.$c.2 >> ips2 echo 10.$b.$c.254 >> ips3 done; unset c done; unset b echo done