Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesFaster Internet Access


August 1997 / Core Technologies / Faster Internet Access

Speed Internet surfing by caching DNS information on your desktop computer.

Jonathan E. Brickman

Most workstations with a connection to the Internet are by default configured to use a Domain Name System (DNS) server. Such a server belongs to an Internet Service Provider (ISP) or is on a LAN that has Net access. Before a workstation can establish a connection with any server on the Net, it must first obtain the server's address from the DNS, as shown in the figure . Because this initial communication to a DNS server often passes through a congested link to an ISP, it can result in delays and an unresponsive Net connection.

Fortunately, there's a good alternative: Instead of relying on an ISP's DNS server, a workstation can run its own DNS software in the background. If all DNS requests are made through the workstation's local DNS, that DNS can cache the results. Such a cache doesn't simply store recent host-name/IP equivalents: It also stores routes by which it obtains more data about domains. Thus, the local server accumulates a hierarchical list of what it learns about the Net's structure.

Since the local DNS builds its knowledge from fresh data each time it starts up, and since it doesn't touch the ISP's overloaded DNS at all, using a local DNS alone almost always enhances the performance of a Net connection. This article focuses on installing such a server on Windows 95 and Linux. But DNS server software exists for almost every platform currently in widespread use.

DNS Considerations

When running a local DNS on a workstation, you should keep a few thi ngs in mind. First, the software uses up system resources. See the table for basic information. Under Win 95, it requires enough resources that you should seriously reconsider the recommended amount of minimum memory. Under Linux, resource use of a DNS is almost imperceptible.

Another key point is bandwidth. This approach has been tested only with 28.8-Kbps and faster connections to the Net. The server works well for any TCP/IP connection: PPP and SLIP, static and dynamic IP, modem, ISDN, or T1. The server is also robust enough that it does not have to be restarted when a dynamic IP connection is broken and reestablished.

Another significant factor exists only under Win 95. The best DNS software available for Win 95 was written for Windows NT, and the documentation recommends against running it on Win 95. This is because of memory leaks in Win 95's integral TCP/IP stack. Despite this, I have been running the software continuously on a Win 95 machine for several weeks without problems. However, I've installed all of Microsoft's Win 95 updates, including the ISDN Acclerator Pack, which updates Dial-up Networking. Using this software on any Win 95 computer not running with all updates reliably is not recommended.

Doing Windows

The best DNS server software now available for Win32 is almost certainly Bind95/NT. A 1.6-MB download, it's available from http://www.windows95.com/apps/servers-misc.html . It is assumed that your computer accesses the Net using Microsoft's TCP/IP stack and Dial-up Networking software if you use a PPP or SLIP connection. This software might not work with third-party TCP/IP stacks.

The file that you download is a ZIP file. There are two directories within the archive: DISK1 and DISK2. Unpack this file to a temporary directo ry, preserving this directory structure. Run SETUP.EXE in the DISK1 subdirectory. If you wish to look at the README, do so. You'll note hardware minimums, as well as some strong warnings about using Win 95 with this software. There's also mention of a registry edit to increase the amount of Windows sockets available; so far this hasn't been necessary.

Next you'll see a prompt that reads, in part, "Enter this machine's Host name..." Type local into the dialog box and then type localhost into the next dialog box. Then you're asked to enter the subnet for your network. If you're using a modem or ISDN ISP connection, 255.255.255.0 works fine. On a LAN connection, ask your system administrator for the correct value.

Now choose a directory for the program files. The default, C:\var\named , is fine. The installer then creates directories and copies files. After this, you get a prompt that reads, "For creation of configuration files, please select the setup you want for BIND." You have three options at this point: primary DNS, secondary DNS, and caching-only DNS. Since you're configuring for a single workstation and not setting up primary or secondary DNS for an entire domain or subnet, you want caching-only DNS.

The installer creates the appropriate files for the selected server type. When it's done, you're told that the server is running. In the list of current processes, there's one called named95 ; this is it. Now you need to open or create a file called C:\WINDOWS\HOSTS in a text editor. If the file doesn't exist, create it with the following lines as its content:

127.0.0.1       localhost
127.0.0.1       local.localhost

If the file already exists, add the lines if they're absent. They set up a local domain ( .localhost ) and also set up the workstation as a host on the domain ( local.localhost ). Thus, the workstation will be interacting with the Net as if it had its own domain--which, in fact, it does, albeit one known only to the workstation.

If you use a dial-up connection, open the Dial-up Networking folder and right-click on a preconfigured connection icon. Choose Properties in this window and then click on Server Type. Click on TCP/IP Settings and choose Server Assigned Name Server Addresses. Click OK several times to back out to the Choose Properties window. Repeat these steps for each dial-up connection you use.

Next, bring up the Network Control Panel. Click on the TCP/IP->Dial-up adapter and click on Properties. Click on the DNS Configuration tab. If DNS is not enabled, click on Enable DNS and type local in the host box and localhost in the domain box. In the DNS Server Search Order address dialog box, type 127.0.0.1 , click on Add, and click on OK.

When you exit the Network Control Panel, don't restart the system if asked to do so. On some systems, the installer doesn't place a shortcut in the Startup menu to automatically start the server. Check your Startup settings to se e if one is present, and add one if it isn't. Then restart.

You'll notice that a DOS shell window, titled "named95," comes up minimized. This is your local DNS process. If you shut it down for any reason, you'll need to restart this process to access the Net. Unfortunately, limitations in Win 95 mean that a shortcut can't start this process without a DOS window. It's a minor irritation, but the advantages have so far vastly outweighed the irritation.

Linux

Any useful current distribution of Linux will have Bind version 4.9.3 or higher available. Even if you're already running Linux, you might not have it installed. If not, the executable named will not be found on a full-file-system search. These instructions assume that bind is installed, along with the rest of the standard utilities that ship with it in the Slackware, RedHat, and Debian distributions.

Download the DNS configuration files, which are archived in "uxdns.tgz" on The BYTE Site ( http://www.byte.com/art/download/download.htm ). Log in as a non-superuser. Unpack the archive into your user directory, preserving the directory structure.

The unpacked files include the following: etc/resolv.conf, etc/named.boot, etc/hosts, etc/rc.d/rc.inet2, var/named/db.127.0.0 , and var/named/db.cache . If your Linux box is on a LAN, you'll have to add the contents of etc/resolv.conf and etc/hosts to the existing files. Now edit etc/rc.d/rc.inet2 . You'll notice that several lines are uncommented:

# Start the NAMED/BIND name server.
if [ -f ${NET}/named ]; then
  echo -n " named"
  ${NET}/named
fi

Uncomment similar script lines in your machine's equivalent of /etc/rc.d/rc.inet2 . This starts the named daemon at system boot-up. If your Linux installation is recent or standard enough, these lines are already present in /etc/rc.d/rc.inet2 . If not, you must locate them or add them to /etc/rc.local . Copy the files in var/named to /var/named ; you may need to create the directory. Copy etc/named.boot to /etc .

If all is well, you should have a caching-only DNS server running on your Linux box when you reboot. Old or nonstandard installations of Linux may require more alterations in the procedure; make sure that the daemon is not being started twice. If you're running an old or incompatible beta kernel, you may have to compile a newer or more compatible one.


Minimum Platform Recommendation


Windows


Windows 95, 486/66 or faster, 16 MB or more of RAM, 5 MB or more of
free hard disk space, and a working PPP, SLIP, or LAN Internet
connection using Windows 95's built-in TCP/IP stack.


Linux


Any current standard Linux distribution, 386D
X/33 or faster, 8 MB or
more of RAM, and a working PPP, SLIP, or LAN Internet connection.
SLiRP, TIA, and term should work, although none of these has been
tested.




Resolving a Domain Name

illustration_link (13 Kbytes)

Name servers obtain IP addresses for given host-name strings; the results can be cached locally for speed.


Jonathan E. Brickman is president of River City Computing, Inc., a computer consulting and training company in Topeka, Kansas. You can reach him at brickman@cjnetworks.com .

Up to the Core Technologies section contentsGo to previous article: Go to next article: Atomic Power Speeds Data into the HomeSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network