Where does an ubuntu machine get it's doamin name from

Marius Gedminas marius at pov.lt
Wed Sep 16 12:39:56 UTC 2009


On Wed, Sep 16, 2009 at 08:11:04AM -0400, stan wrote:
> I need to change the domain on all of the machines at work by Friday. I had
> a contractor working on these machines and he "helped". That is he put
> shortt names in /etc/hostname, and /etc/mailname. This is NOT what I asked
> him to do, but it is what I found. My first thought is just to put the new
> FQDN in there, but this has my curiosity stired up. Where are these
> machines currently getting thier doamins from? They are not running NIS, so
> that can't be it.

/etc/hosts, usually.  Try 'man hostname', it says the following:

  THE FQDN
       You  can’t  change the FQDN (as returned by hostname --fqdn) or the DNS
       domain name (as returned by dnsdomainname) with this command. The  FQDN
       of  the  system  is  the name that the resolver(3) returns for the host
       name.

       Technically: The FQDN is the name gethostbyname(2) returns for the host
       name returned by gethostname(2).  The DNS domain name is the part after
       the first dot.

       Therefore it depends on the configuration (usually  in  /etc/host.conf)
       how  you can change it. Usually (if the hosts file is parsed before DNS
       or NIS) you can change it in /etc/hosts.

and also

  FILES
       /etc/hosts  /etc/hostname This file should only contain domain name and
       not the full FQDN.

So assuming you have widget.example.com, you should have the following

  $ cat /etc/hostname
  widget
  $ cat /etc/hosts
  127.0.0.1     localhost
  1.2.3.4       widget.example.com widget

If you don't have a static IP, it's customary to use a different loopback
address:

  $ cat /etc/hosts
  127.0.0.1     localhost
  127.0.1.1     widget.example.com widget

/etc/mailname ought to have the FQDN, according to 'man mailname'.

  $ cat /etc/mailname
  widget.example.com

Hope that helped,
Marius Gedminas
-- 
I am right now in the process of reading the Xft source code (the suspense near
the end of Chapter 7 is unbearable) [...]
	-- Juliusz Chroboczek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090916/1a091f56/attachment.pgp>


More information about the ubuntu-users mailing list