Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to disable DNS on Solaris 7

2 views
Skip to first unread message

Gary Quiring

unread,
Jan 8, 2003, 11:21:28 AM1/8/03
to
I would like to disable DNS on Solaris 7. We don't have an internal DNS server
and when our ISP goes out the Sun box is not happy. I do not need DNS, the
server is just running an Informix database.

When I tried commenting out the nameserver lines in the /etc/resolv.conf the
database slowed down almost immediately. I was looking at the
/etc/nsswitch.conf file and see a reference to DNS on the host line. Is that
the only other file that needs to be changed?

Also if I change the resolv.conf and nsswitch.conf files will it work without a
reboot?

Thanks
Gary Quiring

Barry Margolin

unread,
Jan 8, 2003, 11:45:16 AM1/8/03
to
In article <3e1c500a$0$1416$8e9e...@news.atx.net>,

Gary Quiring <gqui...@msn.com> wrote:
>I would like to disable DNS on Solaris 7. We don't have an internal DNS server
>and when our ISP goes out the Sun box is not happy. I do not need DNS, the
>server is just running an Informix database.
>
> When I tried commenting out the nameserver lines in the /etc/resolv.conf the
>database slowed down almost immediately. I was looking at the
>/etc/nsswitch.conf file and see a reference to DNS on the host line. Is that
>the only other file that needs to be changed?

Yes. You should just remove dns from nsswitch.conf, leave resolv.conf
alone. That way, any programs that use DNS directly (e.g. nslookup) will
still know what nameservers to use.

>Also if I change the resolv.conf and nsswitch.conf files will it work without a
>reboot?

Any network-related programs that are already running, like network
daemons, will probably have cached the information they got when they
started up. So you either need to restart all these daemons or reboot.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Michael Tosch

unread,
Jan 8, 2003, 1:08:19 PM1/8/03
to
In article <3e1c500a$0$1416$8e9e...@news.atx.net>, Gary Quiring <gqui...@msn.com> writes:
> I would like to disable DNS on Solaris 7. We don't have an internal DNS server
> and when our ISP goes out the Sun box is not happy. I do not need DNS, the
> server is just running an Informix database.
>
> When I tried commenting out the nameserver lines in the /etc/resolv.conf the
> database slowed down almost immediately. I was looking at the
> /etc/nsswitch.conf file and see a reference to DNS on the host line. Is that
> the only other file that needs to be changed?

Yes
Delete or rename /etc/resolv.conf, and delete the "dns" in /etc/nsswitch.conf.
If your Informix server is still slow, it does direct resolver lookups.

>
> Also if I change the resolv.conf and nsswitch.conf files will it work without a
> reboot?

Yes.


--
Michael Tosch / Master IS/IT Support
Ericsson Eurolab Deutschland GmbH
Tel: +49 2407 575 313


Darren Dunham

unread,
Jan 8, 2003, 3:24:58 PM1/8/03
to
Barry Margolin <bar...@genuity.net> wrote:

>>Also if I change the resolv.conf and nsswitch.conf files will it work without a
>>reboot?

> Any network-related programs that are already running, like network
> daemons, will probably have cached the information they got when they
> started up. So you either need to restart all these daemons or
> reboot.

Any examples? Most daemons should be using the resolver libraries
(gethostbyname() and relatives). If so, they'll work fine without a
reboot.

I believe nscd even flushes the host cache on changes to nsswitch.conf.

--
Darren Dunham ddu...@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >

Barry Margolin

unread,
Jan 8, 2003, 3:33:45 PM1/8/03
to
In article <uO%S9.1077$q91.63...@newssvr21.news.prodigy.com>,

Darren Dunham <ddu...@redwood.taos.com> wrote:
>Barry Margolin <bar...@genuity.net> wrote:
>
>>>Also if I change the resolv.conf and nsswitch.conf files will it work without a
>>>reboot?
>
>> Any network-related programs that are already running, like network
>> daemons, will probably have cached the information they got when they
>> started up. So you either need to restart all these daemons or
>> reboot.
>
>Any examples?

sendmail

> Most daemons should be using the resolver libraries
>(gethostbyname() and relatives). If so, they'll work fine without a
>reboot.

No they won't. The resolver routines only read the configuration files the
first time they're used in a process. So any process whose lifetime
spanned the change to the files may not notice the changes.

Darren Dunham

unread,
Jan 8, 2003, 9:19:49 PM1/8/03
to
Barry Margolin <bar...@genuity.net> wrote:

> sendmail

>> Most daemons should be using the resolver libraries
>>(gethostbyname() and relatives). If so, they'll work fine without a
>>reboot.

> No they won't. The resolver routines only read the configuration files the
> first time they're used in a process. So any process whose lifetime
> spanned the change to the files may not notice the changes.

I don't think that's true.

Try this program. Run it, then take 'dns' out of your
/etc/nsswitch.conf file. Don't do anything else... You can use any
host you like, but it's most obvious to use a host via CNAME, so you can
see the different name returned.

#include <stdio.h>
#include <netdb.h>

main(){
struct hostent* name;

while(1){
sleep(3);
name = gethostbyname("smtp.google.com");

if (name == NULL) {
printf ("No answer\n");
continue;
}
printf ("Answer: %s\n", name->h_name);
}
}

gcc -lnsl name.c
$ ./a.out
Answer: smtp8.google.com
Answer: smtp8.google.com
No answer
No answer
No answer
No answer
No answer
No answer
Answer: smtp8.google.com
Answer: smtp8.google.com
^C

Barry Margolin

unread,
Jan 9, 2003, 10:56:38 AM1/9/03
to
In article <9%4T9.1111$f72.66...@newssvr21.news.prodigy.com>,

Darren Dunham <ddu...@redwood.taos.com> wrote:
>Barry Margolin <bar...@genuity.net> wrote:
>
>> sendmail
>
>>> Most daemons should be using the resolver libraries
>>>(gethostbyname() and relatives). If so, they'll work fine without a
>>>reboot.
>
>> No they won't. The resolver routines only read the configuration files the
>> first time they're used in a process. So any process whose lifetime
>> spanned the change to the files may not notice the changes.
>
>I don't think that's true.
>
>Try this program. Run it, then take 'dns' out of your
>/etc/nsswitch.conf file. Don't do anything else... You can use any
>host you like, but it's most obvious to use a host via CNAME, so you can
>see the different name returned.

Are you running nscd? If so, the library doesn't read nsswitch.conf
directly, it lets nscd handle everything for it. And nscd, unlike the
resolver library, checks for nsswitch.conf changing while it's running.

Actually, I could be wrong about some of this. While I'm pretty sure that
changes to /etc/resolv.conf are not noticed by the resolver functions
(res_*), I'm less sure about whether /etc/nsswitch.conf changes are checked
for by the higher-level functions (get*by*).

Darren Dunham

unread,
Jan 9, 2003, 3:49:27 PM1/9/03
to
Barry Margolin <bar...@genuity.net> wrote:

>>Try this program. Run it, then take 'dns' out of your
>>/etc/nsswitch.conf file. Don't do anything else... You can use any
>>host you like, but it's most obvious to use a host via CNAME, so you can
>>see the different name returned.

> Are you running nscd? If so, the library doesn't read nsswitch.conf
> directly, it lets nscd handle everything for it. And nscd, unlike the
> resolver library, checks for nsswitch.conf changing while it's running.

*bing* right answer. I remembered the connection about nscd changing
behavior when nsswitch.conf is changed, but I didn't kill it when I did
my test.

It's behavior was the one changing.

So, you have to bounce all the daemons if you're not running nscd. I
generally just disable the hosts-cache rather than kill it entirely,
allowing me to misinterpret the behavior.

0 new messages