Operating System - HP-UX
1844044 Members
2776 Online
110227 Solutions
New Discussion

Re: help needed to setup resolv.conf

 
SOLVED
Go to solution
charudatta
Occasional Advisor

help needed to setup resolv.conf

hi all,
i have 2 servers lets name it A and B both are connected to internet thru lan. but i can not browse the internet on them as DNS is not setup.
i added resolv.conf on server A with only nameserver entry. nothing else like search/domain etc...
now if i try to ping/telnet B from A i get host unknown error.
B's /etc/hosts as entry for A
how do i override /etc/hosts on resolv.conf
i tried LOCALDOMAIN does not work.
all u experts out there any solution....
thankx in advance
RTFM
6 REPLIES 6
Ajay Sishodia
Frequent Advisor
Solution

Re: help needed to setup resolv.conf

charudatta,

resolv.conf will be something like this

domain xxx.companydomain.com
search xxx.companydomain.com companydomain.com
nameserver zzz.yyy.xxx.ttt
nameserver ---

now for host lookup you have to change your nsswitch.conf to look at DNS. edit the line for hosts in /etc/nsswitch.conf like this

hosts: dns[NOTFOUND=continue] files[NOTFOUND=return]

now hosts lookup will first try DNS, if hosts name is not resolved than it will try files (/etc/hosts)

regards
Ajay
Thierry Poels_1
Honored Contributor

Re: help needed to setup resolv.conf

Hi,

you should check /etc/nsswitch/conf. It should contain something like:

hosts: dns files
or
hosts: files dns

depends if you want to give priority to dns or to /etc/hosts.

good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Sanjay_6
Honored Contributor
Patrick Wallek
Honored Contributor

Re: help needed to setup resolv.conf

You probably need to set up your /etc/nsswitch.conf file in addition to the /etc/resolv.conf file.

The nsswitch.conf controls how the hosts lookup behaves.

Here are examples of my nsswitch.conf and resolv.conf files:

# cat /etc/nsswitch.conf
hosts: files [NOTFOUND=continue] dns

# cat /etc/resolv.conf
domain upr.com
search upr.com houston1.anadarko.com anadarko.com
nameserver 144.94.68.3
nameserver 172.30.0.177
nameserver 172.30.0.176

charudatta
Occasional Advisor

Re: help needed to setup resolv.conf

hey guys changed nsswitch.conf...
it all worked out thankx a lot
RTFM
Uday_S_Ankolekar
Honored Contributor

Re: help needed to setup resolv.conf

Hi,

1. /etc/resolv.conf file contains following information

Domain Name : Company's domain name.
Name Server : DNS server name or IP adress
Search : Sear list for hostname lookup

Refer RFS 1535 for more details in /usr/share/doc
Also man resolv.conf would be a help.

2. /etc/nsswitch.conf is the configuaration file for named service

It directs many files to look for informations in a given order.
EX for hosts look for /etc/hosts (files) if not look for DNS and so forth..
Ex:
hosts: files [NOTFOUND=continue UNAVAIL=continue] dns [NOTFOUND=return UNAVAIL=continue T
RYAGAIN=return]
netgroup: files [NOTFOUND=return UNAVAIL=return]
networks: files [NOTFOUND=return UNAVAIL=return]
passwd: files [NOTFOUND=return UNAVAIL=return]

-USA..
Good Luck..