Mailinglist Archive: opensuse (958 mails)

< Previous Next >
Re: [opensuse] Where to set the domain name? - Leap 15.1 beta - SOLVED, I think.

Long post showing what I tried, the process - at the bottom, the
finding. Quick answer: the domain name is simply written in /etc/hosts,
matching the machine name with an entry in that file.

On 08/05/2019 19.33, James Knott wrote:
On 05/08/2019 01:08 PM, Carlos E. R. wrote:
I don't know why you get something different.  I'm running 15.0.
Maybe because the DNS is masqdns and the entries there are in /etc/hosts
file, which contain both the long and the short names.

My hosts only had the short name, so I added the FQDN.  Same result.


Elesar:/etc # grep -d skip -i valinor *
hosts:# Elesar.valinor Elsesar
hosts: Elesar.valinor Elsesar
hosts~: Elesar.valinor Elsesar
hosts~: Elesar.valinor Elsesar
resolv.conf:#search valinor Valinor valinor Valinor
resolv.conf~:search valinor Valinor
Elesar:/etc #

Currently, only the "hostname" file has the domain. If I remove the
domain, it still works:

Elesar:/etc # hostname
lesar:/etc # hostname -f
hostname: Name or service not known
Elesar:/etc # host router
router has address
Elesar:/etc #

May it be that the DNS machine has a hostname with the domain part?

Ah, I think I see it. dnsmasq has a line:


but the comments do not match my thoughts. I can not paste, but the line
means that queries on that domain are not sent upstream.

Then how do that machine knows which is the domain name? It must be
defined somewhere, it is the LAN DNS server. In that machine, "hostname
-f" is working. The answer so far in this thread is that the DNS tells.
Ok, but how does my dnsmasq in 15.0 obtain that info from?

Look, I removed "valinor" from all files in /etc, even the "local" in
dnsmaq, and still "hostname -f" is working.

I restore things and they still work. And now, surprise,

Elesar:~ # hostname -f
Elesar:~ #

Ah, I know why. Typo in hosts file:

hosts: Elesar.valinor Elsesar

Writing this post I noticed and corrected. How exactly does this machine
know the fqdn?

Elesar:~ # strace -o hostname.strace hostname -f
Elesar:~ #

From nscd:

connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0
sendto(3, "\2\0\0\0\16\0\0\0\7\0\0\0Elesar\0", 19, MSG_NOSIGNAL, NULL,
0) = 19
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=3,
read(3, "\2\0\0\0\1\0\0\0\1\0\0\0\4\0\0\0\17\0\0\0\0\0\0\0", 24) = 24
read(3, "\300\250\1\206\2Elesar.valinor\0", 20) = 20
close(3) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 8), ...}) = 0
write(1, "Elesar.valinor\n", 15) = 15

Ok, I'll stop nscd and retry.

open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=718, ...}) = 0
read(3, "#\n# hosts This file desc"..., 4096) = 718
read(3, "", 4096) = 0
close(3) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 8), ...}) = 0
write(1, "Elesar.valinor\n", 15) = 15
exit_group(0) = ?
+++ exited with 0 +++

From the hosts file? Am I reading it right?

It knows already the "name" of the machine, because above that I see:

uname({sysname="Linux", nodename="Elesar", ...}) = 0

so it looks for the short Elesar name in the /etc/hosts files and there
finds the fullname. That's it.

Elesar:~ # dnsdomainname
Elesar:~ #

Ok! So I got it working.

No need for a working DNS? There is no entry in the DNS for this
machine. Let's try disabling the DNS in resolv.conf:

domain valinor

Elesar:/etc # dnsdomainname
Elesar:/etc # host router
Host router not found: 3(NXDOMAIN)
Elesar:/etc #


Does the current IP need to match? Yes, it does (I changed it in host
file, then dnsdomainname fails).

Cheers / Saludos,

Carlos E. R.

(from openSUSE, Leap 15.1 x86_64 (ssd-test))

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
This Thread
Follow Ups