[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Got a machine name problem



Gene Heskett (gheskett@shentel.net) wrote:
> But wtf? I have edited "sudo nano" /etc/domainname, did not set the i 
> bit, and the edit is still there, but asking for it is (none)

There is no such file on my system.  What made you think that you should
create this file?  What program did you think would use it?

> domainname domain.name changes it only for this boot, a reboot clears it 
> to (none) again.

       domainname - show or set the system's NIS/YP domain name

Are you using NIS?  If you are, you should be configuring the NIS domain
name in the file /etc/defaultdomain (which is read by /etc/init.d/nis
which is what the systemd unit points to, because apparently Debian's NIS
packaging is not fully updated for systemd).

But I think you're actually just confused, and you aren't using NIS, but
somehow you've started poking around at various pieces of NIS without
realizing it.  And you've also mixed up command names and filenames.

> So I must have screwed something up with that edit, but how do I fix it?

What *exactly* are you trying to do?

Are you trying to set your default DNS domain name, which is used to
search for fully qualified hostnames when you only type partial hostnames?

E.g. let's pretend you work for a company named Neener and they use the
domain name neener.com for their internal hosts.  You're at your desk
in the Neener HQ, and you're using a Unix workstation that they've set
up for you.  It has the hostname "ws43", or "ws43.neener.com".

Now, you want to ssh into your coworker's workstation, which has the
hostname "ws31", or "ws31.neener.com".

Since it isn't the 1980s, your workplace has set up a DNS infrastructure
that lets you obtain the IP address of ws31.neener.com (and all the other
workstations, servers, and so on).  So, if you were to type
"ssh ws31.neener.com", that would work.  You'd get the IP address of
ws31.neener.com from DNS, and you'd connect to the correct workstation.

But that's a lot of typing.  So your workplace has also arranged things
so that you can simply type "ssh ws31", and that will also work.

How does that work?

In the file /etc/resolv.conf there are several different kinds of lines
that may be present.  One of them is the "search" line.

If the resolv.conf file contains the line "search neener.com", this means
any hostname that you try to resolve which doesn't contain a dot will
get ".neener.com" appended to it.  So, when you try to resolve "ws31",
the DNS resolver library will automatically try "ws31.neener.com" for
you.

So, the next question is, "How can I put the line search neener.com into
my /etc/resolv.conf file?"  In a sane, sensible universe, it would be
easy -- you would just edit the file with a text editor, and that would
be the end of it.

But we do not live in that universe.

The /etc/resolv.conf file is continually, automatically rewritten by a
plethora of programs that all think they know what you want.  They're
all wrong, of course, but you can't make the developers understand that.
Your changes to the /etc/resolv.conf file will be overwritten, probably
within an hour.

At this point, please read <https://wiki.debian.org/resolv.conf> to see
what your options are, for making permanent changes to resolv.conf.  It's
really stupidly complicated, and there's no point in my repeating it
all here.

THAT is how you set your default DNS domain name, and THAT is what it
means to have a default DNS domain name in the first place.  It's not
about your own hostname.  It's about shortening what you have to type
when you resolve *other* hostnames within your organization's namespace.


Reply to: