How Do I Exchange the Main and Additional IP Addresses on My Server?

Overview

This guide outlines the process for replacing the main and additional IP addresses for servers. The process for this can differ depending on the operating system (OS) and control panels you are using.


Please note that when planning to exchange IP addresses, DNS-related adjustments should be considered as a priority. As a best practice, we recommend updating DNS records at least 24 hours in advance and reducing the time-to-live (TTL) value to 300 seconds. This approach ensures that, in the event of any issues, the changes can be reverted within five minutes, minimizing potential disruption.


For VPS users, we strongly recommend creating a snapshot before making any network configuration changes. In the event of misconfiguration leading to unreachability, access can be restored via VNC or by reverting to a snapshot. Please note that restoring a snapshot will delete all data written between the time the snapshot was created and the time of the restore. Dedicated server users must request KVM access to resolve such issues.


Please follow the section below relevant to your server’s configuration to find out how to make these changes.


Table of Contents


Windows Server (2016, 2019, 2022) 

To replace the IP addresses on a Windows server, follow the steps below:

  1. Open the Windows Control Panel.
  2. From the Window Control Panel, open "Network and Internet".
  3. Next open "Network and Sharing Center".
  4. Select the relevant connection that you want to replace the IPs of. A window that looks like this should open:



  5. Click the "Properties" button.
  6. A new window will open, double click the option "Internet Protocol Version 4 (TCP/IPv4)"
  7. Another window will open where you can edit your main IP address, as well as your subnet mask, the default gateway etc. If you want to edit your additional IPs click the "Advanced" button and follow the steps a, b and c.

    1. A new window will open where you can see a list of your additional IPs. Click the additional IPs you want to replace and then click the "Edit" button. 
    2. A new window will open where you can edit your additional IPs. Once you're done making your changes, click "OK".
    3. On the "Advanced TCP/IP settings" window click the "OK" button.

  8. On the "Internet Protocol Version 4 (TCP/IPv4) Properties" window click "OK" to save your changes.
  9. To check the changes open CMD and run the following command:

    ipconfig


Red Hat-based Linux (RHEL, CentOS, AlmaLinux, Rocky Linux) 

To make these changes you will need to edit the interface file. The interface file can be different depending on your own setup, but it is usually located in /etc/sysconfig/network-scripts/ with filenames like ifcfg-eth0.

Once you know where the interface file is located, follow the steps below:

  1. First you will need to edit the main IP config (As mentioned above the interface file can be different so you may need to edit the command depending on where your interface file is setup). To access the main config run the following command:

    sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0  
  2. Once you have access to the main config, you will need to update the following:

    BOOTPROTO=static 
    IPADDR=NEW_MAIN_IP 
    NETMASK=NEW_NETMASK 
    GATEWAY=NEW_GATEWAY 
  3. Next you can add additional IPs (Create alias or secondary config files). To do this run the following command:  

    sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0:1 
  4. You will then need to update the following:

    DEVICE=eth0:1 
    BOOTPROTO=static 
    IPADDR=NEW_ADDITIONAL_IP 
    NETMASK=255.255.255.255 
    ONBOOT=yes
  5. Finally, restart the network service with the following command:

    sudo systemctl restart network 

Debian-based Linux (Debian, classic Ubuntu versions using interfaces) 

To make these changes you will need to edit the interface file. The interface file can be different depending on your own setup, but it is usually located at /etc/network/interfaces.

Once you know where the interface file is located, follow the steps below: 

  1. First you will need to open the configuration file. You can run the following command to open your configuration (As mentioned above the interface file can be different so you may need to edit the command depending on where your interface file is setup.):  

    sudo nano /etc/network/interface
  2. Once you have access to the configuration file you will need to replicate the example below with your own details:

    auto eth0
    iface eth0 inet static
      address NEW_MAIN_IP
      netmask NEW_NETMASK
      gateway NEW_GATEWAY
    
    
    # Additional IP
    iface eth0:0 inet static
      address NEW_ADDITIONAL_IP
      netmask 255.255.255.255 
  3. After you’ve made the changes, restart networking with the command below:

    sudo systemctl restart networking 
Ubuntu (Netplan-based systems) 

To make these changes you will need to edit the interface file. The interface file can be different depending on your own setup, but it is usually located in /etc/netplan/*.yaml.

Once you know where the interface file is located, follow the steps below:

  1. Run the following command to open the interface file. (As mentioned above the interface file can be different so you may need to edit the command depending on where your interface file is setup.):

    sudo nano /etc/netplan/01-netcfg.yaml 
  2. Next, update the file as shown in the example below:

    network: 
      version: 2 
      ethernets: 
        eth0: 
          addresses: 
            - NEW_MAIN_IP/24 
            - NEW_ADDITIONAL_IP/32 
          gateway4: NEW_GATEWAY 
          nameservers: 
            addresses:
     
  3. Finally, apply the configuration with the command below:

    sudo netplan apply 
    

Plesk Panel

Follow the steps below to exchange your IP addresses on Plesk:

  1. Login to Plesk as Administrator.
  2. Navigate to Tools & Settings > IP Addresses.
  3. Add the new IP Address.
  4. Remove the old IP address once the services and domains have been migrated.
  5. Update the DNS settings and hosting plans to reflect the new IP.



cPanel/WHM 

Follow the steps below to exchange your IP addresses on cPanel/WHM:

  1. Login to WHM as root.
  2. Go to Home > IP Functions > Add a New IP Address
  3. Enter the new IP address with netmask (e.g., 255.255.255.0) and assign to interface. 
  4. Go to IP Functions > Show or Delete IP Addresses to remove the old ones. 
  5. Update DNS zones, service IP bindings, and assigned accounts.



Additional Information

  • Always back up your current configuration before making changes. 
  • For additional IPs, 255.255.255.255 is often used as netmask.
  • Validate changes using ping, ip a, or ifconfig (if installed). 
  • After replacing IPs, test external connectivity and DNS resolution.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Modified on Mon, 2 Jun at 11:46 AM

Can’t find what you’re looking for?