Operating System - HP-UX
1834389 Members
2160 Online
110066 Solutions
New Discussion

Re: Question about hostname resolve

 
SOLVED
Go to solution
chuanpeng.wang
Frequent Advisor

Question about hostname resolve

Is there system process will resolve the other server's IP to the hostname?
I found DNS packet in TCP packets, but I don't know which process do this.
I don't have DNS on my server.

/etc/nsswitch.conf
hosts: files[NOTFOUND=continue] dns
12 REPLIES 12
H_16
Trusted Contributor

Re: Question about hostname resolve

Use your host file in /etc/
Sharma Sanjeev
Respected Contributor

Re: Question about hostname resolve

Hi

Add entry in /etc/hosts file

with Hostname and ip address

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Torsten.
Acclaimed Contributor

Re: Question about hostname resolve

>> "I don't have DNS on my server.

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

But this line looks like you have (continue to DNS)!

Do you have a config in

/etc/resolv.conf ?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Torsten.
Acclaimed Contributor

Re: Question about hostname resolve

Easy test:

# nslookup www.hp.com

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Masud Parvez
Valued Contributor

Re: Question about hostname resolve

you can add your hostname and IP address to the /etc/hosts file

or you can point to your existing DNS server by giving entry into /etc/resolv.conf

example (IP=DNS server IP address)
nameserver IP
Torsten.
Acclaimed Contributor

Re: Question about hostname resolve

I don't think the question is "how to resolve", but "why it is asking DNS".

IMHO the answer is in /etc/nsswitch.conf.

A process wants to resolve a hostname that is not in the hosts file.

That's why I wrote about the easy test - you will just see what happens.

# nslookup www.hp.com
Using /etc/hosts on: xyz

looking up FILES
==> Trying DNS <==
...
Aliases: www.hp.com

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Steven E. Protter
Exalted Contributor

Re: Question about hostname resolve

Shalom,

If you have no DNS server to work with then nsswitch.conf should not have a configuration that tries to continue to a non-existent DNS server. That will simply slow network operations on your system. Better to simply let /etc/hosts resolve or fail and get an answer back quickly.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Deepak Kr
Respected Contributor

Re: Question about hostname resolve

Hi chuanpeng.wang

If other node information is not found in your local /etc/hosts then only resolution process will move to dns as next resort.

So you have two choices as everyone told.
either use /etc/hosts
or
use DNS server to resolve hostname/IP

File: /etc/hosts
File: /etc/resolv.conf
"There is always some scope for improvement"
chuanpeng.wang
Frequent Advisor

Re: Question about hostname resolve

Sorry, I mislead you.
My question is which process ask for DNS resloving.

In the TCP packet, I found some process try to resolve the IP to hostname, but I don't know which process do this.
It seems some system process, because my user application will not do this.
Which system process will try to resolve IP to hostname?
Please give me some example.
Deepak Kr
Respected Contributor

Re: Question about hostname resolve

If I am not wrong it is inetd service.
"There is always some scope for improvement"
Patrick Wallek
Honored Contributor
Solution

Re: Question about hostname resolve

There is no 'system process' that does DNS resolution. This is done by via system calls to networking type routines.

If you can resolve host names to IP addresses, via tools like nslookup, dig, ping, etc., but your application can not, then you application is designed badly and is not really network aware.

I would talk to the application vendor if this is a purchased app. If this is an in-house developed app, then the developers need to go back a look at their code.
Patrick Wallek
Honored Contributor

Re: Question about hostname resolve

By the way, DNS resolution has absolutely nothing to do with inetd.

Processes started by inetd (telnet, ftp, remsh, rcp, etc.) are network aware and have code built in (or probably more accurately call libraries) that does the network name / IP address lookup.