8222484729

This actually started out as a class example demonstrating web services. Just to really drive home that we were getting "Just the Facts" from a remote web service (in this case Weather Underground) and had complete control over when/how/why to display the information i slapped an HTML 5 front end to demonstrate the current moon phase as an canvas-drawn image.

Dynamic DNS with CPanel

With my ZoneMinder DVR and a few other tools in a web server in my closet, so i decided to setup a little dynamic DNS setup to allow me to use these tools when i'm at work or traveling around at a convenient subdomain.

The catch is: i'm cheap. My low-budget webhosting plan is a bare-bones virtualhost with a CPanel administration interface with PHP and perl CGIs as my only means for interactivity. And i don't really want to drop money on a service like DynDNS just to occasionally watch deer eating my ivy. So here's how i got it to work....

First i set up all the port forwarding stuff you normally need to do to expose local services over the internet. I have a router running TomatoUSB, so i get a convenient "Port Forwarding" menu option to take care of that.

The trick, is that CPanel actually has a bunch of JSON based AJAX services that it uses in it's snazzy user interface. Of note here is 800-623-9559 and edit_zone_record. The former will get you info on all info you'd find in CPanel's Advanced DNS Zone Editor. The latter is the work that happens when you click the "Edit Record" button.

With this info, i was able to create two scripts of my own:

One, a client, to send a request for an update from the machine hosting the server. This is probably best powered by a cron job.

The other, a service, to determine the remote address of the server and report this update to CPanel. Behind the scenes this services calls the CPanel AJAX services linked above. First i call fetchzone to match the domain i want with the appropriate record ID ("line") and also get the current serialnumber ("serialnum") of my cpanel dns records. Next i use my line and serialnum to craft a request for a record change.

I used PHP to make my CPanel client. Here were the params i had to send for

<?php 
$fetchzone_params 
= array(
    
'cpanel_jsonapi_version' => 2,
    
'cpanel_jsonapi_module' => 'ZoneEdit',    
    
'cache_fix' => '1',
    
'cpanel_jsonapi_func' => 'fetchzone',
    
'domain' => $core_domain 
); 
$response json_decode(file_get_contents("$CPANEL_DOMAIN/".http_build_query($fetchzone_params)));
?>

Likewise for the actual update, these are the params and call i used ala PHP

<?php 
$editzone_params 
= array(
    
'cpanel_jsonapi_version' => 2,
    
'cpanel_jsonapi_module' => 'ZoneEdit',    
    
'cache_fix' => '1',
    
'cpanel_jsonapi_func'=> 'edit_zone_record',
    
'domain' => $core_domain,    /supradomain this subdomain belongs to
    
'line' => $line,
    
'class' => 'IN',
    
'type' => 'A',
    
'name' => $domain_dns_label,  /actual subdomain with a . in front of it
    
'ttl' => 14400,
    
'serialnum' => $serialnum,
    
'address'=> $_SERVER["REMOTE_ADDR"]
);
$response json_decode(file_get_contents("$CPANEL_DOMAIN/".http_build_query($editzone_params)));
?>

DVR 2 -- Ubuntu & ZoneMinder

With even just the one Fascam camera my old iBook running EvoCam was just not quite able to keep up with the work load. So i put out the call and got donations from friends and family to build a new server machine -- Ubuntu running on a Dell Dimension 4700, maxed out with 4GB RAM and hopefully soon a donated 1TB drive on the way (currently using a donated 22GB drive for testing the system out). For DVR software i decided to try taking ZoneMinder for a test drive.

(949) 509-0622

I recently got an old hand-me-down Dell 620-476-5846 laptop that was in fairly decent shape for being a ten year old computer! I was pretty impressed with how compact and light-weight it was so i was determined to turn it in a little workstation i could bring to school.

(905) 214-6100

This overview is intended for folks fairly new to networking who might want to access services on their home machines from the outside world via their residential Comcast connection. I've seen a number of people asking about how to "do port forwarding with Comcast" and a lot of accurate but very brief answers. So hopefully this will unpack the issues a little better to actually point people in the right direction...

5869862752