Create a droplet using snapshot (VestaCP show the old ip addr interface)

Posted August 2, 2016 1.8k views
WordPressLinux Commands

Create a droplet using snapshot (VestaCP show the old ip addr interface) .

As a new droplet, we will have a new ip address interface but it seems my vestacp or linux will contain ip address for interface as an old one then how to change this completely (debian linux ? , vestacp config file ? , phpmysql ? , nginx ? , mysql ? , wordpress )

Sorry I am really new to linux and these cli platform…

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

When you create a new droplet from your snapshot the IP address settings in Linux are updated but VestaCP stores this information separately. A command is included for you to update the IP address. After creating your new droplet you can run

v-add-sys-ip <*>your.ip.address <*>

Using droplet meta-data and user-data you can automate this process. On the create page, when using your VestaCP image, check the user-data checkbox and paste the following in the box:

myip=`ifconfig eth0 | grep inet | grep -v "inet6" | grep -v "" | sed 's/:/ /g' | awk '{print $3}'`;
v-add-sys-ip $myip;

This script will use droplet meta-data to get your new droplet’s IP address and run the command on the first boot. I don’t have a VestaCP image to test this with so I’d recommend testing with yours before using this method in production.