For Virtual Server Cloud and Cloud Server

In this article, we'll show you how to remove an additional public IPv4 or IPv6 address in a server with CentOS Stream 8 installed.

Prerequisite

You have unassigned the additional public IPv4 or IPv6 address in the Cloud Panel.

  • Log in to the server.

  • Open the file /etc/sysconfig/network-scripts/ifcfg-ens192 with the vi editor. To do this, enter the following command:

    [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens192

  • To remove the additional public IPv4 address from the network interface, delete the following entry:

    IPADDR1=<ADDITIONAL IPv4 ADDRESS>
    PREFIX1=32

    To remove the additional IPv6 address, delete the following entry:

    IPV6ADDR_SECONDARIES=<ADDITIONAL IPv6 ADDRESS>/64

  • Perform a reboot of the server. To do this, enter the following command:

    [root@localhost ~]# systemctl reboot

  • Log in to the server again.

  • To verify that the IPv4 address has been removed, enter the following command:

    [root@localhost ~]# ip addr