Removing a Public IP Address from a Linux Server (Ubuntu)

To remove a public IP address from a Linux server, proceed as follows:

Requirement

You have unassigned the additional public IP address in the Cloud Panel.

  • Log in to the server as an administrator.

  • To remove the additional IPv6 address, you must specify in /etc/network/interfaces to delete the following entries:

# The primary network interface
allow-hotplug ens192
iface ens192 inet dhcp
# IPV6 Setup
iface ens192 inet6 static
accept_ra 0
address MAIN IPv6 ADDRESS
netmask 64
gateway fe80::1
iface ens192 inet6 static
accept_ra 0
address additional IPv6 ADDRESS
netmask 64
gateway fe80::1

Example:

vi /etc/network/interfaces
# The primary network interface
allow-hotplug ens192
iface ens192 inet dhcp
# IPV6 Setup
iface ens192 inet6 static
accept_ra 0
address 2001:ba0:2020:1cc:3fe0:4d12:cd52:491a
netmask 64
gateway fe80::1
iface ens192 inet6 static
accept_ra 0
address 2001:ba0:2020:1cc:b62d:b9ef:e843:a0c1
netmask 64
gateway fe80::1
  • To restart the network, enter the following command:

/etc/init.d/networking restart