Solved

Slackware how to set domain using DHCP

Posted on 2015-01-28
11
197 Views
Last Modified: 2015-02-05
I am running Slackware 14.1 kernel 3.14.24-smp. This host get's it IP via DHCP. My problem is that when booting, during initial DHCP/IP negotiation,  I see a message to the effect: "unable to determine fully qualified domain name". Running `hostname` gives:
$ hostname -f
# (a few second delay ...)
viao

Open in new window

Why does my DHCP server (also Linux) not "set" the domain name? My /etc/HOSTNAME file is:

viao

and /etc/hosts is:

127.0.0.1               localhost
127.0.0.1               viao

/etc/resolv.conf has:

domain hprs.local
nameserver 192.168.0.2
nameserver 192.168.1.1

I was running Ubuntu on this same machine and the domain name seemed to get set OK. It has a /etc/hostname file, not /etc/HOSTNAME, but it, /etc/hosts and /etc/resolv.conf contained the same thing (with the exception of the 192.168.1.1 nameserver which is likely from the wlan0's different DHCP server).

What's up? Do I need some additional DHCP client parameters?
0
Comment
Question by:jmarkfoley
  • 6
  • 5
11 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 40576739
Mark,

Dhcp only allocates an IP and can set certain parameters domain, name servers, time servers, etc.

He delay is because of your setup the nsswitch.conf setting for hosts: is what gets consulted for the response. So it checks one resource, and when nothing is found it looks/consult files.

The hostname, is configured manually. Hostname new name should do the trick.
There should be a startup script that loads up a config file/settings often the name include network. Have not slackware in a long time,...
0
 
LVL 77

Expert Comment

by:arnold
ID: 40576747
/etc/resolv.conf lonely deals with name service/dns you can add searchdomain HPRS..local  which will help when searching for hostname it will append the searchdomain in one of the lookup attempts.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40576799
Arnold:
The hostname, is configured manually. Hostname new name should do the trick.
hello again! ...

Yes, the hostname is configured in /etc/HOSTNAME and is not a problem. I'm setting that. The domainname is hprs.local and is, in fact set in the /etc/resolv.conf apparently by dhcpd:
$ cat /etc/resolv.conf
# Generated by dhcpcd from eth1, wlan0
# /etc/resolv.conf.head can replace this line
domain hprs.local
nameserver 192.168.0.2
nameserver 192.168.1.1
# /etc/resolv.conf.tail can replace this line

Open in new window

It says right there in /etc/resolv.conf that the domain is hprs.local, so why nothing shown with `hostname -f`? Likewise nothing with domainname, dnsdomainame and nisdomainname. As I mentioned, this did work with Ubuntu, so I'm wondering if there is a setting I need for dhcpcd.conf.
you can add searchdomain HPRS..local  which will help when searching for hostname it will append the searchdomain in one of the lookup attempts.
Setting "search hprs.local" in /etc/resolv.conf didn't help.

In fact, /etc/dhcpcd.conf does have:

option domain_name_servers, domain_name, domain_search, host_name

so, I don't get why I can't list the domain name.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 77

Expert Comment

by:arnold
ID: 40576816
Hostname does not combine the hostname+domain name.
If you modify your /etc/hosts to have 127.0.0.1 viao viao.hprs.local

If I am not mistaken, will still not be reported to a hostname query, tough I might be wrong.

presumably, the samba/ldap schema will appear similar to the AD Which only uses the hostname portion of records for joined systems.


/etc/resolv.conf is parameter setting for the named/DNS substructure and is not one consulted by hostname.
If use nslookup hostname, the domain will be appended in the DNS lookup query.
0
 
LVL 77

Expert Comment

by:arnold
ID: 40576818
Changes to hosts file to include viao.hprs.local may do what you are looking, alternatively, using hostname -A might get you a response that includes all the variations ......
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40585383
If use nslookup hostname, the domain will be appended in the DNS lookup query.
That is true and works from the DC/DNS, but not from the client. This client host is not actually joined to the domain, however. Maybe that makes a difference.

If use nslookup hostname, the domain will be appended in the DNS lookup query.
Likewise, not on the DHCP client host.

Changes to hosts file to include viao.hprs.local may do what you are looking,
Yes, I know it would. However, I could have sworn that my Ubuntu installation didn't need me to set the domain name locally anywhere. Perhaps I'm mistaken. Or maybe some helper program like networkmanager did the job. I may have to create a Ubuntu host to satisfy my itch.
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 40585404
The hostname -f consults including /etc/hosts.
Often the hosts file is configured with IP hostname FQDN

Though most of the time, FQDN is left to the DNS where the internal reference only use then hostname.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40590402
I have put the FDQN (viao.hprs.local) in /etc/HOSTNAME and /etc/hosts. It appears that only /etc/rc.d/rc.M looks at /etc/HOSTNAME and then only to extract the hostname only part to set the hostname via the /bin/hostname command.

Once the FDQN is set in /etc/hosts the `hostname -f` command works.

Hmmm, but I remember ... Ubuntu ... oh well, moving on!
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40591318
I closed this after successfully getting `hostname -f` with the FDQN and being able to do `host <name>` to various hosts on the LAN. Shortly thereafter, neither of those worked -- I didn't do nuthin! Frustrating. Will repost a new question.
0
 
LVL 77

Expert Comment

by:arnold
ID: 40591484
Not sure I understand. Do you want this question reopened
host is a named name resolution command.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40591644
Do you want this question reopened
No, see new question: http://www.experts-exchange.com/Networking/Linux_Networking/Q_28610925.html. It's just that if I had seen the problem earlier I would have continued in this question.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question