How To: Configure Caching Nameserver (named)

Mission

To configure a caching nameserver on a local machine which will cascade to another previously configured and functional nameserver (may or may not be caching. It’ll generally be your ISP nameserver or the one provided by your organization).

Advantage

  • Reduces the delay in domain name resolution drastically as the requests for frequently accessed websites are served from cache.

Working

  • named gets a request for domain resolution.
  • It checks whether the request can be satisfied from cache. If the answer is in cache and not stale, the request is satisfied from cache itself saving a lot of time 🙂
  • If request can’t be satisfied from cache, named queries the first parent. If it replies with the answer, then named will cache the response and subsequent requests for the same domain name will be satisfied from the cache.
  • In case first parent fails to reply, named will query the second parent and so on.

(The working is my understanding of caching-nameserver using wireshark as traffic analysis tool and caching-nameserver may not behave exactly as explained above.)

How to install

named is by default on most of the systems by the package name ‘caching-nameserver‘. If its not present on your system, install using

[root@localhost ~]# yum install caching-nameserver [ENTER]
# If that doesn't work try this
[root@localhost ~]# yum install bind [ENTER]

How to configure

The main configuration file for named resides in /var/named/chroot/etc/named.caching-nameserver.conf which is also soft linked from /etc/named.caching-nameserver.conf . named configuration file supports C/C++ style comments.

For a caching nameserver which will cascade to another nameserver, there is nothing much to be configured. You need to configure “options” block. Below is a configuration file for a machine with IP address 172.17.8.64 cascading to two nameserver 192.168.36.204 and 192.168.36.210. The comments inline explain what each option does.

options {
  // Set the port to 53 which is standard port for DNS.
  // Add the IP address on which named will listen separated by semi-colons.
  // It'll be your own IP address.
  listen-on port 53 {127.0.0.1; 172.17.8.64;};
  // These are default. Leave them as it is.
  directory   "/var/named";
  dump-file   "/var/named/data/cache_dump.db";
  statistics-file "/var/named/data/named_stats.txt";
  memstatistics-file "/var/named/data/named_mem_stats.txt";
  // The machines which are allowed to query this nameserver.
  // Normally you'll allow only your machine. But you can allow other machines also.
  // The address should be separated by semi-colons. To allow a network 172.16.31.0/24,
  // the line would be
  // allow-query {localhost; 172.16.31.0/24; };
  // Don't forget the semi-colons.
  allow-query     { localhost; 172.17.8.64; };
  recursion yes;
  // The parent nameservers. List all the nameserver which you can query.
  forwarders { 192.168.36.204; 192.168.36.210; };
  forward first;
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
zone "." IN {
  type hint;
  file "named.ca";
};
include "/etc/named.rfc1912.zones";

Start caching-nameserver

Now start the caching-nameserver using the following command

[root@localhost ~]# server named start [ENTER]

OR

[root@localhost ~]# /etc/init.d/named start [ENTER]

To make named start every time your reboot your machine use following command

[root@localhost ~]# chkconfig named on [ENTER]

Using caching-nameserver

To use your caching-nameserver, open /etc/resolv.conf file and add the following line

nameserver 127.0.0.1

Comment all other lines in the file, so that finally the file looks like

; generated by /sbin/dhclient-script
#search wlan.iiit.ac.in
#nameserver 192.168.36.204
#nameserver 192.168.36.210
nameserver 127.0.0.1

Now your system will use your own nameserver (in caching mode) for resolving all domain names. To test if your nameserver use the following command

[root@localhost ~]# dig fedora.co.in [ENTER]

Now if you use that command for the second time, the resolution time will be around 2-3 milli seconds while first time it would be around 400-700 milli seconds.

Example

Below is two subsequent runs of dig for fedora.co.in . Notice the Query time.

[root@bordeaux SPECS]# dig fedora.co.in
; <<>> DiG 9.4.2rc1 <<>> fedora.co.in
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7839
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;fedora.co.in.                  IN      A
;; ANSWER SECTION:
fedora.co.in.           83629   IN      A       72.249.126.241
;; AUTHORITY SECTION:
fedora.co.in.           79709   IN      NS      ns.fedora.co.in.
;; ADDITIONAL SECTION:
ns.fedora.co.in.        79709   IN      A       72.249.126.241
;; Query time: 531 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Nov 19 18:04:47 2008
;; MSG SIZE  rcvd: 79
[root@bordeaux SPECS]# dig fedora.co.in
; <<>> DiG 9.4.2rc1 <<>> fedora.co.in
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64233
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;fedora.co.in.                  IN      A
;; ANSWER SECTION:
fedora.co.in.           83625   IN      A       72.249.126.241
;; AUTHORITY SECTION:
fedora.co.in.           79705   IN      NS      ns.fedora.co.in.
;; ADDITIONAL SECTION:
ns.fedora.co.in.        79705   IN      A       72.249.126.241
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Nov 19 18:04:51 2008
;; MSG SIZE  rcvd: 79
[root@bordeaux SPECS]#
 

Info: Spicebird 0.7 Pre with Awesome Features

Spicebird is

your one platform for many collaboration needs. It provides e-mail, calendaring and instant messaging with intuitive integration and unlimited extensibility.

Spicebird beta 0.7 pre release is out now and can be downloaded in 10 languages from the i10n nightly build archive. For the latest nightly build of English version, check this English nightly build archive.

Some of the new features in version 0.7 are

  • Google Applets in Home Tab
    • You can add Google applets in the Home tab. For example: On home tab, click Add Applet -> Google Applet. Add a url to Google applet (e.g. Google Map Search). And you’ll have a nice Google map on your home page 🙂
    • Or add date & time applet ( this url )
    • Or from the thousands of applets available from Google 🙂

Google Applets in Spicebird

  • Auto Update Feature
    • Spicebird now checks for updates automatically 🙂

Spicebird Auto Update

  • Its way faster than the previous version. Thats my personal opinion. I was using Spicebird beta 0.4 since more than 6 months.

Check the official release announcement for more details.

How to install Spicebird for test usage

Download

Get the latest version of Spicebird from nighty build archive.

Extract and Move

Extract the Spicebird archive file as

[root@localhost ~]# tar -xjf spicebird-beta-0.7pre.en-US.linux-i686.tar.bz2 [ENTER]

Move the extracted directory to /opt/

[root@localhost ~]# mv spicebird-beta /opt/ [ENTER]

Create shortcut on Panel

Right click on Gnome panel and click “Add to Panel

Add Spicebird to Panel

Click on “Custom Application Launcher”

Spicebird Custom Application Launcher

Fill in appropriate details as shown in the following image

Spicebird Create Application Launcher

Choose an icon for Spicebird by clicking the “No Icon” button on the top left corner.

Spicebird Launcher Icon

Click Ok. And you are done. Now click the new icon that has just appeared on the panel. Rest of the configuration like account creation and settings is exactly same as Thunderbird or Evolution or any other mail client.

Reference : Spicebird Official Website

 

Hack: A Fast Network Scanning Program

I was searching for a simple tool which can do a port scanning in a huge network quickly without making me wait for ages. I first thought of using nmap, but it was a bit too complex and it takes a lot of time to discover the machines even after optimizing the parameters. After searching a lot, I wrote to one of my seniors, Sandeep Kumar, asking the details of his program which maintains a list of active FTP servers in the network. He replied with a reference to his own findings about the network scanning tools. He is using an enhanced version of a program originally written by Troy Robinson. I tried the program out of curiosity and found out that its damn fast as compared to nmap (no literal comparison) 🙂 The program can be downloaded from here.

How to use

Compile the program using gcc as

[root@localhost ~]# gcc NetworkScanner.c [ENTER]

Now create a file IPRange.txt containing the IP address ranges for your network. The contents of the file may be

172.16.*.* Meaning all the IP address with first two parts as 172.16 and rest of the address will be generated by permutations.

172.16.1-16.* Meaning the first two parts are fixed. Third part will vary from 1 to 16. And the fourth part will be permuted from 0 to 255.

So an IPRange.txt may look like

1
2
172.16.1-16.*
192.168.36.*

Now run the program as

[root@localhost ~]# ./a.out port_to_be_scanned Parallel_attempts IP_list_file output.txt [ENTER]

Parallel_attempts is the number of processes that’ll be forked for scanning the network port. It is safe to have its value as 255. A very high value may hog the network or may even slow down your machine. So an example run would be

[root@localhost ~]# ./a.out 21 255 IPRange.txt Output.txt [ENTER]

Benchmarks

I carried out a lot of test on my network using the following setup and parameters

Machine : AMD X2 5600+ (2.6GHz Dual Core), 4GB 800MHz DDR2 RAM, Gigabit Ethernet Card (on 100mbps network).

Port : 21 (FTP)

IPRange.txt : Total 16896 IP Addresses

1
2
3
4
5
Machines on wired (100mbps) network
172.16.1-48.* 
192.168.36.*
Machines on wireless (54mbps) network
172.17.0-16.*

Network Scanner Benchmarks

Parallel Attempts

Scanning Time (seconds)

Upload Bandwidth (kbps)

255 180 13
512 90 25
1024 47 55
2048 25 100
4096 14 205
6144 11 307
8192 9 374

The interval between two scans was almost 30-40 seconds. I think parallelism beyond 8192 will crash my machine, so I didn’t try. You can try it at your own risk 🙂 I hope this program help you scan your network.

 

Humour: Ubuntu is Costlier than Microsoft Windows XP

Dell started selling their new Dell Inspiron Mini 9 series yesterday as informed by slashdot article. Lately I have been looking for a mobile solution which should be easy to carry and have enough computing power to meet my expectation. I liked the SSD concept replacing the mechanical hard disk. I just moved over to Dell website and tried configuring one for myself (go here to configure them yourself). I am an open source addict but I am not an Ubuntu fan but still going with ubuntu sounds better than going with M$ stuff. So, started configuring the Ubuntu machine and pushed everything (main memory, hard disk and other components) to maximum. A few minutes later I realized that the Ubuntu model’s price is more than the equivalent config with M$ Windows.

Below is a table comparing Windows XP and Ubuntu model of Dell Inspiron Mini 9 series. The differences are highlighted in red color.

Ubuntu 8.04
Microsoft Windows XP Home Premium
$494
$479
My Components
Obsidian Black
Obsidian Black
Mini OS powered by Ubuntu 8.04
Genuine Windows® XP Home Edition
1GB DDR2 at 533MHz
1GB DDR2 at 533MHz
16GB Solid State Drive
16GB Solid State Drive
Built-in Bluetooth 2.1 capability
Built-in Bluetooth 2.1 capability
Integrated 1.3M Pixel Webcam
Integrated 1.3M Pixel Webcam
My Service
1Yr Ltd Warranty and Mail-In Service
1Yr Ltd Warranty and Mail-In Service
Also Includes
Intel® Atom Processor® N270 (1.6GHz/533Mhz FSB/512K cache) Intel® Atom Processor® N270 (1.6GHz/533Mhz FSB/512K cache)
Glossy 8.9 inch LED display (1024X600)
Glossy 8.9 inch LED display (1024X600)
Intel Graphics Media Accelerator (GMA) 950
Intel Graphics Media Accelerator (GMA) 950
Wireless 802.11g Mini Card
Wireless 802.11g Mini Card
32WHr Battery (4 cell)
32WHr Battery (4 cell)
Base LCD Assembly
Base LCD Assembly
Base LCD Assembly in Black
Base LCD Assembly in Black
No Installation
No Installation
Adobe® Acrobat® Reader 8.1, English
McAfee SecurityCenter 30-day Trial
Microsoft Works 9 DOES NOT INCLUDE MS WORD
No ISP requested

According to the above table Ubuntu alone is costlier than Genuine Microsoft Windows XP Home Premium + Adobe Acrobat Reader 8.1 English + McAfee SecurityCenter 30-day Trial + Microsoft Works 9 (MS Word Excluded). I am not sure if Dell is trying to promote Microsoft by selling Windows XP model at a lower price or they are generating more revenues for Ubuntu by selling it at a higher price or they are just fooling the customers. Below are the picture proofs if Dell changes the prices.

Inspiron Ubuntu

Inspiron Windows

 

Info: Eclipse DemoCamps 2008 – Ganymede Edition Hyderabad

About the event from Eclipsepedia,

Eclipse is releasing version 3.4 (Ganymede) on 25th June 2008. To mark the occasion, the Eclipse foundation is organizing a series of Democamps around the world. The Hyderabad edition is organized by hyd-eclipse.org (a Hysea initiative). We will discuss the new features and projects in the Ganymede release, and also present a few case studies of some interesting usecases of Eclipse. The event will conclude with a networking of the Eclipse developers’ community in Hyderabad.

I happened to attend the camp with a lot of my friends. Organisers were overwhelmed by the turnout. More than 100 people (mostly from industry) attended the camp and the place was almost overcrowded. The idea was to educate the newbies about the new features in version 3.4 and showcase some demos for enterprise software development and also to bring the eclipse developers at a common platform.

The camp started with a session about the new features in Ganymede version. Kiran Kumar from Progress Software talked about the new features like improved regular expression support, changes in update manager, enhancements in PDE etc. Following this, Saurav from Pramati Technologies talked about the WTP new features in this version mainly with respect to JavaScript and other Java improvements. Finally Ravi Sankar from Progress Software concluded with Xpand demo.

All in all, it was a good event which provided a bit of exposure to the developments going on in and around Hyderabad. Thanks Hysea, Progress and Pramati for organizing the wonderful event 😀