Update new set of IPs for a dedicated server

Description of your first forum.
Post Reply
emilyanderson230
Posts: 8
Joined: Thu Jan 22, 2015 3:44 pm

Update new set of IPs for a dedicated server

Post by emilyanderson230 » Wed Jun 17, 2015 4:24 pm

Hello All,

How to update new set of IPs on a dedicated server


Thanks

Lillianlee
Posts: 10
Joined: Tue Jan 20, 2015 4:23 pm

Re: Update new set of IPs for a dedicated server

Post by Lillianlee » Thu Jun 18, 2015 9:24 am

Please follow the below steps to replace your current IP addresses with the new IP addresses:

• Add the IP addresses to your server network interface
• Configure the DNS to work with the new IP addresses
• Update Apache to listen and serve pages from the new IP addresses


These steps are as follows:

Adding the new IP addresses to your network interface

1 Edit the file: /etc/network/interfaces
This configures all the IP addresses your server responds to. You should see a section for each of your existing IP addresses which are divided by blank lines. Each of the IP addresses has an interface name associated with it. Your server’s primary IP address will have an interface name that doesn’t include a colon, such as;
eth0

2 The other IP addresses will have an interface name (the primary interface’s name) followed by a colon and then another number, such as eth0:0 or eth0:1. There will also be a section labeled lo which is the section for the loopback interface. You do not need to make any changes to the lo section.

3 Our old and new IP addresses will need to both work together for a transitional period. Thus, we will now add additional sections for your new IP addresses while still keeping the old ones in place.

4 Start by creating a section for a new primary interface. To do that, copy all the existing lines that define the existing primary interface. These should contain a gateway line and usually a pre-up line too. Change the IP address and the gateway in the new primary interface to the new addresses. Now delete any gateway and pre-up lines in the old primary interface, while leaving the IP address defined.

5 You will need to create a new section for each IP. Copy the entire section from the previous IP and then change the IP address to the equivalent one. Do this for each additional IP address.

6 Finally, you will need to renumber the sections so that the numbering is consistent. The new primary IP address needs to be the interface name without the colon-number suffix, such as eth0. Each of the other interfaces, including the old primary interface, need a unique colon-number, starting from: 0 and working up without any gaps:
eth0:0
eth0:1
eth0:2
and so on.
For example:
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 109.104.77.000
netmask 255.255.254.0
gateway 109.104.77.254
pre-up /usr/sbin/ethtool -s eth0 speed 10 duplex full autoneg off
auto eth0:1
iface eth0:1 inet static
address 62.44.83.163
netmask 255.255.254.0
auto eth0:0
iface eth0:0 inet static
address 109.104.77.000
netmask 255.255.254.0
auto eth0:2
iface eth0:2 inet static
address 62.44.83.000
netmask 255.255.254.0

7 Before you save the file, check to see that you have one primary interface definition eth0. This is the new IP address and it will have a new gateway. Also ensure that each of the other IP addresses, both old and new, have their own definition that the gateway line has been removed from the old primary IP address, and that each of the interfaces has a unique number.

8 Save the file, and then run this command to restart your network, using the new IP addresses:
/etc/init.d/network/restart

Configure the DNS to work with the new IP addresses

1 Edit the file:
/usr/local/djbdns/service/tinydns/env/IP
and remove all its existing content, replacing it with the single line:
0.0.0.0

2 Do the same for the file:
/usr/local/djbdns/service/axfrdns/env/IP

3Save both files, and run these commands:
svc -d /service/tinydns ; svc -u /service/tinydns
svc -d /service/axfrdns ; svc -u /service/axfrdns

Update Apache to listen and serve pages from the new IP addresses

1 You will now need to update all mentions of your old IP address everywhere in your Apache config to now mention both the old and new IP address. This depends on how you have configured Apache.

2 If you are running a chroot set-up then you may have two separate Apache instances which you will need to update. In the default installation there was an Apache instance running the control panel, configured by the files in the:
/etc/apache-ssl/
Directory and an Apache instance for your websites, configured by:
/usr/fs/etc/apache2/

3 IP addresses can be mentioned in two forms: Listen directives, and VirtualHostdirectives.

4 Duplicate each line that starts with Listen followed by an IP address in order to have two identical Listen directives on adjacent lines. Now change the IP address on one of them to the equivalent new IP address. After the IP address should be a colon and then a port number (a single integer, probably :80 or :443); do not change this.

5 There may also be some Listen directives which just mention a port number and no IP address. If so, leave these alone.

6 Add a space after the IP address for each line that starts with VirtualHost followed by an IP address and port number. Then add the new IP address followed by a colon and the same port number as the old IP address. If the line already has multiple IP addresses, add a new IP address for each one, separating them with spaces. The line can be as long as needed, but ensure that there is no line-break character splitting the directive into multiple lines. The end of the line, after all the IP addresses, must be a single >" character.

7 There may also be some Listen directives which don't mention any IP address. If so, leave these alone.

8 In the default config, you will need to edit these files:
/etc/apache-ssl/httpd.conf -- both Listen and VirtualHost
/usr/fs/etc/apache2/sites-available/default -- VirtualHost
/usr/fs/etc/apache2/ports.conf -- Listen

9 Restart each Apache instance. The non-chroot Apache can be restarted with this command:
/etc/init.d/apache-ssl stop
/etc/init.d/apache-ssl start

10 The chroot Apache is restarted with this command:
chroot /usr/fs /etc/init.d/apache2 stop
chroot /usr/fs /etc/init.d/apache2 start

freyacooper
Posts: 16
Joined: Thu Jan 22, 2015 4:01 pm

Re: Update new set of IPs for a dedicated server

Post by freyacooper » Wed Nov 10, 2021 8:21 am

A server has a static IP address that does not change very often. ... A home machine that is dialing up through a modem often has an IP address that is assigned by the ISP when the machine dials in. That IP address is unique for that session -- it may be different the next time the machine dials in.

millerconnor85
Posts: 13
Joined: Wed Jan 21, 2015 5:15 pm

Re: Update new set of IPs for a dedicated server

Post by millerconnor85 » Thu Dec 16, 2021 4:38 am

A dedicated IP address is a one-of-a-kind Internet address that is assigned to only one hosting account. Using FTP to access your account while the domain name is otherwise unreachable, such as during domain name propagation periods, is possible with a dedicated IP address. View the IP address of your Shared Hosting website.

Post Reply