Operating System - HP-UX
1820561 Members
2600 Online
109626 Solutions
New Discussion юеВ

Re: How to determine host aliases for particular machine

 
Peter_17
Frequent Advisor

How to determine host aliases for particular machine

Hi All...

How can one determine the alias(es) for a machine without logging into it? Is there some method using nslookup?

HAGO,

Pete
7 REPLIES 7
Christopher McCray_1
Honored Contributor

Re: How to determine host aliases for particular machine

If you do an nslookup on the server and if there is an alias associated with it, it will state so at the bottom of the output as Aliases: ailias_name.

Hope this helps
Chris
It wasn't me!!!!
Curtis Larson_1
Valued Contributor

Re: How to determine host aliases for particular machine

get into interactive nslookup

at the prompt type:

ls -a domainname > tmpFileName
exit

grep yourHost tmpFileName

this does assume your dns server has correctly assigned a CNAME for the aliases
Edward Alfert_2
Respected Contributor

Re: How to determine host aliases for particular machine

Yes if it uses /etc/hosts instead of DNS.

take a look at the following 2 nslookups i did. The first lists aliases because it was able to find the computer in /etc/hosts. the second doesn't list aliases because it uses DNS which doesn't list aliases with an nslookup

# nslookup 192.0.0.2
Using /etc/hosts on: aistrend

looking up FILES
Name: aistrend
Address: 192.0.0.2
Aliases: aistrend.allinterior.com

# nslookup alfert.com
Using /etc/hosts on: aistrend

looking up FILES
Trying DNS
Non-authoritative answer:
Name: alfert.com
Address: 209.194.65.125
"Do what you love and you will never work a day in your life." - Confucius
Peter_17
Frequent Advisor

Re: How to determine host aliases for particular machine

Sorry, but none of the suggestions work. If I have a fully qualified hostname, and perform a nslookup on it, it does not reveal an alias(es) associated with it. However, if I do a nslookup on a known alias, it returns the FQDN along with the alias. Also, If I perform a nslookup on the IP, it only returns the FQDN.

In interactive mode, the ls command comes back as not recognized.

Session examples as follows:

Here, entering the alias actually returns the ip, FQDN, & the alias:

[me@unixbox1]% nslookup
> thealias
Using /etc/hosts on: unixbox1

looking up FILES
Trying NIS
Trying DNS
Non-authoritative answer:
Name: realhostname.something.com
Address: 1.2.3.4
Aliases: thealias.something.com

>

Entering the FQDN does not return the alias:

> realhostname.something.com
Using /etc/hosts on: unixbox1

looking up FILES
Trying NIS
Trying DNS
Non-authoritative answer:
Name: realhostname.something.com
Address: 1.2.3.4

>

Entering the IP of the box does not return the alias:

> 1.2.3.4
Using /etc/hosts on: unixbox1

looking up FILES
Trying NIS
Trying DNS
Name: realhostname.something.com
Address: 1.2.3.4

>

Any and all insight apprecaited.

HAGO,

Pete

Bernie Vande Griend
Respected Contributor

Re: How to determine host aliases for particular machine

non-authoritative answer implies that you are not pointed directly the the DNS server responsible for this domain. Can you identify its IP address. If so try this:
nslookup
> server IP_of_the_dnsmaster server
> ls -a domainname > filetocheck
> exit
You can then grep filetocheck for the host you want.

The ls option should work, perhaps its not because your /etc/resolv.conf is not pointed directly at the master DNS server.
Ye who thinks he has a lot to say, probably shouldn't.
Peter_17
Frequent Advisor

Re: How to determine host aliases for particular machine

Hmmm.. I have changed the nslookup server designator to the Primary, Secondary, and Tertiary DNS servers, all yeilding the same results. When I perform the ls -a command along with the domain, it always responds with
*** Can't list domain mydomain.com: Query refused

Pete
Bill Thorsteinson
Honored Contributor

Re: How to determine host aliases for particular machine

DNS will only return aliases if the reverse mapping is
done for the aliases. Often only the official name is
reverse mapped. In this case you can not get
a list of all aliases.

hosts files often contain the fully qualified name
as well as the hostname, but you need to log into
a server with a hosts file. Other than the local
system only necessary entries will be found there.

The use of CNAME entries can create aliases for
servers that the administrator is unware of.