Valid for Linux VPS, migrated Cloud Servers, and VPS+ running Ubuntu 24.04, Ubuntu 26.04, Debian 12, or Debian 13.

This article explains how to remove an additional public IPv4 address from a VPS, migrated Cloud Server, or VPS+ running Ubuntu 24.04, Ubuntu 26.04, Debian 12, or Debian 13.

Requirement

You have already removed the assignment of the additional public IPv4 address in the Cloud Panel. 

  • Log in to the server.

  • Change to the directory where the configuration file is located. To do this, enter the following command:

    [root@localhost ~]# cd /etc/netplan

  • Check the name of the configuration file and make a note of it. To do this, enter the following command:

    [root@localhost ~]# ls /etc/netplan

  • Open the configuration file. To do this, enter the following command:

    [root@localhost ~]# vi /etc/netplan/CONFIGURATION_FILE.yaml

    Example:

    [root@localhost ~]# vi /etc/netplan/01-netcfg.yaml

Note

The vi editor has an insert mode and a command mode. You can enter insert mode by pressing the [i] key. In this mode, the characters you type are inserted into the text immediately. To switch to command mode, press [ESC] afterwards. When you are in command mode, your keystrokes are interpreted as commands.

  • In the configuration file, delete the corresponding entry for the IPv4 address in the addresses section of the network interface. Make sure the indentation remains unchanged. Example:

    Before

    network:
     version: 2
     renderer: networkd
     ethernets:
       ens6:
         addresses:
           - 195.20.234.94/32    MAIN IPv4 ADDRESS
           - 195.20.234.86/32    ADDITIONAL IPv4 ADDRESS
           - 2a02:247a:21f:9c00::1/64    MAIN IPv6 ADDRESS
           - 2a02:247a:21f:9c00::2/64    ADDITIONAL IPv6 ADDRESS
         nameservers:
           addresses:
             - 212.227.123.16
             - 212.227.123.17
         routes:
           - on-link: true
             to: default
             via: 195.20.234.1

    After

    network:
     version: 2
     renderer: networkd
     ethernets:
       ens6:
         addresses:
           - 195.20.234.94/32    MAIN IPv4 ADDRESS
           - 2a02:247a:21f:9c00::1/64    MAIN IPv6 ADDRESS
         nameservers:
           addresses:
             - 212.227.123.16
             - 212.227.123.17
         routes:
           - on-link: true
             to: default
             via: 195.20.234.1

  • Press [i] and delete the entry for the IPv4 address to be removed from the addresses section of the configuration file.

  • To enter command mode, press [ESC]. Then enter the command :wq to save the text and close the editor.

  • To check the configuration file, enter the following command:

    [root@localhost ~]# netplan --debug apply

  • Restart the server so that the changes take effect. To do this, enter the following command:

    [root@localhost ~]# systemctl reboot