Migration of DA Server

boonchuan

Verified User
Joined
Dec 23, 2004
Messages
116
I need to migrate my DA server from one datacenter to another. This involves IP changes. I can change the IPs of the server, no issue, but my main question what do I do in the Directadmin? Which parts do I access to change the IPs?

Any other things i need to take note?
 
Run the swapip script; it's in the DirectAdmin scripts directory.

Jeff
 
Take this code, throw it in a bash script:

Code:
#!/bin/bash
#
if [ $# -ne "2" ] # make sure all args are there
then
        echo "Usage: $0 <ip/prefix> <hostname>";
        exit 1;
fi

IPADDR="$1"
HOST="$2"

eval `/bin/ipcalc -s -b -p -n -m ${IPADDR}`

set `IFS=".";echo ${NETWORK}`
OCT4="$(($4 + 1))"
GWAY="$1.$2.$3.${OCT4}"

set `IFS=".";echo ${HOST}`
if [ "$1" == "${HOST}" ]
then
        HOST="${HOST}.hostpc.com";
fi

echo "IP: ${IPADDR}"
echo "NM: ${NETMASK}"
echo "NW: ${NETWORK}"
echo "BC: ${BROADCAST}"
echo "GW: ${GWAY}"

IPADDR=$(echo $IPADDR | sed "s/\/.*//")

cd /usr/local/.bocacom

/etc/init.d/network stop
sleep 2

# Setup the IP address
echo "DEVICE=eth0" >/etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR=${IPADDR}" >>/etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK=${NETMASK}" >>/etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETWORK=${NETWORK}" >>/etc/sysconfig/network-scripts/ifcfg-eth0
echo "BROADCAST=${BROADCAST}" >>/etc/sysconfig/network-scripts/ifcfg-eth0
echo "ONBOOT=YES" >>/etc/sysconfig/network-scripts/ifcfg-eth0
[B]
echo "nameserver 4.2.2.2" >/etc/resolv.conf
echo "nameserver 4.2.2.1" >>/etc/resolv.conf
echo "search YOURDOMAIN.com" >>/etc/resolv.conf[/B]

echo "NETWORKING=yes" >/etc/sysconfig/network
echo "HOSTNAME=${HOST}" >>/etc/sysconfig/network
echo "GATEWAY=${GWAY}" >>/etc/sysconfig/network

echo "127.0.0.1                localhost.localdomain localhost" >/etc/hosts
echo "${IPADDR}                ${HOST}" >>/etc/hosts

hostname ${HOST}

echo "Shutting down system..."
shutdown now

Items in bold are the only thing you should have to change.

Run the script as root when it's ready to shutdown, before it's brought up on the new network

Joe
 
Joe can you please make it a bit more clear to which post you're responding?

Thanks.

Jeff
 
Back
Top