Guide: Ubuntu Server – Dynamic Internal Network IP for WordPress, FTP, SQL

No-IP DNSAt work, we have dynamic IP addresses assigned to our workstations. This is typical for work environments.

Unfortunately, this is an annoyance for those in the field of web development, who use IP addresses for things like FTP, MySQL, and WordPress configurations.

Drupal doesn’t care if your IP changes. However, WordPress does. You will be required to run a series of SQL commands each time to update the IP addresses used.

This…is a waste of time. Alas, there is a solution for it! And what’s better? It’s free!

1) Sign Up
2) Supply the IP address of the current machine
3) Install the client
4) Create a script

Ok. So that’s the short version of it. To make things more clear, this is my setup…

Mac – Snow Leopard
Running VirtualBox
— Ubuntu Server 12.04
—- Apache
—- MySQL
—- PHP

In other words, an Ubuntu LAMP install.

So to elaborate more on this. You will need to INSTALL the Linux Dynamic Update Client (DUC). Yes, that sounds like “Duck”. Quack quack!

For me, their directions naturally did not work right out of the box. So let’s assume good ol’ apt-get won’t work for you (even after apt-get update). It was not available in the repository. And I also was unable to use the MAKE command. This is what I did (just FYI you may need to run in admin mode / sudo)…

apt-get update
apt-get upgrade
apt-get install build-essential
gcc -v
make -v
cd /usr/local/src
tar xzf noip-duc-linux.tar.gz
cd no-ip-2.1.9
sudo make install

Boom. Easy! So let’s configure it by…

sudo /usr/local/bin/noip2 -C

Supply your login info and follow the prompts.

Done! Their client, however, will report the EXTERNAL IP address. Not your network IP address. This is ok for some people’s needs, but NOT mine. And unfortunately, I found no way to tell it to use my network IP instead of the external IP. How annoying! I’m no Linux expert here, so maybe it exists. Maybe it doesn’t.

After being unable to find an answer, I decided “Hey…I’ll just figure it out myself”. Alas, I created a BASH script.

I hate VI. HATE IT! Using VI doesn’t make you cool. Using NANO does though. So we will use NANO as our text editor. Save your file wherever. I’m using a SCRIPT directory.

sudo nano /script/

So we are now nano’ing it up. Let’s put in some code that tells the NOIP Client that we want to use our current network IP address.

ip=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
echo $ip
sudo noip2 -i $ip

Now hit CTRL+X and Y for saving.

We will need to CHMOD the script so that it is able to run. So let’s make sure we are in the directory with the script and chmod the pajesus out of it.

dir /script/
sudo chmod +a+x

Boom goes the dynamite! You can run this now if you wish to verify that it is functioning correctly…


It should report your network IP. If not, then you will need to modify the BASH script’s IP address line. This one makes use of sbin/ip. So sorry if you don’t have that in your distro.

Next, we want to add this to startup. It’s time to NANO again. If you want to VI though, then please do so privately. There are many methods to add commands to startup. This is the one I used…

sudo nano /etc/rc.local

So let’s tell the bash script it’s time to run. Before the “exit 0” line, we will be executing our bash script. Write the following (while making edits to ensure the path and file name are identical to your bash script’s path and file name…derp)…


Save (ctrl+x and “Y”), then restart your computer to see the magic happen (reboot -h 0).

Problem solved! Now let’s just hope that there isn’t secretly some obvious noip client command that does this automatically that I missed… ?

Leave a Reply

Your email address will not be published.