Dynamic DNS for personal domain


I wanted to know how to properly setup a DDNS.

Let me explain on how I think/want this set up and how it should work. but correct me if I’m wrong. I have a subdomain that I want to forward to my home ip. home.domain.com. but not just for http connections. any connections. SSH, FTP, VNC, HTTP, etc… but the problem with most personal ISP is that its a dynamic IP address.

So, with that in mind. I started to think about how I’m going to deal with the changing IP address. And I figured that I can use my MySQL database to save the latest IP. So, I wrote a script in python to update my IP in the SQL database every hour. Problem is now… What do I do with it? I’m not sure if putting it into my database is the correct way to think about it. But, keep this in mind, I’m still very new to this web development.

Thanks for your replies,

The script on the “local” side should keep track of the current external IP and if it changes then it should use the dreamhost API to update home.domain.com. Two API transactions are required to drop and add, as there is no update API.

Dreamhost sets TTL at 4 hours, so you do have a wait even after the DNS updates.

Thanks for the reply it really help me understand what I need to do.

My question is now… can you filter the results of dns-list_records to just display the record for a give DNS? (API POST method) That would make this a lot easier. But, I guess I can format it into Json and have php decode it. but the problem is how do I filter it out from there?

Lets say my comment for my DNS record is “HomeIP” So, I can do a search for that and from there find out my info on the record. But I’m getting an php error because of the multidimensional array. I believe that’s why I’m getting the error message. “Warning: array_search() expects parameter 2 to be array, object given in”

If anyone has any ideas I’ll greatly appreciate them,

You really don’t ever need to look up anything using the API. I suppose that if you want to check what the current record is you could simply lookup the A record for home.domain.com, but you could really be over complicating this.

If current_external_ip <> saved_ip then
  remove saved_ip using API call
  add current_external_ip using API call
  saved_ip = current_external_ip

have cron execute that every 5 minutes or something.

I’d just use a simple shell script on the local machine to accomplish this, doing that you could even use the API to get the current list_records and just grep for the line you need.