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

Re: Domain Name



On 18 Mar 1998, Martin Bialasinski wrote:

> Remco Blaakmeer <remco@Cal011205.student.utwente.nl> writes:
> 
> > On 17 Mar 1998, Martin Bialasinski wrote:
>  
> > > If your /etc/hostname reads "omnic", then you should have a line like this
> > > in your /etc/hosts:
> > > 
> > > 127.0.0.1	omnic.my.home	omnic
> > > 
> > > The fqdn has to be at the first place.
> > 
> > It doesn't work for me, though. I have /etc/hostname reading "blaakmeer"
> > and lines in /etc/hosts like this:
> > 
> > 127.0.0.1     localhost
> > 130.89.222.95 blaakmeer.student.utwente.nl blaakmeer cal011205.student.utwente.nl cal011205
> 
> Strange. Works for me. I have:
> 
> 127.0.0.1	localhost
> 127.0.0.1	haitech.martin.home	haitech
> [...]
> 
> #hostname --fqdn
> haitech.martin.home    
> 
> # hostname --domain
> martin.home   
> 
> [change second line to "127.0.0.1	haitech	haitech.martin.home" ]
> 
> # hostname --fqdn
> haitech    
> 
> # hostname --domain
> #     
> 
> (I dont have a /etc/domainname and /etc/hostname reads "haitech")

Yes, this also works for me, but this was not the issue. The issue was
getting agetty to display the fqdn in the login screen. You can do this
with 'issue escapes' in /etc/issue. I have this line in /etc/issue :

Welcome to \n.\o at \l

This resolves (or should resolve) to something like:

Welcome to blaakmeer.student.utwente.nl at tty2

But agtty apparently uses the 'wrong' system call to get the domain name
and displays (none) if you didn't set it. The issue here seems to be that
there are two ways of getting the domain name.

/bin/domainname (linked to /bin/hostname) uses getdomainname(2) to get the
domain name. This technically is the YP/NIS domain name.

/bin/dnsdomainname (linked to /bin/hostname) uses gethostname(2) to get
the host name, passes the result to gethostbyname(2) to get the FQDN and
then strips the hostname part from the FQDN to get the domain name.

Note that the results can be different. The first will be (none) if you
don't use NIS. Your NIS domain name can apparently be different from your
DNS domain name.

To make them the same, I found that this is the easiest way:

domainname `dnsdomainname`

This doesn't use /etc/domainname, so that's one file less to edit. :-)

If you don't have /bin/domainname or /bin/dnsdomainname , you can create
the links yourself:

# ln -s hostname /bin/domainname
# ln -s hostname /bin/dnsdomainname

Note, this is only needed if you want getty to display your fqdn at the
login screen and you don't use NIS.

Remco


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: