Sunday, July 27, 2008

How to perform DNS query from your command prompt

If you are familiar with Linux network administrative, you will find that it will be more troublesome when you switched over to Windows based administration...I believe some of you who have the same experience will agree with me. :P

Now we can also perform DNS query ( e.g. dig, whois etc. ) from Windows command prompt, instead of browse to online webpage or SSH into the Linux server.

How to install the DNS query tool

  • Download the package from here or here and unzip it to C:\dig.
  • Edit the resolv.conf and replace the nameserver to your DNS server.
  • Save and copy the resolv.conf to C:\Windows\System32\drivers\etc
  • Go back to C:\dig, right click the doshere.inf and select Install.
  • Edit the Environment Variables ( can be found under [Control Panel]-->[System]-->[Advanced] )
  • Edit the "Path" and append "C:\dig" at the end of the line.
  • Now, you should be able to use the DNS query from command prompt!


Example on DNS query :

  • Show the name servers that controlling .my domains
    • dig my. NS
  • Show the name servers that controlling
    • dig NS
  • Show the Mail Exchange for
    • dig MX
  • Show the IP address for the web,
    • dig
  • Show the hostname of the IP address
    • dig -x
  • Show whois is owning the domain
    • whois

More informations at : Dig Manual Page

Use your Windows as Router

Do not have money to buy router? or your router is spoilt and cannot work properly??!! Now, you can use your Windows as a router easily.

Enable the IP Forwarding in Windows XP

  • Go to registry editor. Click on "Start"  --> "Run..", type "regedit" and press ENTER.
  • Then go to [HKEY_LOCAL_MACHINE]->[SYSTEM]->[CurrentControlSet]->[Services]->[Tcpip]->[Parameters]
  • Modify the [IPEnableRouter] value from "0" to "1".
  • Then, reboot your Windows.



Download the 3rd Party Software : NAT32

This is one of easier software to use and configure as NAT server. Download from NAT32 Windows Software Router.

Before you install the Setup.exe, you may need to install the Protocol at your network adaptor.

  • Go to your network adaptor properties page.
  • Then click "Install" and select "Protocol" then "Add"
  • nat32_01
  • Click the "Have Disk" and specify the directory into which you unzipped  NAT32.
  • Select the required .inf file ( use NDIS3P2K.inf for XP )
  • Click OK.
  • Reboot your Windows to start the driver.

Wednesday, July 23, 2008

How to resolve visitor's IP address using PHP?

Recently working on some PHP programming to resolve the visitor's IP address when visiting to my PHP page :

<title>What is my IP address</title> </head>
    if (getenv(HTTP_X_FORWARDED_FOR)) {
        $pipaddress = getenv(HTTP_X_FORWARDED_FOR);
        $ipaddress = getenv(REMOTE_ADDR);
echo "Your Proxy IP address is : ".$pipaddress. " (via $ipaddress) " ;
    } else {
        $ipaddress = getenv(REMOTE_ADDR);
        echo "Your IP address is : $ipaddress";

Monday, July 21, 2008

Build your own Network Attached Storage(NAS)

Need a network attached storage (NAS) ? Feel expensive to get one from the store ? Now, you can make your own with a normal desktop PC !!! Want to know about NAS ? Click here

Before you get started, make sure your hardware requirements as :

  • Minimum of 96MBytes of RAM.
  • A bootable CD Room.
  • or you may also install it in a virtual drive.

FreeNAS, is a open source FREE network attached storage running on FreeBSD 6.2 distribution and it is web-based GUI. I had just installed one FreeNAS on a server, and comparing it to Buffalo NAS, it is more powerful and more features!!!


FreeNAS, not only able to provide you the storage access using NFS and FTP, you may also use it a rsync server! Besides, it do support Samba (SMB) used by Microsoft Windows Network FIle System.


FreeNAS is probably one of the easiest installations out there. I can’t believe that it takes only a few minutes to perform a complete installation of an operating system.

FreeNAS can be downloaded from it website or through the FreeNAS SourgeForge Site. Choose the latest image (ISO) and get it downloaded. It would takes you some times if you are using a low bandwidth Internet access.. :) Burn the image into a CD and start your installations.

Simple guide to install FreeNAS :

  1. Boot up the burned ISO CD until you reach the console text-based installation menu as below :

    "Console setup"
    1) Assign Interface
    2) Set LAN IP address
    3) Reset WebGUI password
    4) Reset to factory defaults
    5) Ping host
    6) Shell
    7) Reboot system
    8) PowerOff system
    9) Install to a hard drive/memory drive/USB Pen, etc

  2. First, assign the interface by clicking "1" then followed by setting the IP address, option "2".

  3. Then, you may proceed on the installation by clicking option "9". ( This option will be disappeared if you had installed successfully into the hard drive. )

    1) Install on HD, CF or USB key: Create 1 UFS partition
    2) Install on HD: Create 2 UFS partitions (OS and DATA)
    3) Upgrade existing installed version from CDROM
    4) Return to main menu

  4. You can select either install the FreeNAS boot partition and data partition on the same partition or you can seperate it for both boot partition and data partition. It is recommended to select option "2" here so that you can use the remaining space in the HDD as Data storage.

  5. Once the FreeNAS is install completed, remove the CD.

  6. Then select "4" to exit to the main menu, and select "7" to reboot the system.

  7. Now, you may access the Web interface by browsing to the http://<IP_ADDRESS_CONFIGURED>.

  8. The default username : admin and password : freenas

  9. Download the manual here, or browse to the online manual. Proceed with the configurations.

  10. Then, you NAS will be ready to use! Good luck ya...