Multi ip: Add a shared ip to all users at once

IceHosting

Verified User
Joined
Oct 6, 2004
Messages
20
Location
Netherlands
Hello,

We have just enabled ipv6 on one of our directadmin servers and we would like to assign in one request one shared ipv6 address to all users? (like the ipv4 shared server address)

Is this possible? Or does anyone know any hack to do a mass update?

Adding the second ip per account/domain manual is no option, since we have over 1000 users/domains on the server.

Thanks,

Roland
 
Thanks to smtalk for the following bash script and modified by myself:

Code:
#!/bin/sh

#Set the IP here, it could be either IPv4 or IPv6
IP="fe80:0:0:0:0:0:0:0"

#Does the IP address exist?
COUNT_IP="`grep -c \'${IP}\' /usr/local/directadmin/data/users/admin/ip.list`"

if [ ${COUNT_IP} -eq 0 ]; then
   echo "IP ${IP} does not exist. Exiting..."
   exit 1;
fi

for user in `ls /usr/local/directadmin/data/users`; do
{
   echo "Adding ${IP} to /usr/local/directadmin/data/users/$user/user_ip.list..."
   echo "${IP}" >> /usr/local/directadmin/data/users/$user/user_ip.list
   for domain in `cat /usr/local/directadmin/data/users/$user/domains.list`; do
   {
	if [ -e /usr/local/directadmin/data/users/$user/domains/$domain.ip_list ]; then
	    echo "Adding ${IP} to /usr/local/directadmin/data/users/$user/domains/$domain.ip_list..."
        echo "${IP}" >> /usr/local/directadmin/data/users/$user/domains/$domain.ip_list
	fi
   }
   done;
}
done;

exit 0;
 
Last edited:
After the script you need to rewrite the httpd config files

Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
 
Back
Top