Dynamic IP setup
-
- Posts: 5
- Joined: Wed Nov 21, 2012 12:01 am
Dynamic IP setup
Setting up the server to run on a dynamic ip is a real son of a B^&*# at the moment. I can auto update pretty much everything via ddns. The real issue comes with the Zone ip settings. Is there a way i could auto update the zone ip with an executable?
-
- Posts: 5
- Joined: Wed Nov 21, 2012 12:01 am
Re: Dynamic IP setup
And could I get the name of the executable?
Re: Dynamic IP setup
It's whatever you make it. We don't have a program, you'd have to write your own.
-- Whasf
-
- Developer
- Posts: 539
- Joined: Sun Jul 22, 2012 12:17 am
Re: Dynamic IP setup
You'd basically need something that:
1) detects when the IP changes
2) calculates the new zoneip
3) connects to the SQL server (probably 127.0.0.1)
4) update 'zone_list' set zoneip = ...
5) restart servers
Insert: "Hell, I bet I could do that with PHP."
1) detects when the IP changes
2) calculates the new zoneip
3) connects to the SQL server (probably 127.0.0.1)
4) update 'zone_list' set zoneip = ...
5) restart servers
Insert: "Hell, I bet I could do that with PHP."
Test Server: Hanekawa | Fantasy World: Naito
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
Re: Dynamic IP setup
I haven't used it in quite some time as I prefer to do the math myself but doesn't the DSP Server Updater now set the IP for you?xtcraver2003 wrote:Setting up the server to run on a dynamic ip is a real son of a B^&*# at the moment. I can auto update pretty much everything via ddns. The real issue comes with the Zone ip settings. Is there a way i could auto update the zone ip with an executable?
Re: Dynamic IP setup
Here.
On windows, edit db.config.php to your DB setup. Then run updatezip.bat
On unix, just run php update_zonip.php after editing the db.config.php
Here is what the code looks like.
The package is big becase of windows deps. (Lynx, grep, and php)
Make this automated? Crontab in unix, or Windows Scheduler.
On windows, edit db.config.php to your DB setup. Then run updatezip.bat
On unix, just run php update_zonip.php after editing the db.config.php
Here is what the code looks like.
Code: Select all
//
// db.class.php --> DB Functions
// db.config.php --> DB Connection Information
//
$getIP = explode(": ", trim(shell_exec("lynx --dump www.my-ip-address.com | grep \"Your IP is\"")));
echo "The IP Address we detected is: ".$getIP[1].". (From my-ip-address.com)\n";
// calc zone ip
$zstring = explode(".", $getIP[1]);
$zip = $zstring[0] + ($zstring[1] * 256) + ($zstring[2] * 65536) + ($zstring[3] * 16777216);
echo "Zone IP: ".$zip."\n";
// update db
require_once 'db.class.php';
$db = new Db();
echo "Run query on db: UPDATE zone_settings SET zoneip='".$zip."';\n";
$db->updateDb("UPDATE zone_settings SET zoneip='".$zip."';");
echo "Settings have been updated\n";
Make this automated? Crontab in unix, or Windows Scheduler.
- Attachments
-
- auto_zoneip.zip
- PHP Script, PHP x64, mysql lib, grep, lynx
- (5.01 MiB) Downloaded 350 times