Page 3 of 5

Re: How to Auto Change IP Address in VestaCP

Posted: Thu Feb 16, 2017 9:31 pm
by mehargags
It happened today on one of my VPS when my provider moved it to a different node and the IP changed.

My Provider migrated one of my VPS today to a different node, which changed its IP...
I did these steps:

Code: Select all

/usr/local/vesta/bin/v-update-sys-ip
which changed my IP in VestaCP but I still could not connect to my sites.

Then I did for all users:

Code: Select all

Rebuild Web
after which I started getting 500, meaning somehow apache was not accepting calls.

Checked all files in /etc/<apache><nginx> and they were properly changed, all virtual servers nginx and apache had the correct IP

Rebooted server 3 times... still no luck.

Then as a last try, I STOPPED firewall... and it worked!!!! Started Firewall again, it kept working. So I guess the IP tables rules needed to be flushed and recreated again to to avoid any cached policies.

Re: How to Auto Change IP Address in VestaCP

Posted: Wed May 03, 2017 9:41 am
by blueberry
Not sure if this script will be suitable? Please advice if you can.

Currently, server is setup using dynamic IP via providers such as Dynamic DNS providers: DynDNS, NOIP, Dynu. And using ddclient to autoupdate WAN IP to Dynamic DNS provider.

So far, no issues accessing the website Domain from outside. FTP, SSH,... all ok.

One concern is the WAN IP might change sometimes, and i think in the IP section of VESTACP, "NAT IP association (optional)" might not be updated to the latest WAN IP?

One thing i saw is i can also run the "reread IP" feature in VESTACP under IP, which will update the WAN IP and LAN IP automatically.

Possible to use the CRON feature to auto-update this WAN IP? Or need to run this script?

Re: How to Auto Change IP Address in VestaCP

Posted: Wed May 03, 2017 7:02 pm
by mehargags
WAN IP has nothing to do with your VestaCP Server's IP. Leave it to the local IP that your Router gives you. Configure proper port forwarding on your router to that local IP. This way it doesn't matter what your WAN (public) IP is, it is automatically handled correctly by the router and your server keeps working on the internal static unchanged IP

Re: How to Auto Change IP Address in VestaCP

Posted: Tue May 09, 2017 9:13 am
by blueberry
Thanks for your reply. Portforwarding was configured correctly in the beginning. So far everything works good.

But i realized that the WAN IP doesn't automatically update here with the latest IP: "NAT IP association (optional)" . I had to manually enter the WAN IP over here. Let me know if i missed out anything or any ways to make this updated automatically.

Re: How to Auto Change IP Address in VestaCP

Posted: Tue May 09, 2017 9:51 am
by mehargags
as I said before... if you have your router forwarding your WAN to a LAN IP... you don't need to configure the WAN IP on Vesta at all... just use the internal LAN IP and you are good.

Re: How to Auto Change IP Address in VestaCP

Posted: Wed May 10, 2017 12:31 am
by blueberry
Thanks for your reply. Let me monitor this again. Router forwarding is setup.

Re: How to Auto Change IP Address in VestaCP

Posted: Wed Jun 28, 2017 2:25 am
by tvegan
Can anybody help me. Im kind of a newb to all this commands. My google instance ip change today and now vestacp server is down. Can somebody guide me on how to change the ip manually since option 1 doesn't work and error i got:

Resolving http://www.nobill.tv (http://www.nobill.tv)... 185.53.178.9
Connecting to http://www.nobill.tv (http://www.nobill.tv)|185.53.178.9|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-06-28 02:20:56 ERROR 403: Forbidden.

Any detail guiding instruction for option 2 is appreciated. I don't know how to execute those command scripts. Vestacp is running ubuntu 16 on nginx+php-fpm.

Thank You

Re: How to Auto Change IP Address in VestaCP

Posted: Tue Jul 25, 2017 9:08 am
by skurudo
tvegan wrote:Can anybody help me. Im kind of a newb to all this commands. My google instance ip change today and now vestacp server is down. Can somebody guide me on how to change the ip manually since option 1 doesn't work and error i got:
First post -> Option 2 - Long way Create it yourself

Re: How to Auto Change IP Address in VestaCP

Posted: Sat Oct 07, 2017 5:57 am
by buracat
Thanks for sharing, its working. But if u are using ssl, change to them

/home/aaaaaa/conf/web/shttpd.conf
/home/aaaaaa/conf/web/snginx.conf

Re: How to Auto Change IP Address in VestaCP

Posted: Mon Apr 23, 2018 4:48 am
by plutocrat
Recent changes to the files in /home/<user>/conf/web mean that the search and replace given in the script doesn't work.
I had to use
sed -i 's/1.2.3.4/5.6.7.8/g' /home/*/conf/web/*apache2*.conf
sed -i 's/1.2.3.4/5.6.7.8/g' /home/*/conf/web/*nginx*.conf
Then
systemctl restart apache2.service
systemctl restart nginx.service

And also I had to do this to make the changes stick.
service iptables restart

And as I have an /etc/apache2 directory as opposed to the /etc/httpd/ directory, I had to use the second version of the script which takes that into account.
Just thought I'd mention it in case anyone is keeping the script updated.