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 Project Fedena version 2.2 on Win32

Step 1: Install Ruby
Download and install One-Click Ruby Installer for Windows.
http://rubyforge.org/frs/download.php/72085/rubyinstaller-1.8.7-p302.exe

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
http://downloads.mysql.com/archives/mysql-5.0/mysql-essential-5.0.90-win32.msi
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)

http://files.rubyforge.vm.bytemark.co.uk/rmagick/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip

5.1. Unzip ImageMagick-6.5.6-8-Q8.zip
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 http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-installer.exe

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',

References:
http://latunyj.no-ip.org/2011/07/fedena-project-for-win32-platform/
http://projectfedena.org/install

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 { 127.0.0.1; 192.168.0.0/24; 180.216.59.213; };
};

controls {
inet 127.0.0.1 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 "0.0.127.in-addr.arpa" 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 { 127.0.0.1; 192.168.0.0/24; 180.216.59.213; }; 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 . @m.root-servers.net
; (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

;; QUESTION SECTION:
;.                IN    NS

;; ANSWER SECTION:
.            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.

;; ADDITIONAL SECTION:
A.ROOT-SERVERS.NET.    3600000    IN    A    198.41.0.4
B.ROOT-SERVERS.NET.    3600000    IN    A    192.228.79.201
C.ROOT-SERVERS.NET.    3600000    IN    A    192.33.4.12
D.ROOT-SERVERS.NET.    3600000    IN    A    128.8.10.90
E.ROOT-SERVERS.NET.    3600000    IN    A    192.203.230.10
F.ROOT-SERVERS.NET.    3600000    IN    A    192.5.5.241
G.ROOT-SERVERS.NET.    3600000    IN    A    192.112.36.4
H.ROOT-SERVERS.NET.    3600000    IN    A    128.63.2.53
I.ROOT-SERVERS.NET.    3600000    IN    A    192.36.148.17
J.ROOT-SERVERS.NET.    3600000    IN    A    192.58.128.30
K.ROOT-SERVERS.NET.    3600000    IN    A    193.0.14.129
L.ROOT-SERVERS.NET.    3600000    IN    A    199.7.83.42
M.ROOT-SERVERS.NET.    3600000    IN    A    202.12.27.33

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
;
$TTL 1D
$ORIGIN localhost.
@              IN  SOA   @  root (
1   ; Serial
8H  ; Refresh
15M ; Retry
1W  ; Expire
1D) ; Minimum TTL
IN   NS   @
IN   A    127.0.0.1

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
;
$TTL 1D
$ORIGIN 0.0.127.in-addr.arpa.
@    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 (127.0.0.1) 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 127.0.0.1 as Preferred DNS server in the network setting of the computer.

Reference page: http://npr.me.uk/installdns.html