Internet Connection Sharing using Ubuntu 10.04 LTS as NAT Gateway

The following how to contains procedures to configure an Ubuntu 10.04 LTS machine to be used as a NAT (Network Address Translation) gateway for sharing internet connection.

Part A. Configuring IP v4 forwarding option

A.1. Edit the sysctl.conf file by issuing command: nano /etc/sysctl.conf  and un-commented (remove hash mark) from the following line # net.ipv4.ip_forward=1
A.2. Open the rc.local file by issuing command: nano /etc/rc.local, next, add the following lines before exit 0 line

/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables –table nat -A POSTROUTING -o eth0 -j MASQUERADE

(to be continued)

Install Cacti on Ubuntu 10.04 LTS

1. Install command: apt-get install snmpd
2. edit the file /etc/default/snmpd
3. find line SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/ and remove string
save the changes

4 edit the file /etc/snmp/snmpd.conf
Find the line com2sec readonly  default  public
and replace the community string name (i.e., public) with the one for your snmp community
for example: com2sec readonly  default  unpatti
Save the changes

5. restart snmp daemon /etc/init.d/snmpd restart
6. test using the command: /usr/bin/snmpwalk -v 2c unpatti

Note: replace unpatti with the ro community string of your server
Note: In this tutorial, the MySQL and Apache2 have been installed in the system and running.
Check whether SNMP is installed and run, if SNMP it is not installed, run apt-get install snmp apt-get php5-snmp

Part B. Install Cacti

1. Install command: apt-get install cacti
2. press/choose ok to acknowledge message of Configuring libphp-adodb
3. configure database for cacti with dbconfig-common(y)? yes
4. supply Password of the database’s administrative user: your mysql root password
5. define MySQL application password for Cacti: yourpassword
6. Choose type of webserver to be used: Apache2 (OK)
… system will proceed with … selecting previously deselected package Gawk …

7.Go to http://yourhost/cacti using browser to continue installation process
8. Cacti Installation Guide info, click Next
9. Choose: New Install and then Next
10. Cacti will show the following information
Database User: cacti
Database Hostname:
Database: cacti
Server Operating System type: Unix

11. Click Next
Make sure that RDTool 1.3x or higher is selected

12. Click Finish.
13. First time login on http://yourhost/cacti
user: admin
password: admin

15. proceed with password change
16. Add your device
Go to Management -> Devices -> Add

Install Project Fedena version 2.2 on Win32

Step 1: Install Ruby
Download and install One-Click Ruby Installer for Windows.

Step 2: Install Rails
Now we can use the RubyGems package manager to download and install Rails 2.3.5(Note: Version should be 2.3.5),
Open a command window and run the command gem install rails -v=2.3.5 –remote

Step 3: Install MySQL
1. Download and install the “essential” version of the MySQL installer v5.0
2. Copy libmysql.dll from MySQL bin directory (usually C:\Program Files\MySQL\MySQL Server 5.0\bin) to Ruby bin directory (usually C:\Ruby\bin)

Step 4: Setup Fedena
4.1. Download Fedena source code from GitHub. Extract the ZIP/TAR archive and save to a folder (say C:\Fedena22).
4.2. Now goto the fedena source directory in command line/prompt.
4.3. Run the command gem install mysql
4.4. Run command gem install declarative_authorization -v 0.5.1
4.5. Run command gem install searchlogic -v 2.4.27
4.6. Run command gem install i18n -v 0.4.2
4.7. Run command gem list (check for i18n version, if there is version 0.6.0, uninstall it, using command gem uninstall i18n )
4.8. Update the MySQL database details in config/database.yml (under “development:”)
4.9. Run the command rake db:create This will create the required databases.
4.10. Run command gem install win32-open3 to install win32-open gem.
4.11. Run the command rake db:migrate This will populate the database with required tables.
4.12. Finally, run the command ruby script/server This would start the server and it will be accessible at http://localhost:3000
4.13. If you want to run Fedena in production mode, run the command ruby script/server -e production For this, Production database details should be given in config/database.yml

Step 5: Install RMagick for Fedena
(This installation is needed to solve error when uploading student profile picture)

5.1. Unzip
5.2. Go to the unzip result folder and run ImageMagick-6.5.6-8-Q8-windows-dll.exe to install it.
5.3. Unzip RMagick-2.12.0.tar.gz
5.4. Copy the result, Rmagick-2.12.0 folder to C:\
5.5. Copy rmagick-2.12.0-x86-mswin32.gem to C:\RMagick-2.12.0
5.6. Navigate into folder C:\RMagick-2.12.0 using Windows Command Prompt
5.7. Run the command gem install rmagick --local

Step 6: Install wkhtmltopdf

This is to solve PDF creation problem ( error message: Create PDF Error: Bad wkhtmltopdf’s path )

6.1. Download the installer from

6.2. Install to folder c:\wkhtmltopdf

6.3. Edit c:\Fedena22\config\initializers\wicked_pdf.rb as follows:

#:wkhtmltopdf => '/home/foradian/sooraj/wkhtmltopdf-i386',
:wkhtmltopdf => 'c:\wkhtmltopdf\wkhtmltopdf.exe',


Simple Signal Smoothing via Signal Averaging using Matlab

Signal averaging is aimed to smooth signals which contain noise. The simple averaging process implemented here is using the idea of adding / summing several sequence of signals which each of them contains random noise. Next, the result of summation process is then divided by number of signal sequence added which then produced an averaged signal which has lower noise level than any of the original single signal. The implementation of the simple signal averaging is carried out using Matlab.

The complete code of signal averaging is shown below added with brief explanations

% taking average of sinusoidal signal with randomized noise
% Jonny Latuny, Feb. 21, 2012

close all; % close all open windows
clear all; % clear all previous / existing variables in workspace

dt = 1/1000; % define dt value
t = dt:dt:200*dt; % devine array of t
sine = sin(2*pi*100*t); % generate a sinusoidal signal based on t value

signal_all = []; % provide empty container to store summation result

for i = 1:10 % perform 10 loops in which 10 parts of signal are produced
y_noisy = sine + randn(size(t)); % signal + randonm noise
eval(['signal_' num2str(i) ' = y_noisy;']); % using eval to generate sequential signal segment
signal_all = [signal_all; eval(['signal_' num2str(i);])]; % concatenate all 10 signal into 1 matrix

signal_avr = sum(signal_all) / i; % calculating the average value

FT = fft(y_noisy,512); % FFT of a single signal
P = FT.* conj(FT)/512; % provide FFT result for plotting

FT_avr = fft(signal_avr,512); % FFT of averaged signal
P_avr = FT_avr.* conj(FT_avr)/512; % provide FFT result for plotting

subplot(2,1,1) % subplot 1
plot(P), axis([0 250 0 30]);
title('Spectrum of Single Signal (10th)');
xlabel('data points');

subplot(2,1,2) % subplot 2
plot(P_avr,'r-'), axis([0 250 0 30]);
title('Spectrum of Averaged Signal');
xlabel('data points');

Plot of Signal Averaging Example















The above composite plot shows the results of the simple signal averaging.

The top subplot shows FFT result of a single signal which contains noise.

The bottom subplot shows FFT result of the averaged signal which calculated using 10 sequences of signal samples as implemented in Matlab codes above.

Generating Daubechies wavelet function (psi) and wavelet scaling (phi) using Matlab

Matlab provides a function to generate wavelet function values and wavelet scaling values via build-in function called wavefun. (type help wavefun at Matlab command windows for information regarding wavefun function).

However, apart from Matlab build-in function,I’ve found out another way to produce psi and phi function during investigation of Wavelet application to mechanical vibration signal. The script invented make use of a function called daub.m which is taken from Uvi Wave v3 (a free wavelet toolbox for Matlab). Uvi Wave v3 can be downloaded from After extracting the zip file, daub.m can be copied from Uvi_Wave_300 folder at /Uvi_Wave_300/wfilter/. Copy the daub.m to a folder which has been included in Matlab search path, or include the entire Uvi_wave_300 folder in Matlab search path.

Here are the codes for producing db(x) wavelet function (psi).

clc; clear all; close all;
db_type = 4; % db(x), x = 2,4,6,8, ...
[hh,gg,rh,rg] = daub(db_type); % from Uvi Wave 300
h = rh .* 1.414;
g = rg .* 1.414;
for i=1:n
if i<n
x=linspace (0,3,length(psi));
judul= ['db',num2str(db_type),' psi (wavelet) function'];

And here are the codes for calculating db(x) scaling function (phi),

clc; clear all; close all;
db_type = 4; % db(x), x = 2,4,6,8, ...
[h,g,rh,rg] = daub(db_type); % from Uvi Wave 300
h = rh .* 1.414;
phi=1; %initial pulse]
n=10; %number of iteration
for i = 1:n
phi = conv(h,phi) ;
if i<n % last convolved need not go for upsampling
phi = upsample(phi,2);
x = linspace(0,3,length(phi));
judul = ['db',num2str(db_type),' phi (scaling) function'];

Below are the plots produced using wavelet psi and phi script presented above.

db4 psi















db4 phi
















Personal Caching Domain Name Server with BIND9 on Windows Vista

BIND9 is a popular domain server application in *nix platform. It serves an important roles in providing an open source DNS application for the Internet and local area network (LAN).
This publication explains how to install a Win32 BIND9 version that can be used as a personal caching DNS server in Windows Vista.

Step 1: Download BIND9 binary application for Win32 from Internet Consortium System website.

Step 2: Unzip the downloaded file to a folder (i.e., c:\bind9) and run the installer file named “BINDInstall.exe”. This will install Bind9 to the destination folder at \Windows\System32\dns\bin\.

BIND9 Installer window

Step 3: During the installation process, the installer will ask for a “Service Account Password”, select “automatic startup” then click install. Exit the installer when finished.

Step 4: Open the Command Prompt as Administrator / Run as Administrator and type the following commands :
cd c:\windows\System32\dns\bin (press enter)
wrote key file “C:\Windows\system32\dns\etc\rndc.key”

rndc-confgen -a (press enter)

Step 5: Close the command Prompt












Now there should be six files existed in the folder c:\windows\system32\dns\etc as shown in the picture below, except session.key file.

BIND9 Files

















Note that The file “rndc.key” file has been created step 4.

Step 6: Open Notepad (Run as Administrator) and copy and paste the following:

options {directory "c:\windows\system32\dns\etc";
pid-file none;
version "not currently available";
listen-on {;;; };

controls {
inet allow { localhost; } keys { rndc_key; };

key "rndc_key" {
algorithm hmac-md5;
secret "o690RparSJLi5da4mjPB/Q==";

zone "." IN {
type hint;
file "root.hints";

zone "localhost" IN {
type master;
file "zone.localhost";

allow-update { none; };

zone "" IN {
type master;
file "revp.127.0.0";
allow-update { none; };

include "filter.conf";

Note that before saving this file it is need to change the key string secret “o690RparSJLi5da4mjPB/Q==” to the same key string found in your file “rndc.key”. The key in your rndc.key file will be different to the one shown here. To get the key, open rndc.key file using Notepad and copy & paste the appropriate key for your system.

Also, it is needed to change the line listen-on {;;; }; with the corresponding IP address(es) that match the network where the caching DNS will be used.

Save the file as named.conf (Note: Run Notepad as Administrator to have rights to write or save at c:\Windows\System32\dns\etc\)

Step 7: Create a new file using Notepad and copy & paste the following root hints information into the file.

; <<>> DiG 9.3.2 <<>> NS .
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1378
;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 15

;.                IN    NS

.            518400    IN    NS    A.ROOT-SERVERS.NET.
.            518400    IN    NS    I.ROOT-SERVERS.NET.
.            518400    IN    NS    C.ROOT-SERVERS.NET.
.            518400    IN    NS    H.ROOT-SERVERS.NET.
.            518400    IN    NS    M.ROOT-SERVERS.NET.
.            518400    IN    NS    E.ROOT-SERVERS.NET.
.            518400    IN    NS    K.ROOT-SERVERS.NET.
.            518400    IN    NS    L.ROOT-SERVERS.NET.
.            518400    IN    NS    B.ROOT-SERVERS.NET.
.            518400    IN    NS    J.ROOT-SERVERS.NET.
.            518400    IN    NS    D.ROOT-SERVERS.NET.
.            518400    IN    NS    G.ROOT-SERVERS.NET.
.            518400    IN    NS    F.ROOT-SERVERS.NET.

A.ROOT-SERVERS.NET.    3600000    IN    A
B.ROOT-SERVERS.NET.    3600000    IN    A
C.ROOT-SERVERS.NET.    3600000    IN    A
D.ROOT-SERVERS.NET.    3600000    IN    A
E.ROOT-SERVERS.NET.    3600000    IN    A
F.ROOT-SERVERS.NET.    3600000    IN    A
G.ROOT-SERVERS.NET.    3600000    IN    A
H.ROOT-SERVERS.NET.    3600000    IN    A
I.ROOT-SERVERS.NET.    3600000    IN    A
J.ROOT-SERVERS.NET.    3600000    IN    A
K.ROOT-SERVERS.NET.    3600000    IN    A
L.ROOT-SERVERS.NET.    3600000    IN    A
M.ROOT-SERVERS.NET.    3600000    IN    A

When done, save the file as root.hints at C:\Windows\System32\dns\etc\.

Step 8: Create a new file using Notepad and copy & paste the following zone localhost information into the file.

; loopback/localhost zone file
$ORIGIN localhost.
@              IN  SOA   @  root (
1   ; Serial
8H  ; Refresh
15M ; Retry
1W  ; Expire
1D) ; Minimum TTL
IN   NS   @
IN   A

When done, save the file as zone.localhost at C:\Windows\System32\dns\etc\.

Step 9: Create a new file using Notepad and copy & paste the following information into the file.

; reverse pointers for localhost
@    IN   SOA  localhost. root.localhost. (
1    ; serial
8H   ; refresh
15M  ; retry
1W   ; expire
1D ) ; minimum
IN   NS   localhost.
1    IN   PTR  localhost.

When done, save the file as revp.127.0.0 at C:\Windows\System32\dns\etc\.

Step 10: Create a new file using Notepad and leave it empty (a blank file). Save the file as filter.conf at C:\Windows\System32\dns\etc\. It is an empty file and It will be filled with filter information if Bind9 is to be used to block adverts.

Step 11: Starting BIND9. In order to start the new BIND9, Open a Command Prompt (Run as Administrator) and type the following:

services.msc (press enter)

This will open Windows Services list as shown below.

Windows Services List

Windows Services List





















Scroll to find ISC BIND service line (as shown in the picture above), then right-click to open Properties dialog box for ISC BIND.

BIND9 Properties

BIND9 Properties


















Set the option Startup type to Automatic and click Start button to start ISC BIND for the first time. If there are no errors, BIND9 will be started and the Service status will changed from Stopped to Started.

If there is an Windows error message saying: Windows could not start the ISC BIND on Local Computer. Error 1067: The process terminated unexpectedly. Then check Log On Properties for ISC BIND. Click on the Log On tab in the Properties window and check that log-on setting matched the one shown below.

BIND9 Properties

BIND9 Properties


















Click OK to close the Properties window and try to restart ISC BIND via Services window again. When done, BIND9 is now running in local computer ( and ready to be used.

To test or use BIND9 as a personal DNS Caching server at the computer in which it is installed, put as Preferred DNS server in the network setting of the computer.

Reference page: