View Single Post
  #16  
Old 9th February 2010, 01:40
patrick3853 patrick3853 is offline
Member
 
Join Date: Dec 2008
Posts: 30
Thanks: 3
Thanked 7 Times in 3 Posts
Default

I recently changed the IP addresses of a server running ISPConfig 2 and stumbled upon this thread. Since the server was hosting many sites, I was looking for a more effecient way to update the IP for all the sites in ISPConfig. Thought I would share my solution in case anyone else has this issue.

Please note: this worked for me on ISPConfig 2 running on Ubuntu 8.10. Location of config files my be different depending on your system.

After you change the IP on the system, log into ISPConfig and replace the IP address under Management > Server > Settings. Then replace the IP address in config files:

xxx.xxx.x.xx represents new IP
yyy.yyy.y.yy represents old IP

Bind9
Code:
perl -pi -e 's/yyy\.yyy\.y\.yy/xxx.xxx.x.xx/g' /var/lib/named/etc/bind/*
Apache
Code:
perl -pi -e 's/yyy\.yyy\.y\.yy/xxx.xxx.x.xx/g' /etc/apache2/vhosts/*
Now, log into MySQL, use the ispconfig database, and run the following queries to update the IP in ISPConfig:

DNS Manager
Code:
UPDATE dns_a SET ip_adresse = 'xxx.xxx.x.xx';
UPDATE dns_isp_dns SET dns_soa_ip = 'xxx.xxx.x.xx';
ISP Manager
Code:
UPDATE isp_isp_web SET web_ip = 'xxx.xxx.x.xx';
UPDATE isp_isp_domain SET domain_ip = 'xxx.xxx.x.xx';
Of course, you will need to restart apache and bind. Now all sites should load and when you log into ISPConfig you will see the new IP for each site and all your DNS records. Go to one of your sites under ISP Manager, make a minor change and hit save so that ISPConfig rewrites the config files. Then verify that ISPConfig is using the new IP and you're good to go.
Reply With Quote