PDA

View Full Version : How do you add IP or assign IP.



aboyz
03-31-2004, 04:45 PM
Hi,

How do you add IP to directadmin and assign a different IP to each domain name?

Please advise..

thanks

aboyz
03-31-2004, 06:18 PM
Ok

I logged in as Admin and I go to IP MANAGER. and add the IP there?


Everytime i add a IP it says eth0 is added to that. What does that mean? it gave me a error but still it added in.

My questions is that. Is there a script I can add multiple IP like is there a script to detect what is in your
ifcfg-eth0
ifcfg-eth0:1
ans so on....

How do i get directadmin to auto update the IP from there? anyone know>?>?

Please advise..

thanks

ProWebUK
03-31-2004, 09:30 PM
Originally posted by aboyz
Ok

I logged in as Admin and I go to IP MANAGER. and add the IP there?

Yes... at the moment you must manually add each IP.. you can use the script from shell through:

/usr/local/directadmin/scripts/addip.sh

a very simply way to add multiple ips, create a file:



#!/bin/sh
ipaddys="111.111.111.111 222.222.222.222 333.333.333.333"
netmask=255.255.255.0
netint=eth0

for $IPS in $ipaddys
do
/usr/local/directadmin/scripts/addip $IPS $netmask $netint
done


Just replace 111.111.111.111 222.222.222.222 etc with your own ip addresses :)

Chris

aboyz
03-31-2004, 09:42 PM
argh..

I got it thanks for the info..

Manually adding it suck :) heheeheh

but i guess gotta do what you gotta do.. I got a full class C.. and that is not good for me..

ProWebUK
03-31-2004, 10:25 PM
Here you go......



#!/bin/sh
lowest_ip=111.111.111.0
highest_ip=111.111.111.60
netmask=255.255.255.0
netint=eth0

ip_prefix=`echo $lowest_ip | cut -d. -f1,2,3`
ip_low_ext=`echo $lowest_ip | cut -d. -f4`
ip_high_ext=`echo $highest_ip | cut -d. -f4`

while [ $ip_low_ext -le 60 ]
do
/usr/local/directadmin/scripts/addip $ip_prefix.$ip_low_ext $netmask $netint"
ip_low_ext=`expr $ip_low_ext + 1`
done


that will add all IPs between

111.111.111.XXX (lowest ip)
and
111.111.111.XXX (highest ip)

Basically if you specify:

lowest_ip=111.111.111.24
highest_ip=111.111.111.30

it will add IPs:

111.111.111.24
111.111.111.25
111.111.111.26
111.111.111.27
111.111.111.28
111.111.111.29
111.111.111.30

Hope that helps :)

Chris

aboyz
03-31-2004, 10:39 PM
Yeah that code really help when using redhat.. I'll keep that code for reference..

ProWebUK
03-31-2004, 10:53 PM
Originally posted by aboyz
Yeah that code really help when using redhat.. I'll keep that code for reference..

It should work on any system, it doesnt actually touch any OS specific files, only DA files (I assume it has addip on the FBSD systems...)

Chris

DirectAdmin Support
04-01-2004, 09:43 AM
FYI, you can add multiple IPs in one shot through the IP Manager as of 1.21.2:

http://www.directadmin.com/features.php?id=331

:)

John

aboyz
04-02-2004, 03:11 PM
nice..

so all i do in IP Manager is typed in

66.66.1.2-200

that will add all of 66.66.1.2 - 66.66.1.200?

is this correcT??

ProWebUK
04-02-2004, 03:22 PM
yes...