Batch IP addition / Adding

netearth

Verified User
Joined
Aug 5, 2004
Messages
45
Hi All,

I have just been assigned a block of IP addresses 256( / 24 ).

I note I can add IP addresses manually through IP on the Admin page, however is there a simpler way, and quicker and a lot less tiring on my finger tips? :D

If it means manually entering command or edditing files, please be specific as poss, im an NT bod, and as with most NT bods completly thick when it comes to Linux and the commands :eek:

Thanks,
Chris
 
Update :)

Right,

I have tried a.b.c.0-254 and DA goes away and adds say 50 of them in the higher range 200-241 it then sts that 241-254 already exist (although cannot see them in IP Management) as I had an attempt and then got back a 404 error earlier! :(

However it doesnt try to add 0-200 at all, so I though, I will try to add them in batches of say 30 (a.b.c.0-30), this just gives me an error but no explanation (bottom of the error is blank)

Any thoughts?

Chris:confused:
 
I needed to do the same thing. I ended up writing a bash script to do the job.

I will not provide help with this. It worked for me, if the next person that searches for this is skilled enough to understand what it does then hopefully it will help them too.

I didn't break anything, that I can tell ;)

This starts at .7 and add's the rest for the block. Edit to fit your subnet and IP range.

PHP:
#!/bin/bash

end=126
ip=7

while [ "$ip" -lt "$end" ]
do

echo "99.99.99.$ip" >> /usr/local/directadmin/data/admin/ip.list
echo "gateway=
netmask=255.255.255.128
ns=
reseller=
status=free
value=" > /usr/local/directadmin/data/admin/ips/99.99.99.$ip

ip=`expr $ip + 1`

done

chown -R diradmin.diradmin /usr/local/directadmin/data/admin/ips/
/etc/rc3.d/S11startips
 
Last edited:
Back
Top