Skip to content

How To Change A Server’s Main IP Address (including DNS records) In Plesk

This applies to a Windows Plesk server, running any kind of 8.x Plesk. First of, change your IP address through RDP in the Network Settings of Windows, then it's time to update Plesk -- like this.

Update Host's IP address in Plesk
update psa.ip_addresses set ip_address = '<new-ip-address>' where ip_address='<old-ip-address>'

Changing DNS records for all hosts:
update psa.dns_recs set host = '<new-ip-address>' where host = '<old-ip-address>';
update psa.dns_recs set displayHost = '<new-ip-address>' where displayHost = '<old-ip-address>';
update psa.dns_recs set val = '<new-ip-address>' where val = '<old-ip-address>';
update psa.dns_recs set displayVal = '<new-ip-address>' where displayVal = '<old-ip-address>';

Then run the following command:
websrvmng.exe --reconfigure-all

This will rebuild all Plesk-generated configs (in this case, for Apache) according to what's known within Plesk. This way, you can fairly quickly change the main IP address of a server, without a lot of hassle. However, this does not update the DNS config files.

The following should, in theory, also be possible:
websrvmng.exe --change-ip-address --new-ip-address=<new-ip-address> --old-ip-address=<old-ip-address>

Next, you have to start the command that rebuilds the DNS config, based on what's known within Plesk (as the websrvmng.exe does not update DNS records). The downside: the command needs to be entered for each domain in Plesk, so here's a script to make this slightly easier:

<?php
	$conn = mysql_connect("localhost:8306", "admin", "<plesk-pass>") or die (mysql_error());
	$dbconn = mysql_select_db("psa", $conn) or die (mysql_error());
 
	$sql = "SELECT * FROM domains AS d";
	$result = mysql_query($sql) or die (mysql_error());
 
	$output = "";
	$newline = "\n";
	while ($row = mysql_fetch_object($result)) {
		$output .= "DNSMng.exe update ". $row->name . $newline;
	}
 
	echo $output;
?>

This will generate all the commands, so you can copy paste them to a "execute.bat" file, and save that in the Plesk/Admin/Bin folder, so it can now execute the DNSMng.exe executable for each and every domain.

Comment Feed

One Response



Some HTML is OK

*

or, reply to this post via trackback.

Continuing the Discussion

  1. [...] http://mattiasgeniar.be/2009/07/26/how-to-change-a-servers-main-ip-address-including-dns-records-in-… This entry was posted on Tuesday, August 4th, 2009 at 9:28 am. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. [...]