http://knowledgewithoutlimitation.blogspot.com 5.4.3 External IP Address ~ Ilmu Tanpa Sempadan

Open Source, Delay Tolerant Network, Internet of Things

Knowledge Without Boundary

Monday, December 22, 2014

5.4.3 External IP Address

            The Uniform Server setup for online web server is the same as for offline server. The IP address used is 192.168.1.7. The difference is that the online server is connected to the internet. The Internet Service Provider being used in this research is TM Streamyx Dynamic 1 MBps. This ISP provides an internet with dynamic IP address connection. The external IP address will change periodically depending on the ISP. This leads to an access problem to existing setup to act as a server. To solve that problem, DtDNS service is used. DtDNS is a complete provider of DNS hosting and DNS management services with a focus on dynamic DNS and dynamic IP address management. There is a free domain name provided and tracking software to automatically update IP address as it changes. This free service enables a dynamic IP address to host a service just as it had a static IP address. The DtDNS service hostname details for this offline email system configured where the hostname is pemail and domain is suroot.com.
Cron is used to integrate DtDNS with Uniform Server. Cron originated from a UNIX environment. It is a job scheduler allowing scripts to be run automatically at a certain time or date. Cron has been integrated into Uniform Server 7.1.4. The script has been pre-configured to run the three scripts which are Drupal Cron, Moodle Cron and DtDNS automatic IP updater. Only script for DtDNS automatic IP updater used for this offline email system. Cron automatic update default period is every ten minutes. DtDNS automatic IP updater has been pre-configured, but it is disabled by default on Uniserver. To enable DtDNS automatic IP updater, Cron configuration file in C:\PEmailOffline\UniServer\unicon\main\run_cron.php edited by changing lines in the section list of scripts to be run as shown in Table 5.5 (A). Then those lines uncomment as shown in Table 5.5 (B).
  
A
  // $cmd = 'start ..\..\usr\local\php\php-win.exe ..\..\plugins\dtdns_updater\dtdns_updater.php';
  // pclose(popen($cmd,'r'));        // Start detatched process
B
  $cmd = 'start ..\..\usr\local\php\php-win.exe ..\..\plugins\dtdns_updater\dtdns_updater.php';
pclose(popen($cmd,'r'));             // Start detatched process
Table 5.5: Enable Cron
DtDNS account details where the hostname is pemail.suroot.com and password configured in a Cron script configuration file located in:
“C:\PEmailOnline\UniServer\plugins\dtdns_updater\dtdns.ini”
Uniserver uses binary code 1 which means perform the function while 0 means ignore and do nothing. Default value "7" is a total of 1+2+4 which will run the Apache, MySQL and Index page processes. Cron Binary code is "16".Total binary code value for Apache, MySQL and Cron is 19. Figure 5.1 shows the binary codes have been assigned.
Figure 5.1: Uniform Server Binary Codes
To enable automatic Cron on Uniserver, file in “C:\PEmailOffline\UniServer\unicon\main\includes\config.inc.php” edited as shown in Table 5.6. This binary code value will enable the Apache, MySQL, Index page processes and Cron run when the Uniserver program started.
  $server_standard = 19;
  $server_service  = 19;
Table 5.6: Enable Cron automatic update on Uniserver
Apache, MySQL and Cron need to be configured to start up all at once. Cron can be configured to run automatically when the servers are started by editing file in C:\PEmailOnline\UniServer\unicon\tray_menu\UniTray1.ini. Under “LEFT MENU” there are lines to control Server Start and Stop. Programs or batch files that run either of the control scripts start_servers.php or stop_servers.php must include a single binary coded parameter. If this parameter is missing defaults value 7 are used. A parameter overrides any default settings this allows independent control of a particular function. Then, default binary code should be changed from 7 to 19 for these lines "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\start_servers.php 19"; as per Table 5.7 below:
;=== LEFT MENU ============
[Menu.Left]
Type: item; Caption: "Start UniServer (Apache MySQL)"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\start_servers.php 19"; ShowCmd: hidden; Glyph: 9
Type: item; Caption: "Stop  UniServer (Apache MySQL)"; Action: shellexecute; FileName: "%PHP%\php.exe"; Parameters: " -n %ServerConMain%\stop_servers.php 19";ShowCmd: hidden; Glyph: 11

Table 5.7: Apache. MySQL and Cron startup script configuration

0 comments:

Post a Comment