Changing, Adding, and Removing IP Addresses
There are two options here: replacing your original addresses with the new ones or or adding the new addresses and deleting the originals at a later date.
Replacing your IP addresses is the simplest option. However it means taking your network interface offline briefly, and if you own your own domain name that points to the original IP address, changing that domain name to point to the new IP addresses may take up to 24 hours. During that time your site will be unreachable for anyone who has the old DNS entry cached.
Adding the new IP addresses is a little more complex, but does not take your service offline. Your original IP addresses still work while changes to DNS are propagating.
Replacing an IP Address
To replace the IP address in Debian derivatives (Debian and Ubuntu images) or Red Hat derivatives (CentOS and Fedora) you will edit a file. For other OS distributions, check your user documentation.
Replacing IPs in Debian/Ubuntu (after Debian Bullseye and Ubuntu 22)
Start by verifying you can log into the VPS using option 1 of the VPS console.
Back up your eth0 network file.
$ cp --backup --force /etc/systemd/network/00-eth0.network /etc/systemd/network/00-eth0.network
Open your eth0 network file with your preferred text editor. This example uses nano.
$ nano /etc/systemd/network/00-eth0.network
When your editor opens, you will see a file like this one:
[Match]
Name=eth0
[Address]
Address=OLDIpv4Address/24
[Route]
Gateway=64.62.188.1
[Network]
DHCP=no
IPv6AcceptRA=0
DNS=71.19.155.120
DNS=71.19.145.215
[Address]
Address=OLDIpv6Address
[Route]
Gateway=2605:2700:0:5::1
The addresses under address=
are your original IPv4 and IPv6 addresses, respectively. Edit the file to replace the IPv4 and IPv6 addresses with the new ones from your email, and make changes to the network, gateway, and DNS nameservers so the file looks like this:
[Match]
Name=eth0
[Address]
Address=NEWIpv4Address/24
[Route]
Gateway=71.19.155.1
[Network]
DHCP=no
IPv6AcceptRA=0
DNS=71.19.155.120
DNS=71.19.145.215
[Address]
Address=NEWIpv6Address
[Route]
Gateway=2605:2700:0:5::1
Save the file and exit the editor.
Log into the VPS using option 1 of the VPS console. From there, reload systemd’s configuration and restart systemd-networkd
.
$ systemctl restart systemd-networkd && systemctl daemon-reload
Note that you do not use the ifup
/ ifdown
commands with systemd-networkd
.
Verify the changes to your IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet NEWIPV4ADDRESS/24 brd 71.19.155.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 NEWIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::a800:ff:fe13:9b7a/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Replacing IPs in Debian/Ubuntu (pre Debian Bullseye)
Start by verifying you can log into the VPS using option 1 of the VPS console.
Back up your interfaces file.
$ cp --backup --force /etc/network/interfaces /etc/network/interfaces
Open your interfaces file with your preferred text editor. This example uses nano.
$ nano /etc/network/interfaces
When your editor opens, you will see a file like this one:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address OLDIPV4ADDRESS
netmask 255.255.255.0
gateway 64.62.188.1
dns-nameservers 71.19.155.120 71.19.145.215 8.8.8.8
iface eth0 inet6 static
address OLDIPV6ADDRESS
netmask 64
gateway 2001:470:1:41::1
The addresses under iface eth0 inet static
and iface eth0 inet6 static
are your original IPv4 and IPv6 addresses, respectively. Edit the file to replace the IPv4 and IPv6 addresses with the new ones from your email, and make changes to the network, gateway, and DNS nameservers so the file looks like this:
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address NEWIPV4ADDRESS
network 71.19.155.0
netmask 255.255.255.0
gateway 71.19.155.1
dns-nameservers 71.19.155.120 71.19.145.215 8.8.8.8
iface eth0 inet6 static
address NEWIPV6ADDRESS
netmask 64
gateway 2605:2700:0:17::1
Save the file and exit the editor.
Log into the VPS using option 1 of the VPS console. From there, flush the interfaces.
$ /sbin/ip addr flush dev eth0
Enable the changes you’ve made by bringing the interface down, then bringing it up again.
$ ifdown eth0 && ifup eth0
Verify the changes to your IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet NEWIPV4ADDRESS/24 brd 71.19.155.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 NEWIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::a800:ff:fe13:9b7a/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Replacing IPs in CentOS / Fedora
Start by verifying you can log into the VPS using option 1 of the VPS console.
Back up your IP configuration file.
$ cp --backup --force /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0
Open your IP configuration file with your preferred text editor. This example uses nano.
$ nano /etc/sysconfig/network-scripts/ifcfg-eth0
When your editor opens, you will see a file like this one:
DEVICE=eth0
IPADDR=OLDIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=64.62.188.1
NM_CONTROLLED=no
ONBOOT=yes
DNS1=71.19.155.120
DNS2=71.19.145.215
SEARCH=vm.tornadovps.net
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
PEERDNS=no
IPV6INIT=yes
IPV6ADDR=OLDIPV6ADDRESS/64
IPV6_DEFAULTGW=2001:470:1:41::1
The addresses under IPADDR
and IPV6ADDR
are your original IPv4 and IPv6 addresses, respectively. Edit the file to look like this:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=NEWIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=71.19.155.1
IPV6INIT=yes
IPV6ADDR="NEWIPV6ADDRESS/64"
IPV6AUTOCONF=no
IPV6_DEFAULTGW=2605:2700:0:17::1
Activate your changes after logging in using option 1 of the VPS console:
$ service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: lo: Disabled Privacy Extensions
[ OK ]
Bringing up interface eth0: Determining if ip address 17.91.151.121 is already in use for device eth0...
[ OK ]
Verify the new IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet NEWIPV4ADDRESS/24 brd 17.91.151.255 scope global eth0
inet6 NEWIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::a800:ff:fe13:9b7a/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Adding an IP Address
To add an IP address in Debian derivatives (Debian and Ubuntu images) you will edit a file. For Red Hat derivatives (CentOS and Fedora) you will add a new file. For other OS distributions, check your user documentation.
Adding IPs in Debian/Ubuntu (post Debian Bullseye and Ubuntu 22)
Start by verifying you can log into the VPS using option 1 of the VPS console.
Back up your eth0 network file.
$ cp --backup --force /etc/systemd/network/00-eth0.network /etc/systemd/network/00-eth0.network
Open your eth0 network file with your preferred text editor. This example uses nano.
$ nano /etc/systemd/network/00-eth0.network
When your editor opens, you will see a file like this one:
[Match]
Name=eth0
[Address]
Address=OLDIpv4Address/24
[Route]
Gateway=64.62.188.1
[Network]
DHCP=no
IPv6AcceptRA=0
DNS=71.19.155.120
DNS=71.19.145.215
[Address]
Address=OLDIpv6Address
[Route]
Gateway=2605:2700:0:5::1
The addresses under address=
are your original IPv4 and IPv6 addresses, respectively. Edit the file to add entries for the new IPv4 and IPv6 addresses from your email, and make changes to the network, gateway, and DNS nameservers so the file looks like this:
[Match]
Name=eth0
[Address]
Address=OLDIpv4Address/24
[Address]
Address=NEWIpv4Address/24
[Route]
Gateway=64.62.188.1
[Route]
Gateway=64.62.188.1
[Network]
DHCP=no
IPv6AcceptRA=0
DNS=71.19.155.120
DNS=71.19.145.215
[Address]
Address=OLDIpv6Address
[Address]
Address=NEWIpv6Address
[Route]
Gateway=2605:2700:0:5::1
Save the file and exit the editor. Log in to your VPS using option 1 of the VPS console.
From there, reload systemd’s configuration and restart systemd-networkd
.
$ systemctl restart systemd-networkd && systemctl daemon-reload
Verify the changes to your IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet OLDIPV4ADDRESS/24 brd 12.34.567.255 scope global eth0
valid_lft forever preferred_lft forever
inet NEWIPV4ADDRESS/24 brd 17.91.151.255 scope global eth0:0
valid_lft forever preferred_lft forever
inet6 NEWIPV6ADDRESS/64 scope global deprecated
valid_lft forever preferred_lft 0sec
inet6 OLDIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 ab60::b600:aa:fe07:7a9b/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Adding IPs in Debian/Ubuntu (pre Debian Bullseye and Ubuntu 22)
Start by verifying you can log into the VPS using option 1 of the VPS console.
Back up your interfaces file.
$ cp --backup --force /etc/network/interfaces /etc/network/interfaces
Open your interfaces file with your preferred text editor. This example uses nano.
$ nano /etc/network/interfaces
When your editor opens, you will see a file like this one:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address OLDIPV4ADDRESS
netmask 255.255.255.0
gateway 64.62.188.1
dns-nameservers 71.19.155.120 71.19.145.215 8.8.8.8
iface eth0 inet6 static
address OLDIPV6ADDRESS
netmask 64
gateway 2001:470:1:41::1
The addresses under iface eth0 inet static
and iface eth0 inet6 static
are your original IPv4 and IPv6 addresses, respectively. Edit the file to add entries for the new IPv4 and IPv6 addresses from your email, and make changes to the network, gateway, and DNS nameservers so the file looks like this:
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address NEWIP4ADDRESS
network 71.19.155.0
netmask 255.255.255.0
gateway 71.19.155.1
dns-nameservers 71.19.155.120 71.19.145.215 8.8.8.8
iface eth0 inet6 static
address NEWIPV6ADDRESS
netmask 64
gateway 2605:2700:0:17::1
auto eth0:0
iface eth0:0 inet static
address OLDIPV4ADDRESS
netmask 255.255.255.0
iface eth0:0 inet6 static
address OLDIPV6ADDRESS
netmask 64
Save the file and exit the editor. Log in to your VPS using option 1 of the VPS console.
To test the permanent configuration (which takes down the network temporarily) run the following:
$ ip addr flush dev eth0
Bring your interfaces down and bring them back up to implement your new IP addresses.
$ ifdown eth0 && ifup eth0 && ifup eth0:0
Verify the changes to your IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet OLDIPV4ADDRESS/24 brd 12.34.567.255 scope global eth0
valid_lft forever preferred_lft forever
inet NEWIPV4ADDRESS/24 brd 17.91.151.255 scope global eth0:0
valid_lft forever preferred_lft forever
inet6 NEWIPV6ADDRESS/64 scope global deprecated
valid_lft forever preferred_lft 0sec
inet6 OLDIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 ab60::b600:aa:fe07:7a9b/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Adding IPs in CentOS/Fedora
Start by verifying you can log into the VPS using option 1 of the VPS console.
To add a new IP in CentOS or Fedora, you will need to add a second configuration file and make a few changes to your original file.
Back up your IP configuration file.
$ cp --backup --force /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0
To save yourself some work, make your new configuration file by copying the original.
$ cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Add your new IPv4 and IPv6 addresses. Open your original IP configuration file with your preferred text editor. This example uses nano.
$ nano /etc/sysconfig/network-scripts/ifcfg-eth0
When your editor opens, you will see a file like this one:
DEVICE=eth0
IPADDR=OLDIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=64.62.188.1
NM_CONTROLLED=no
ONBOOT=yes
DNS1=71.19.155.120
DNS2=71.19.145.215
SEARCH=vm.tornadovps.net
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
PEERDNS=no
IPV6INIT=yes
IPV6ADDR=OLDIPV6ADDRESS/64
IPV6_DEFAULTGW=2001:470:1:41::1
The addresses under IPADDR
and IPV6ADDR
are your original IPv4 and IPv6 addresses, respectively. Edit the file to add the new IPv6 address from your email, remove the GATEWAY entry, and add the new IPv6 gateway to the IPV6_DEFAULTGW field. Add a third DNS address. When you’ve finished, the file will look like this:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=NEWIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=71.19.155.1
IPV6INIT=yes
IPV6ADDR="NEWIPV6ADDRESS"
IPV6AUTOCONF=no
IPV6_DEFAULTGW=2605:2700:0:17::1
IPV6ADDR_SECONDARIES="OLDIPV6ADDRESS/64"
Save your changes and close the editor.
Now, move your old IPv4 address to eth0:0. Using your preferred text editor, open the new IP configuration file that you created above. This example uses nano.
$ nano /etc/sysconfig/network-scripts/ifcfg-eth0:0
When your editor opens, you will see a file like this one:
DEVICE=eth0
IPADDR=OLDIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=64.62.188.1
NM_CONTROLLED=no
ONBOOT=yes
DNS1=71.19.155.120
DNS2=71.19.145.215
SEARCH=vm.tornadovps.net
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
PEERDNS=no
IPV6INIT=yes
IPV6ADDR=OLDIPV6ADDRESS/64
IPV6_DEFAULTGW=2001:470:1:41::1
Remove the IPv6 entries and edit the file to look like this:
DEVICE=eth0:0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=OLDIPV4ADDRESS
NETMASK=255.255.255.0
Save your changes and close the editor. Log in to your VPS using option 1 of the VPS console.
To test the permanent configuration instead (which takes down the network temporarily) run the following:
$ service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: lo: Disabled Privacy Extensions
[ OK ]
Bringing up interface eth0: Determining if ip address 12.34.567.89 is already in use for device eth0...
Determining if ip address 17.91.151.121 is already in use for device eth0...
[ OK ]
Verify the new IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet OLDIPV4ADDRESS/24 brd 12.34.567.255 scope global eth0
valid_lft forever preferred_lft forever
inet NEWIPV4ADDRESS/24 brd 17.91.151.255 scope global eth0:0
valid_lft forever preferred_lft forever
inet6 NEWIPV6ADDRESS/64 scope global deprecated
valid_lft forever preferred_lft 0sec
inet6 OLDIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 ab60::b600:aa:fe07:7a9b/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Removing an IP Address
If you add a new address rather than replacing the old one, you will probably still want to remove the old address at some point. Follow these procedures to do that.
Removing IPs in Debian/Ubuntu (Debian Bullseye, Ubuntu 22 and later)
Back up your eth0 network file.
$ cp --backup --force /etc/systemd/network/00-eth0.network /etc/systemd/network/00-eth0.network
Open your eth0 network file with your preferred text editor. This example uses nano.
$ nano /etc/systemd/network/00-eth0.network
When your editor opens, you will see a file like this one:
[Match]
Name=eth0
[Address]
Address=OLDIpv4Address/24
[Address]
Address=NEWIpv4Address/24
[Route]
Gateway=64.62.188.1
[Network]
DHCP=no
IPv6AcceptRA=0
DNS=71.19.155.120
DNS=71.19.145.215
[Address]
Address=OLDIpv6Address
[Route]
Gateway=2605:2700:0:5::1
The addresses under address=
are your original IPv4 and IPv6 addresses, respectively. Edit the file to remove the desired address.
[Match]
Name=eth0
[Address]
Address=NEWIpv4Address/24
[Route]
Gateway=71.19.155.1
[Network]
DHCP=no
IPv6AcceptRA=0
DNS=71.19.155.120
DNS=71.19.145.215
[Address]
Address=NEWIpv6Address
[Route]
Gateway=2605:2700:0:5::1
Save the file and exit the editor.
Log into the VPS using option 1 of the VPS console. From there, reload systemd’s configuration and restart systemd-networkd.
$ systemctl restart systemd-networkd && systemctl daemon-reload
Note that you do not use the ifup
/ ifdown
commands with systemd-networkd
.
Removing IPs in Debian/Ubuntu (pre Debian Bullseye or Ubuntu 22)
Start by verifying you can log into the VPS using option 1 of the VPS console.
Back up your interfaces file.
$ cp --backup --force /etc/network/interfaces /etc/network/interfaces
Open your interfaces file with your preferred text editor. This example uses nano.
$ nano /etc/network/interfaces
When your editor opens, you will see a file like this one:
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address NEWIP4ADDRESS
network 71.19.155.0
netmask 255.255.255.0
gateway 71.19.155.1
dns-nameservers 71.19.155.120 71.19.145.215 8.8.8.8
iface eth0 inet6 static
address NEWIPV6ADDRESS
netmask 64
gateway 2605:2700:0:17::1
auto eth0:0
iface eth0:0 inet static
address OLDIPV4ADDRESS
netmask 255.255.255.0
iface eth0:0 inet6 static
address OLDIPV6ADDRESS
netmask 64
Delete all the information for eth0:0, including the old IPv4 and IPv6 addresses and change eth0:0 to eth0. When you are finished the file should look like this:
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address NEWIP4ADDRESS
network 71.19.155.0
netmask 255.255.255.0
gateway 71.19.155.1
dns-nameservers 71.19.155.120 71.19.145.215 8.8.8.8
iface eth0 inet6 static
address NEWIPV6ADDRESS
netmask 64
gateway 2605:2700:0:17::1
Save the file and exit the editor. Log in to your VPS using option 1 of the VPS console.
To test the permanent configuration (which takes down the network temporarily):
Flush all interfaces to clear existing IP addresses.
$ ip addr flush dev eth0
$ ip addr flush dev eth0:0
Bring your interfaces down and bring them back up to implement your new IP addresses.
$ ifdown eth0 && ifup eth0
Verify the changes to your IP addresses:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet 17.91.151.121/24 brd 17.91.151.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2605:2070:0:71:b600:aa:fe07:7a9b/64 scope global
valid_lft forever preferred_lft forever
inet6 ab60::b600:aa:fe07:7a9b/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Removing IPs in CentOS / Fedora
Start by verifying you can log into the VPS using option 1 of the VPS console.
Note: Make certain that you have at least two configuration files before you delete one.
Back up your old configuration files, just in case.
$ cp --backup --force /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0
$ cp --backup --force /etc/sysconfig/network-scripts/ifcfg-eth0:0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Delete your eth0:0 file containing your old IPv4 address.
$ rm /etc/sysconfig/network-scripts/ifcfg-eth0:0
Open your eth0 IP configuration file with your preferred text editor. This example uses nano.
$ nano /etc/sysconfig/network-scripts/ifcfg-eth0
When your editor opens, you will see a file like this one:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=NEWIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=71.19.155.1
IPV6INIT=yes
IPV6ADDR="NEWIPV6ADDRESS"
IPV6AUTOCONF=no
IPV6_DEFAULTGW=2605:2700:0:17::1
IPV6ADDR_SECONDARIES="OLDIPV6ADDRESS/64"
Edit the file to look like this:
DEVICE=eth0
OOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=NEWIPV4ADDRESS
NETMASK=255.255.255.0
GATEWAY=71.19.155.1
IPV6INIT=yes
IPV6ADDR="NEWIPV6ADDRESS/64"
IPV6AUTOCONF=no
IPV6_DEFAULTGW=2605:2700:0:17::1
Close the editor and save your changes. Log in to your VPS using option 1 of the VPS console.
To test the permanent configuration (which takes down the network temporarily) run the following:
Activate your changes:
$ service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: lo: Disabled Privacy Extensions
[ OK ]
Bringing up interface eth0: Determining if ip address 17.91.151.121 is already in use for device eth0...
[ OK ]
Verify the new IP configuration:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether aa:00:00:13:9b:7a brd ff:ff:ff:ff:ff:ff
inet NEWIPV4ADDRESS/24 brd 17.91.151.255 scope global eth0
inet6 NEWIPV6ADDRESS/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::a800:ff:fe13:9b7a/64 scope link
valid_lft forever preferred_lft forever
Go to testing your connection.
Testing your connection
After you change, add, or remove an IP address, it is a good idea to test the connection with ping.
Test IPv4:
$ ping -c1 google.com
PING google.com (173.194.203.102) 56(84) bytes of data.
64 bytes from pg-in-f102.1e100.net (173.194.203.102): icmp_seq=1 ttl=47 time=22.7 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 46ms
rtt min/avg/max/mdev = 22.750/22.750/22.750/0.000 ms
Test IPv6:
$ ping6 -c1 ipv6.google.com
PING ipv6.google.com(nuq05s02-in-x0e.1e100.net) 56 data bytes
64 bytes from nuq05s02-in-x0e.1e100.net: icmp_seq=1 ttl=58 time=1.71 ms
--- ipv6.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 1ms
rtt min/avg/max/mdev = 1.711/1.711/1.711/0.000 ms
Congratulations, your new addresses are now up and running.
External Links
- Unfamiliar with IPv6? Try Hurricane Electric’s IPv6 certification.