H
hostww
Guest
First: 72-48 hours before the transition, change all dns zones from TTL 14400 to TTL 120 and 86400 to TTL 180...
perl -pi.bak -e "s/14400/120/g" *.db
perl -pi.bak -e "s/86400/180/g" *.db
rndc reload
After 48 hours: Copy all accounts to the new server, and on the old server, use one of the following fowarding techniques for EACH ip... (I recommend the script!)
================================
"Manual IP Forwarding"
================================
echo "1" >/proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to newip:80
iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to newip:25
iptables -t nat -A PREROUTING -p tcp --dport 20 -j DNAT --to newip:20
iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT --to newip:21
iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to newip:110
iptables -t nat -A PREROUTING -p tcp --dport 53 -j DNAT --to newip:53
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to newip:53
iptables -t nat -A PREROUTING -p tcp --dport 1024:65535 -j DNAT --to newip
iptables -t nat -A PREROUTING -p udp --dport 1024:65535 -j DNAT --to newip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 80 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 25 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 20 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 21 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 110 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 53 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p udp --dst newip --dport 53 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p udp --dst newip --dport 1024:65535 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 1024:65535 -j SNAT --to-source oldip
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
This will foward dns, smtp, pop, web, mysql and ftp to the new server...
================================
"Scripted IP Forwarding"
================================
#!/bin/bash
#Forwarding By Paul Fleming
#Shouts to #cpanel on efnet
if [ "$UID" != "0" ]; then
echo "You must be root to use this tool"
exit 1
fi
DOWHAT=$1
case $DOWHAT in
'on')
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 --protocol tcp --destination-port ! 22 -j DNAT --to-destination $2
iptables -t nat -A PREROUTING -i eth0 --protocol udp -j DNAT --to-destination $2
echo "All Ports Excluding Port 22 Forwarded"
echo "Shutting Down Local Services"
service httpd stop
service pure-ftpd stop
service proftpd stop
service cpanel stop
;;
'off')
iptables -F
echo "Forwarding Off"
echo "Restarting Services"
service httpd restart
service cpanel restart
;;
*)
# how to use this thing.
echo "example: forward on 12.12.12.12 will enable forwarding to 12.12.12.12"
echo "forward off to disable"
echo "forward by Paul Fleming"
;;
================
Last: Change your dns on the registrar, and tell you clients about the new ips...
perl -pi.bak -e "s/14400/120/g" *.db
perl -pi.bak -e "s/86400/180/g" *.db
rndc reload
After 48 hours: Copy all accounts to the new server, and on the old server, use one of the following fowarding techniques for EACH ip... (I recommend the script!)
================================
"Manual IP Forwarding"
================================
echo "1" >/proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to newip:80
iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to newip:25
iptables -t nat -A PREROUTING -p tcp --dport 20 -j DNAT --to newip:20
iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT --to newip:21
iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to newip:110
iptables -t nat -A PREROUTING -p tcp --dport 53 -j DNAT --to newip:53
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to newip:53
iptables -t nat -A PREROUTING -p tcp --dport 1024:65535 -j DNAT --to newip
iptables -t nat -A PREROUTING -p udp --dport 1024:65535 -j DNAT --to newip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 80 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 25 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 20 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 21 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 110 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 53 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p udp --dst newip --dport 53 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p udp --dst newip --dport 1024:65535 -j SNAT --to-source oldip
iptables -t nat -A POSTROUTING -p tcp --dst newip --dport 1024:65535 -j SNAT --to-source oldip
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
This will foward dns, smtp, pop, web, mysql and ftp to the new server...
================================
"Scripted IP Forwarding"
================================
#!/bin/bash
#Forwarding By Paul Fleming
#Shouts to #cpanel on efnet
if [ "$UID" != "0" ]; then
echo "You must be root to use this tool"
exit 1
fi
DOWHAT=$1
case $DOWHAT in
'on')
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 --protocol tcp --destination-port ! 22 -j DNAT --to-destination $2
iptables -t nat -A PREROUTING -i eth0 --protocol udp -j DNAT --to-destination $2
echo "All Ports Excluding Port 22 Forwarded"
echo "Shutting Down Local Services"
service httpd stop
service pure-ftpd stop
service proftpd stop
service cpanel stop
;;
'off')
iptables -F
echo "Forwarding Off"
echo "Restarting Services"
service httpd restart
service cpanel restart
;;
*)
# how to use this thing.
echo "example: forward on 12.12.12.12 will enable forwarding to 12.12.12.12"
echo "forward off to disable"
echo "forward by Paul Fleming"
;;
================
Last: Change your dns on the registrar, and tell you clients about the new ips...