Tuesday, November 25, 2008

how to change IP in Direct Admin

Steps for changing server ip and creating images.


**** Change server ip ****
Boot the server with the new server ip. (the new one you want to use)
DirectAdmin will not be running, as the license file will be invalid.
Contact DirectAdmin to obtain a new license file. They will change the ip in the license.
Get the new license file:

cd /usr/local/directadmin/scripts
./getLicense.sh UID LID

Where UID and LID are your client ID and your license id.
Ensure the license downloaded properly by making sure the file contains no error messages.
Start DirectAdmin with the new license:

service directadmin restart

(The taskq may have already started it, thus the restart instead of just "start")

Download the ipswap.sh script from directadmin:

wget http://www.directadmin.com/ipswap.sh
chmod 755 ipswap.sh

Execute that script with the old and and the new ip. Example:

./ipswap.sh 1.2.3.4 4.3.2.1

where 1.2.3.4 is your old ip and 4.3.2.1 is the new ip.
This script can be run on any ip, so if you want to change all ips with new ones, just run this script for each old ip with the new ip. Just ensure that you match the new server ip with the old one.

Restart everything:

service httpd restart
service proftpd restart
service exim restart
service vm-pop3d restart
...

Make sure they are correctly binding to the new ports by testing them.

You'll need to update the users list cache so that you see the new results in the show users lists:

echo "action=cache&value=showallusers" >> /usr/local/directadmin/data/task.queue


OR

Updating your DirectAdmin License manually Last Modified: Nov 17, 2005, 10:07 pm
If you need to update your DirectAdmin license manually, you can do so by running the following commands:

cd /usr/local/directadmin/scripts
./getLicense.sh 123 1234
service directadmin restart
Where 123 and 1234 are your Client ID and License ID, respectively. If there are errrors extracting the update.tar.gz file, then run:
head -n 1 /usr/local/directadmin/conf/license.key

to search for an error. If there is an readable error inside the file, double check the IP you are using matches the IP in the license on our system. Also check that it's active in our clients section. Failing that, you'll need to contact sales@directadmin.com to get your license activated or updated.

If you have multiple IPs on your device and wget is binding to the incorrect one, you can specify the IP to bind to by adding it as the last argument:

cd /usr/local/directadmin/scripts
./getLicense.sh 123 1234 1.2.3.4
service directadmin restart

**** Creating an Image ****

Install whatever additional services you want on the server (if you need up2date, this would be a good time)

Install a default copy of DirectAdmin on a server.
Be sure to install the customapache script.

Delete the license (doesn't really matter.. just so that nobody else gets a hold of it)

Create the image using whatever method you would like.


*** copy the image to the new server

Run the scripts you would normally run to setup the image properly.
Instead of manually changing the ip through DirectAdmin (as above), you can use the ipswap.sh script as decribed above to swap all instances of the IPs.

When you need to use the server, contact DirectAdmin, order a license using the new server's ip.
Once activated, use the getLicense.sh (see above) to download the license for this system.

Restart DirectAdmin and you should be up and running.


Special notice for VPS/VDS installs:

After the install, add:

ethernet_dev=devicename

for example, on many vps systems it will be:
ethernet_dev=venet0:0

other systems where the IP is not the base IP on the device, you'd need to simply set the correct number:
ethernet_dev=eth0:1

or other systems with the IP on a different device, it might be:
ethernet_dev=eth1

type: /sbin/ifconfig
to see which device your IP is in.

to /usr/local/directadmin/conf/directadmin.conf.
Replace devicename with the FULL devicename reported by ifconfig. If your VDS/VPS system emulates eth0, then you may skip this step.

No comments: