1825769 Members
2001 Online
109687 Solutions
New Discussion

Re: Full Domain

 
SOLVED
Go to solution
Dario_1
Trusted Contributor

Full Domain

Is there other command other than hostname and nslookup or that will give me the full server domain?

Thank you for your help.
10 REPLIES 10
Jeff Schussele
Honored Contributor

Re: Full Domain

Hi,

grep domain /etc/resolv.conf

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Colin Topliss
Esteemed Contributor
Solution

Re: Full Domain

If you mean the domain that the server is currently residing in, you could try

test:/root=> domainname
wibble.com

Col.
Steven E. Protter
Exalted Contributor

Re: Full Domain

You can install this utility. I recommend against using the depots unless they have been improved. Get the source and compile it that way.

http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/dig-2.0/


This will allow you do get really high quality information.

You can use nslookup and get more details with set commands.

nslookup
> set type=mx
> windflite.com

This might help as well.

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
Colin Topliss
Esteemed Contributor

Re: Full Domain

I should add that that what you get back depends on what name service resolution you are using!
Dario_1
Trusted Contributor

Re: Full Domain

Is there any command that will give me the name.domain.com together?

Thx,

DR
Jeff Schussele
Honored Contributor

Re: Full Domain

Hi Dario,

I always setup the system hostname in /etc/hosts as follows:

111.222.111.222 hostname hostname.company.com

i.e. the FQDN is an alias in the hosts file. If this is used then you could do the following

grep hostname /etc/hosts | awk '{print $3}'

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Colin Topliss
Esteemed Contributor

Re: Full Domain

Not that I know of.

The FQDN normally appears in your host file against the IP address you want that name associated with.

domainname only works with NIS (which is why I mentioned the name resolver).

So, nslookup or looking in the host file (assumiing you've added this as either the primary name or an alias) are your best bets.
Jeff Schussele
Honored Contributor

Re: Full Domain

Hi (again) Dario,

It should be noted that the domainname command deals ONLY with the NIS domain name.
This is rarely if ever the same as the domain name used for host naming.
Outside of using nslookup or the commands listed above, there is no one command I know of that will give you the FQDN of a host.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Dario_1
Trusted Contributor

Re: Full Domain

Thank you to all of you. That's what I thought.

Regards,

Dario
Marc Ahrendt
Super Advisor

Re: Full Domain

if your system is using DNS then this will work

ping `hostname` -n 1 | head -n 1 | awk '{print $2}' | tr -d ':'
hola