...making Linux just a little more fun!

### how to set domain name in debian ?

J. Bakshi [j.bakshi at unlimitedmail.org]

Sun, 26 Jul 2009 23:30:18 +0530

Dear list,

I have become confused about the domain name handling in debian. I have a suse box too. It is very easy to set the domain name in suse box " domainname <example.com> ". Similarly to set FQDN in suse " hostname <hostname>.<example.com>"

How to achieve this in debian ? No domainname command is there in debian (lenny). There are /etc/hosts and /etc/hostname but where can I save domain name ? and where to save FQDN ? I am really confused here. Please enlighten me. Thanks.

PS: Kindly CC me

Top Back

René Pfeiffer [lynx at luchs.at]

Sun, 26 Jul 2009 20:17:17 +0200

On Jul 26, 2009 at 2330 +0530, J. Bakshi appeared and said:

    > Dear list,
    > I have become confused about the domain name handling in debian. I
    > have a suse box too. It is very easy to set the domain name in suse
    > box " domainname <example.com> ". Similarly to set FQDN in suse "
    > hostname <hostname>.<example.com>"

The hostname in Debian is set by a combination of files. My workstation is called "agamemnon" which is also the content of /etc/hostname. It belongs to the luchs.at network so therefore my /etc/resolv.conf looks like this:

    domain luchs.at
    search luchs.at
    nameserver a.b.c.d
    nameserver a.b.c.e

According to the hostname command the FQDN (Fully Qualified Domain Name) gets determined like this:

    "The address families hostname tries when looking up the FQDN, aliases
    and network addresses of the host are determined by the configuration
    of your resolver. For instance, on GNU Libc systems, the resolver
    can be instructed to try IPv6 lookups first by using the inet6 option in
    /etc/resolv.conf."

Whenever I configure systems I usually verify that /etc/hosts, /etc/hostname and /etc/resolv.conf is set correctly.

Best regards, René.

Top Back

Jim Jackson [jj at franjam.org.uk]

Sun, 26 Jul 2009 22:05:22 +0100 (BST)

On Sun, 26 Jul 2009, J. Bakshi wrote:

    > I have become confused about the domain name handling in debian. I
    > have
    > a suse box too. It is very easy to set the domain name in suse box "
    > domainname <example.com> ". Similarly to set FQDN in suse " hostname
    > <hostname>.<example.com>"
    >
    > How to achieve this in debian ? No domainname command is there in
    > debian
    > (lenny). There are /etc/hosts and /etc/hostname but where can I save
    > domain name ? and where to save FQDN ? I am really confused here.
    > Please enlighten me. Thanks.

To add to René Pfeiffer answer, "domainname" often is used to set or query your NIS domain name - this is not your dns domain name.

As René says what determines your dns domain name is really what is configured in your name resolution setup - DNS is you have a DNS server, or more usually what is is your /etc/hosts file. The domain is anything after the host name. On my home network I have a DNS server, and a site /etc/hosts file, which is (update then) copied to any new machine I setup.

Make sure the first name is the fully qualified domain name of your host, followed by any aliases or short names e.g.

10.0.1.1 host.domain.local host

Top Back

Kapil Hari Paranjape [kapil at debian.org]

Mon, 27 Jul 2009 06:29:52 +0530

Hello,

On Sun, 26 Jul 2009, J. Bakshi wrote:

    > I have become confused about the domain name handling in debian. I
    > have a suse box too. It is very easy to set the domain name in suse
    > box " domainname <example.com> ". Similarly to set FQDN in suse "
    > hostname <hostname>.<example.com>"

You can certainly use the command

      hostname host.dom.a.in

to set the FQDN on most GNU/Linux systems.

However, this is better done by editing /etc/hostname so that the change is ensured each time at boot. In addition, you should make an appropriate entry in /etc/hosts so that your host can resolve its own name!

You will find the current values for this according to your kernel in /proc/sys/kernel/{hostname,domainname}.

As others have pointed out there are other contexts where the domain name is used such as NIS, DNS resolution, Mail domain etc. Each of these has its own configuration. If that configuration is empty it is set to the kernel's default.

Regards,

Kapil. --

Top Back

JOYDEEP [j.bakshi at unlimitedmail.org]

Mon, 27 Jul 2009 10:12:19 +0530

Kapil Hari Paranjape wrote:

    > Hello,
    >
    > On Sun, 26 Jul 2009, J. Bakshi wrote:
    >
    >> I have become confused about the domain name handling in debian. I
    >> have a suse box too. It is very easy to set the domain name in suse
    >> box " domainname <example.com> ". Similarly to set FQDN in suse "
    >> hostname <hostname>.<example.com>"
    >>
    >
    > You can certainly use the command
    >   hostname host.dom.a.in
    > to set the FQDN  on most GNU/Linux systems.
    >
    > However, this is better done by editing /etc/hostname so that the
    > change is ensured each time at boot. In addition, you should make an
    > appropriate entry in /etc/hosts so that your host can resolve its own
    > name!
    >
    > You will find the current values for this according to your kernel in
    > /proc/sys/kernel/{hostname,domainname}.
    >
    > As others have pointed out there are other contexts where the domain
    > name is used such as NIS, DNS resolution, Mail domain etc. Each of
    > these has its own configuration. If that configuration is empty it is
    > set to the kernel's default.
    >
    > Regards,
    >
    > Kapil.
    > --
    >
    >
    >

Thanks Kapil, Jim and René,

After reading your clarifications; I am in a better position now. I'll configure it accordingly using /etc/hostname and /etc/hosts

many many thanks.

Top Back