View Full Version : Migration of DA Server
boonchuan
05-12-2008, 07:12 AM
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?
nobaloney
05-12-2008, 09:05 AM
Run the swapip script; it's in the DirectAdmin scripts directory.
Jeff
netdynamix
06-04-2008, 05:37 PM
Does anybody have a full how-to on migrating a server fully?
Chris
hostpc.com
06-04-2008, 09:34 PM
Take this code, throw it in a bash script:
#!/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
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
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
nobaloney
06-05-2008, 10:42 AM
Joe can you please make it a bit more clear to which post you're responding?
Thanks.
Jeff
hostpc.com
06-05-2008, 10:47 AM
Does anybody have a full how-to on migrating a server fully?
Chris
The script I posted will migrate the server, ip's and net configurations to the new location.
Powered by vBulletin™ Version 4.0.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.