Page 4 of 4

Re: How to Auto Change IP Address in VestaCP

Posted: Mon Apr 23, 2018 8:16 pm
by mericson
Is this script still current? Been a lot of changes to VestaCP in 4 years.

What is the latest and greatest way to update all the IP addresses when migrating to a new server (including a floating IP I have behind NAT) ?

Did any v-* cli script get created for IP migration?

Basically my scenario is I have created a VM image which has my OS and VestaCP all preconfigured with my preferred setitngs, apps, security, etc. I like to create a new VM instance from that image and easily update to all the new IP addresses. After that I have a new instance, for hosting more websites, or for adding to a cluster.

Recommendations?

Re: How to Auto Change IP Address in VestaCP

Posted: Tue Apr 24, 2018 3:26 am
by plutocrat
mericson wrote:
Mon Apr 23, 2018 8:16 pm
What is the latest and greatest way to update all the IP addresses when migrating to a new server (including a floating IP I have behind NAT) ?
Vesta will always need to use the local IP assigned inside the VM, not the NATted floating IP. The reason for this is that Apache/nginx bind to the local IP.

Was thinking I might have a go at updating the script. What OS are you running?

You might also look at this: viewtopic.php?f=19&t=15055. It works on OSes which have /etc/apache2 as opposed to /etc/httpd

Re: How to Auto Change IP Address in VestaCP

Posted: Tue Apr 24, 2018 11:05 am
by mehargags
I don't know why you really need a script to do this actually?

Just change your IPs in your /etc/network/interfaces,
then

Code: Select all

/usr/local/vesta/bin/v-update-sys-ip
or goto WebUI >> IP >> Re-Read IP

then do

Code: Select all

/usr/local/vesta/bin/v-change-web-domain-ip
for your domains one by one or batch them

After that just rebuild Web/DNS/Email for your users and reboot your server.

I know its not a straightforward thing to change your IPs but Vesta has the functionality built in already. Changing your NIC IP is a bit of an invasive thing... so there isn't really an easier way.

Re: How to Auto Change IP Address in VestaCP

Posted: Wed Apr 25, 2018 12:18 am
by mericson
plutocrat wrote:
Tue Apr 24, 2018 3:26 am
Was thinking I might have a go at updating the script. What OS are you running?
CentOS 7

Re: How to Auto Change IP Address in VestaCP

Posted: Wed Jul 25, 2018 1:27 pm
by pablolp
mehargags wrote:
Tue Apr 24, 2018 11:05 am
I don't know why you really need a script to do this actually?

Just change your IPs in your /etc/network/interfaces,
then

Code: Select all

/usr/local/vesta/bin/v-update-sys-ip
or goto WebUI >> IP >> Re-Read IP

then do

Code: Select all

/usr/local/vesta/bin/v-change-web-domain-ip
for your domains one by one or batch them

After that just rebuild Web/DNS/Email for your users and reboot your server.

I know its not a straightforward thing to change your IPs but Vesta has the functionality built in already. Changing your NIC IP is a bit of an invasive thing... so there isn't really an easier way.
I think you're right

The external ip (WAN) is not needed for hosting but is necessary for the DNS server.

VestaCP automatically changes the current external IP to the new one in all domains and registries when you run v-update-sys-ip

I use a dynamic domain that is updated automatically with the current IP through a router (DD-WRT)

Code: Select all

DDNS: host.ddns.net > X.X.X.X
What I did was execute a CRON task that does this every 10 minutes, so everything stays updated.

Code: Select all

CRON: sudo /usr/local/vesta/bin/v-update-sys-ip */10 * * * *
This is the best I could do to avoid having to pay for a static IP. It's not the most efficient, but it works