LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Domain name questions (https://www.linuxquestions.org/questions/linux-general-1/domain-name-questions-828689/)

davholla 08-26-2010 04:17 PM

Domain name questions
 
My hosts file is like this :-

Code:

127.0.0.1  localdomain  localhost
192.168.0.2  david.domain.com davidpc.david

But if I try to check my domain name I get
Code:

domainname
(none)
[root@davidpc david]#

Any ideas?

AlucardZero 08-26-2010 04:37 PM

domainname returns your NIS (YP) domain name, not your DNS domain name.

davholla 08-27-2010 03:55 PM

Thanks for that.
When I try dnsdomainname I get an error
Code:

dnsdomainname
dnsdomainname: Unknown host

Any ideas why?

tredegar 08-27-2010 04:35 PM

Quote:

My hosts file is like this :-


Code:

127.0.0.1    localdomain      localhost
192.168.0.2  david.domain.com davidpc.david


I don't have any use for dnsdomainname but your hosts file is wrong / not formatted correctly

It should read like this:

Code:

#IP NUMBER    FQDN                Shortname

127.0.0.1      localhost
192.168.0.2    david.domain.com    david

You can change domain.com to anything you like, but I prefer hostname.home.net or hostname.home.lan - it does not really matter so long as you are consistent with your naming. It is your LAN, so, as long as you are using private LAN IP address allocations (192.168.x.y etc.), you can do as you wish as these addresses are not routed through to the internet.


All times are GMT -5. The time now is 01:50 PM.