Valid for VPS, migrated Cloud Servers, and VPS+ with Debian 11 (without Netplan).

This article explains how to remove an additional public IPv4 address from a VPS, a migrated Cloud Server, or a VPS+ running Debian 11.

Requirement

You have cancelled the assignment of the additional public IPv4 or IPv6 address in Cloud Panel.

  • Log in to the server.

  • Open the etc/systemd/network folder. Enter the following command:

    root@debian:~# cd /etc/systemd/network

  • To check whether there is already a configuration file in this directory, enter the following command:

    [root@localhost ~]# ls /etc/systemd/network

  • Open the .network file for your network interface with the vi editor.

    [root@localhost ~]# vi /etc/systemd/network/10-NETWORK_INTERFACE.network

    Example:

    [root@localhost ~]# vi /etc/systemd/network/10-ens6.network

Note

The vi editor has an insert mode and a command mode. You can call up insert mode with the [i] key. In this mode, the characters entered are immediately inserted into the text. To call up command mode, press [ESC]. If you use command mode, your keyboard input is interpreted as a command.

  • In the [Network] section, remove the entry that contains the configuration for the additional IPv4 address. In the example below, the IPv4 address 74.208.98.26 must be removed.

    [Network]
    Address=74.208.61.32/24
    Gateway=74.208.61.1
    DNS=212.227.123.16,212.227.123.1

    # Additional IPv4 address
    Address=74.208.98.26/24

  • To exit vi and save the file, enter the command :wq and then press Enter.
  • To restart the systemd-networkd, enter the following command:

    [root@localhost ~]# sudo systemctl restart systemd-networkd

  • To check whether the desired IPv4 and IPv6 addresses have been configured correctly, enter the command ip addr show:

    [root@localhost ~]# ip addr