Name server problems

Tony Facca fsfacca at AVELON.LERC.NASA.GOV
Sat Sep 8 00:00:25 AEST 1990


Your problem is fixed in the 3.3 release of the software where you can tell 
the system to lookup names in the host table either before or after it attempts
to use the nameserver to resolve.

In the meantime, here is a short script which you can run as root to
temporarily enable/disable the name resolver on your machine.  Be careful that
no one else is on when you run it because it brings the inetd (network 
services) down and then back up.

Hope this helps.

------------------------- cut here for best results --------------------------
#! /bin/csh -f
# nameserver    turn the nameserver on or off and do all the other 
#               network stuff that is required to support the change.
#
# Original Author:  Tony Facca
# Original Date:    July 1989 
#
# Modified by Scott Presnell Thu Mar  1 08:41:59 PST 1990
#
# 128.156.1.43  falcon.lerc.nasa.gov
# 128.156.1.33  eagle.lerc.nasa.gov 

set primary = "128.156.1.43"  			# Internet address primary NS
set secondary = "128.156.1.33"  		# secondary nameserver 
set domain = "lerc.nasa.gov"                    # domain name

set CONFIG=/etc/config

if (! -o /bin/su) then
	echo "You must be superuser to run this script"
	exit(-1)
endif


switch ($1)
	case "on":
		echo "on" > $CONFIG/named
		/bin/rm -f /usr/etc/resolv.conf
		echo "$0 : enabled -- restarting the network"
		/etc/init.d/network stop
		/etc/init.d/network start
		/etc/init.d/network.local start
	breaksw
	case "remote":
		if (-e /usr/etc/resolv.conf) then
			echo "Nameserver already in remote mode."
			exit()
		else
			echo "domain $domain"        >  /usr/etc/resolv.conf
			echo "nameserver $primary"   >> /usr/etc/resolv.conf
			echo "nameserver $secondary" >> /usr/etc/resolv.conf
			echo "$0 : remote operation enabled -- restarting the network"
			echo "off" > $CONFIG/named
			/etc/init.d/network stop
			/etc/init.d/network start
			/etc/init.d/network.local start

		endif
	breaksw
	case "off":
		echo "$0 : disabled -- restarting the network"
		echo "off" > $CONFIG/named	
		/bin/rm -f /usr/etc/resolv.conf
		/etc/init.d/network stop
		/etc/init.d/network start
		/etc/init.d/network.local start
	breaksw
	case "status":
		if ( `cat $CONFIG/named` == "on" ) then
			echo "$0 : named should be operating,\c"
			if  ( ! { (kill -0 `cat /usr/etc/named.pid` > /dev/null) } ) then
				echo " but it isn't. Better check this out."
			else
				echo " and it is."
			endif
		else if ( -e /usr/etc/resolv.conf ) then
			echo "$0 : in remote operation mode."
		else if ( ! { (kill -0 `cat /usr/etc/named.pid` > /dev/null) } ) then
			echo "$0 : a named process is running, but named is not specified in the system configuration."
		else
			echo "$0 : all host name service through the /etc/hosts file."
		endif
	breaksw
	default:
		echo "Usage:  $0  status|on|remote|off"
	breaksw
endsw
exit()

------------------------------------------------------------------------------



--
-----------------------------------------------------------------------------
Tony Facca   |   fsfacca at avelon.lerc.nasa.gov      |     phone: 216-433-8318
-----------------------------------------------------------------------------
      You are at Witt's end.  Passages lead off in *all* directions.



More information about the Comp.sys.sgi mailing list