Thomas Pircher <[email protected]> wrote:
> On 2026-09-30 12:31, Chris Green wrote:
> > I already have the following in /etc/hosts:-
> > 
> >     127.0.1.1   t16.zbmc.eu     t16
> 
> That's the method recommended by the Debian's administrator handbook.
> This works for me. I'm using systemd-networkd and systemd-resolved, 
> FWIW.
> 
> > but this doesn't seem to have the required effect.
> 
> What does not work exactly?

My /etc/hosts file has:-
    127.0.0.1       localhost
    127.0.1.1       q957.zbmc.eu    q957

and /etc/hostname
    chris$ more /etc/hostname
    q957
    chris$ 

But:-
    chris$ ypdomainname
    ypdomainname: Local domain name not set
    chris$ domainname
    (none)
    chris$ dnsdomainname
    zbmc.eu
    chris$ 


> The name in /etc/hostname must match one of the aliases, for the system 
> to match up the FQDN.
> Is there a reason you use 127.0.1.1 instead of the more commonly used 
> value 127.0.0.1?
> 
It's what a Debian 13 installation produces, I have 127.0.0.1 as
localhost (see above).


> Having said all this, the host name is a property of the host, while the 
> domainname is more a property of the network you are connected to (and 
> may even vary, depending on which route you use to connect to the host). 
> So it should ideally be obtained from the network, e.g. from DHCP. 
> That's not always an option, in which case the /etc/hosts method is a 
> perfectly reasonable way to do so.
> 
As you can see 'dnsdomainname' does return the domain name because I have
my DNS (in my router) configured with the domain name. However things
like postfix and others use ypdomainname/domainname to get the domain.

-- 
Chris Green
ยท

Reply via email to