Re: set domain name in Debian `
On Fri, Nov 11, 2016 at 02:47:48PM -0700, Glenn English wrote:
> > On Nov 11, 2016, at 1:52 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> >
> > So... what are you actually trying to do? Be very specific.
>
> Well, I'd like the domain name to be the same everywhere. hostname -f
hostname -f is totally useless. Why do people even KNOW about it, let
alone use it? :(
wooledg@wooledg:~$ hostname
wooledg
wooledg@wooledg:~$ hostname -f
wooledg
The output of hostname is largely irrelevant. The only purpose it serves
is to help you, the sysadmin or competent user, remember which system
you're currently logged into.
Including a domain name in that output is ridiculous if all of your
systems are used within the same organization.
> and whois <IP> (that currently returns the ISP's info)
This is a DNS registrat thing. It has nothing to do with Debian, or
anything that you do on your own computer. You need to contact the
hosting provider, or ISP, or whoever owns this block of IP addresses
and have them set it up.
It's incredibly cosmetic.
> and /etc/hosts
This is used only by the local processes on the computer, and it's used
mostly to find OTHER computers that aren't in DNS. Either because your
organization is so small that you don't even bother to use DNS (say,
half a dozen computers or less), or because your network was set up
by less than competent admins back in the 1990s.
If your computer has a preferred fully qualified domain name, then you
can put it in there. Debian puts the computer's own hostname (with or
without an attached domain name) on the IP 127.0.1.1, thus:
127.0.0.1 localhost
127.0.1.1 wooledg
If I cared about writing out really long domain names in /etc/hosts
then I might change the second line to:
127.0.1.1 wooledg.eeg.ccf.org wooledg
This is largely pointless.
> and host <IP> and a DNS lookup
host(1) is indeed one of the many commands that can look up a name in
DNS. As I said before, if you don't specify a fully qualifed domain
name, then the "search" line(s) in /etc/resolv.conf will tell the
resolver which domain names to slap onto the end of the hostname before
looking it up.
wooledg@wooledg:~$ cat /etc/resolv.conf
search eeg.ccf.org
nameserver 10.76.142.103
nameserver 10.76.142.42
nameserver 172.28.254.24
wooledg@wooledg:~$ host wooledg
wooledg.eeg.ccf.org has address 10.76.172.109
As you can see here, host told the resolver to look up "wooledg", and
the resolver looked in /etc/resolv.conf and found the default search
domain, and appended that, and then did a DNS lookup of
"wooledg.eeg.ccf.org".
The default search domain doesn't even have to be one of the domain names
by which your machine is known to others. It can be whatever you want
for your own convenience. USUALLY your machine's default search domain
and "self-idenfies as" domain name will be the same.
> and everything else I can't think of right now
What your server calls itself doesn't really matter.
What matters is how OTHER COMPUTERS reach you.
Thus, you need to be looking at your DNS setup with your domain registrar.
> The DNS server isn't set up yet.
That should be your top priority.
> mailname is just the host. postfix is the SMTP server
Configuring mail without having working DNS is just an exercise in
frustration. Get DNS correct first, and then get mail working.
Since you've "changed" your "domain" (which I interpret to mean
"I have a server on the Internet, and it used to receive mail sent
to user@example1.com and now I want it to receive mail sent to
user@example2.com") you probably really want your mail server to
continue to receive email for BOTH of these domains, at least for a
transitional period during which people might still be sending to the
original domain name.
Once you've got DNS set up correctly, you'll want to tell your mail
server "accept mail for example1.com and example2.com". I don't
know how to do that with Postfix specifically.
Also, while you're in there, tell Postfix that you would like outgoing
mail to appear as coming from "example2.com". Again, I don't know how
to do this with Postfix, but it should be relatively straightforward
once you find the documentation.
After a year or so, then you might choose to stop accepting mail sent
to example1.com, but that's up to you.
For a server on the public Internet, the output of hostname is completely
irrelevant. All that matters is what's in DNS.
Example: I have a VPS on the public Internet. It processes web requests
sent to the hostnames "wooledge.org" and "mywiki.wooledge.org".
Neither of these names is present in the output of "hostname".
The web server simply does not care what "hostname" is set to. It only
cares about the hostname used in the HTTP requests that are sent to it.
Set the local hostname to something that will help you remember which
machine you're logged into. That's all.
Reply to: