Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Dev Section 3rd Party Software
  • Search

How to Auto Change IP Address in VestaCP

Section with additional software for Vesta
Post Reply
  • Print view
Advanced search
40 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next
mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by mehargags » Thu Feb 16, 2017 9:31 pm

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.
Last edited by mehargags on Sat Oct 07, 2017 8:38 am, edited 2 times in total.
Top

blueberry
Posts: 25
Joined: Tue May 02, 2017 9:35 am

Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by blueberry » Wed May 03, 2017 9:41 am

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?
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by mehargags » Wed May 03, 2017 7:02 pm

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
Top

blueberry
Posts: 25
Joined: Tue May 02, 2017 9:35 am

Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by blueberry » Tue May 09, 2017 9:13 am

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.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by mehargags » Tue May 09, 2017 9:51 am

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.
Last edited by mehargags on Wed May 10, 2017 6:18 pm, edited 1 time in total.
Top

blueberry
Posts: 25
Joined: Tue May 02, 2017 9:35 am

Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by blueberry » Wed May 10, 2017 12:31 am

Thanks for your reply. Let me monitor this again. Router forwarding is setup.
Top

tvegan
Posts: 1
Joined: Thu Dec 15, 2016 6:49 pm

Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by tvegan » Wed Jun 28, 2017 2:25 am

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
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by skurudo » Tue Jul 25, 2017 9:08 am

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
Top

buracat
Posts: 11
Joined: Sat Sep 03, 2016 7:09 am

Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by buracat » Sat Oct 07, 2017 5:57 am

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
Top

plutocrat
Posts: 232
Joined: Fri Jan 27, 2017 9:16 am

Os: Ubuntu 17x
Web: apache + nginx
Re: How to Auto Change IP Address in VestaCP
  • Quote

Post by plutocrat » Mon Apr 23, 2018 4:48 am

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.
Top


Post Reply
  • Print view

40 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next

Return to “3rd Party Software”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password