Knowledgebase

The swapip Script  Print this Article

Overview:

Use this script to update a domain’s IP address in the zone file. It will update the domain’s source IP address with the destination server’s IP address.

This script is useful for cPanel account transfers. When you transfer an account to a new server, you must update the account’s DNS records to match. You should also use this script if you did not select the Express Transfer option in WHM’s Transfer Tool interface (WHM >> Home >> Transfers >> Transfer Tool).

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/bin/swapip [sourceip] [destip] [ftpip] [domains]

Options

Use the following options with this script:

Options Description Example
sourceip Required - The source IP address. This is the original IP address that you want to change a DNS record from. 10.0.0.0
destip Required - The destination IP address. This is the IP address that you want to update a DNS record to. 172.16.0.0
ftpip Required - The destination server’s FTP IP address. 172.16.0.0
domains TRequired - he associated domain name. For multiple domains, separate each with a comma.
Note:
You must pass this option last.
example.com
Note:
The --help option will not provide help documentation. Instead, the script will return an error message.

Example

The following example changes the IP address (A record) in the DNS zone file for the example.com domain. It uses the 10.0.0.0 IPv4 address to point HTTP and FTP requests to the 172.16.0.0 IPv4 address:

/usr/local/cpanel/bin/swapip 10.0.0.0 172.16.0.0 172.16.0.0 example.com

If the script succeeds, the output will look like the following:

The system updated “1” entry.

If the script fails, it returns an error message that looks like the following:

1
2
Error: domains missing
Usage: /usr/local/cpanel/bin/swapip sourceip destip ftpip domains...
Note:
The error message may not return an accurate assessment of the error that occurs.

Was this answer helpful?

Related Articles

WHM Scripts
Overview: The cPanel & WHM installation process adds important scripts to your server’s...
The dbmaptool Script
Overview: You can use the /usr/local/cpanel/bin/dbmaptool script to grant ownership of databases...
The servers_queue Script
Overview: This script allows you to manage the task queue system. The task queue system allows...
The auto-adjust-mysql-limits Script
Overview: The /usr/local/cpanel/scripts/auto-adjust-mysql-limits script updates MySQL®...
The autossl_check Script
Overview: The /usr/local/cpanel/bin/autossl_check script allows you to manually check the SSL...