Switching to new cloud instance

vpswing

Active Member
Jun 4, 2014
32
4
58
cPanel Access Level
Root Administrator
Some background info -

I'm running cPanel on a 4GB RAM cloud instance (IP: 10.0.0.5), with a separate volume as the 'root-disk'. It has a public-facing IP which is registered with cPanel.
I needed more computing power and RAM, so upgraded the instance to 8GB RAM - the provisioned IP is 10.0.0.8.

When I attached the original root-disk to this new instance, it is showing the original IP (10.0.0.5) - i.e. all the VirtualHosts in the httpd.conf is using the old IP (10.0.0.5).
So I had to manually change the IP to the new one, 10.0.0.8

However, whenever I make any changes with easyApache, the IP reverts back to the old one, i.e. "10.0.0.5".

How can I change the IP from .5 to the new one, .8 ?

I found this file /var/cpanel/root.accts - that has references to old IP. Can I update this file? Any other files to update ?

Many thanks!
 

vpswing

Active Member
Jun 4, 2014
32
4
58
cPanel Access Level
Root Administrator
Related to the above, are there any background tasks/cronjobs that would update the /etc/apache2/conf/httpd.conf ?
Because I just discovered that after making the manual changes to the IP addr, a few hours later, they were reverted back to the old IP (10.0.0.5)
 
Feb 20, 2020
12
1
3
India
cPanel Access Level
Root Administrator
Hello,

Yes, you should not edit httpd.conf manually. As I said, make the changes in the files that are present under /var/cpanel/userdata/username then run easyapache to fix the issue. Replace username with actual cpanel user name.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Wait, @GoMummyHosting that advice is unsupported there is a better method for this that does not have the same potential for irreparable damage.

@vpswing the best method to resolve this is to utilize the IP address migration tool which can be found here: IP Migration Wizard | cPanel & WHM Documentation

It will change ALL instances of the old IP to the new IP in a supported fashion. Please let us know if you run into any issues with it.
 

vpswing

Active Member
Jun 4, 2014
32
4
58
cPanel Access Level
Root Administrator
Thanks @GoMummyHosting and @cPanelLauren for responding!

I tried to add the new IP via the web Interface, but I get this message that the IP (10.0.0.8) is already an active IP.
But when I tried to change the Site's IP (from the "Acccounts Function" section), I don't see this internal IP, but only the Public IP (from the Cloud provider).
What else can I do to make this 'switch' ?

Re: same potential for irreparable damage.

May I ask what kind of 'irreparable damage' that might happen if I follow @GoMummyHosting advice?

Thank you.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Modifying the userdata in the manner suggested can cause the userdata to become corrupted which is what all account information is based on. In the event this happens, it's possible that you will not be able to recover it without a full backup. Further to that the IP is referenced in far more places than just those files and in order to properly switch over you'd need to manually modify every reference. Also, you don't "run easyapache" anymore for anything. EasyApache 4 is package based and there's no need for recompiling using EasyApache as there was in previous versions and because of that, it wouldn't have fixed your issue it would have let the accounts in a broken state.

Can you show me the output of the following? (change the actual public IP before submitting)

Code:
cat /var/cpanel/cpnat
I tried to add the new IP via the web Interface, but I get this message that the IP (10.0.0.8) is already an active IP.
If the IP is already present on the server at WHM>>IP Functions >> Show or Delete current Ip addresses you shouldn't need to add it. The IP address migration tool as I noted previously would be the advised method of moving all the sites to the new ip.
If you've not gotten a new public IP it should reference that in the cpnat file I asked you to provide.
 

vpswing

Active Member
Jun 4, 2014
32
4
58
cPanel Access Level
Root Administrator
Hi @cPanelLauren ,

cat /var/cpanel/cpnat ==> 10.0.0.8 104.37.196.XX (<-- a valid IP, I just replaced it with 'xx')

WHM >> IP Functions >> Show or Delete also shows the same info above.

What does this mean? That all is "ok" ?
If so, then why does the file "root.accts" and the files in the "userdata" still reflects the old IP ?

Thanks!
 

vpswing

Active Member
Jun 4, 2014
32
4
58
cPanel Access Level
Root Administrator
This issue - the /etc/apache2/conf/httpd.conf was changed again yesterday - to use back the OLD internal IP. I do not know why.

cat /var/cpanel/cpnat - shows the correct info, i.e. correct mapping between the internal IP and public IP

This time, though, cat /var/cpanel/root.accts shows the public IP for each of the accounts.

Only one of the accounts (in /var/cpanel/userdata/ ) is still using the OLD internal IP.
All other accounts are using the new internal IP.

How do I get rid of this OLD internal IP addr ?

Thanks!
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
I'm not sure how that would happen but this would be something best handled through a ticket.
Can you please open a ticket using the link in my signature? Once open please reply with the Ticket ID here so that we can update this thread with the resolution once the ticket is resolved.


Thanks!
 

vpswing

Active Member
Jun 4, 2014
32
4
58
cPanel Access Level
Root Administrator
Hi Lauren,

I've opened a ticket already (#93479134) and Eric has replied with instructions.

cd /var/cpanel/userdata/<account_name>

sed -i 's/10.0.0.X/10.0.0.Z/g' * (replace 10.0.0.X with 10.0.0.Z )

/scripts/updateuserdatacache --force (cPanel script to force update on user's data cache)
/scripts/rebuildhttpdconf (cPanel script to rebuild httpd.conf)

Thanks!
 
  • Like
Reactions: cPanelLauren
Thread starter Similar threads Forum Replies Date
M Transfers 1
B Transfers 3