Developer

Tech Tip: Add a service with Srvany/Create a caching-only DNS forwarder

See how to configure an application to run as a service by using the Srvany tool, and find out how to create a caching DNS forwarder on your network to reduce network traffic for DNS and improve DNS lookup.

Run an application as a service with Srvany

In Windows, services are applications that perform specific functions. For example, the Workstation service creates and manages connections to other computers on the network.

Windows includes several services of its own, and many application vendors add their own services to Windows as part of their applications. For example, the remote-access tool VNC installs a VNC Server service to enable incoming remote connections to the computer.

While some applications don't install automatically as services, you can certainly run them as a service. Here are some of the benefits to running an application as a service:

  • It starts automatically and runs in the background.
  • It stays running even when the user logs off.
  • It can run in a security context other than the current user.

Keep in mind that some applications will still terminate at logoff even when running as services as they do not ignore the WM_ENDSESSION or CTRL_LOGOFF_EVENT messages.

You can configure an application to run as a service by using the Srvany tool, which is part of the Windows 2000 Professional Resource Kit. To install Srvany as a service, issue the following command:

instsrv MyService c:\path\srvany.exe

Replace \path\srvany.exe with the path to Srvany.exe on your system. You can also change the service name from MyService to something more descriptive.

For details on configuring application-specific settings, check out the Srvany.exe Help topic in the Windows 2000 Professional Resource Kit Tools Help file.

Configure a caching-only DNS forwarder

If you want to reduce network traffic for DNS and improve DNS lookup, one solution is to create a caching DNS forwarder on your network. A caching-only DNS server receives queries from clients, performs the queries against other name servers, caches the results, and returns those results to the client.

It then returns subsequent queries for the specified host from the cache instead of submitting them to an external server. This reduces outgoing DNS traffic and speeds up name resolution.

You can set up a caching-only server by configuring the DNS service with one or more forwarders, which are upstream DNS servers to which the local DNS server will forward queries (essentially acting as a DNS client).

You can configure the DNS service to work with forwarders either nonexclusively or exclusively. In nonexclusive mode, the DNS server checks its cache for the host. If the lookup fails, it forwards the query to the specified forwarder. If that query fails, the DNS server attempts to resolve the query on its own through the root servers.

In exclusive mode, the DNS service also checks its cache. If the lookup fails, it forwards the query to the forwarder.

If the upstream servers fail the query, the DNS server doesn't attempt resolution on its own; instead, it fails the query to the client. A DNS server acting in exclusive mode with a forwarder is a caching-only slave.

To configure forwarding, open the DNS console, right-click the server, and choose Properties. On the Forwarders tab, choose Enable Forwarders, and add the IP addresses of the upstream DNS servers to which you want to forward queries. If you want the DNS service to work in exclusive mode, select the Do Not Use Recursion option. Click OK to apply the change.

Keep in mind that restarting the server will clear the DNS cache, so a caching-only server works best when it's been running for an extended period of time.

Editor's Picks

Free Newsletters, In your Inbox