[olug] adding a ton of IPs to one interface automaticly

Dan Linder dan at linder.org
Sat Feb 13 03:27:00 UTC 2010


Does this shell script get you started?

You'll need to change the A, B, C, and D variables/ranges, set the
MASK variable, and change the "echo" command to suit your specific
"ifconfig" requirements.

#!/bin/bash
#
# Set IP address in this format: eth0:X = A.B.C.D

X=0
A=10
B=20
MASK="255.255.127.0"
for C in {0..255} ; do
  for D in {0..255} ; do
    # variableA=$((variableB*variableC))
    X=$(($X + 1))
    echo ifconfig eth0:${X} $A.$B.$C.$D mask $MASK
  done
done

Dan

-- 
***************** ************* *********** ******* ***** *** **
"Quis custodiet ipsos custodes?"
    (Who can watch the watchmen?)
    -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them."
    -- Isaac Asimov (Author)
** *** ***** ******* *********** ************* *****************



More information about the OLUG mailing list