Results 1 to 4 of 4

Thread: BIND/named server resolves “hostname.domain” but not “hostname”

  1. #1

    Default BIND/named server resolves “hostname.domain” but not “hostname”

    Hi folks,

    Let's see if someone out there can help me find what's wrong with my BIND configuration.

    Let's say I have a BIND server and a client in one domain. On the server:

    Code:
    myserver:/ # host myserver
    Host myserver not found: 3(NXDOMAIN)
    
    myserver:/ # host myserver.mydomain
    myserver.mydomain has address 10.67.2.20
    myserver.mydomain has IPv6 address fd40:33c6:550d:6::20
    
    myserver:/ # host client1
    Host client1 not found: 3(NXDOMAIN)
    
    myserver:/ # host client1.mydomain
    client1.mydomain has address 10.67.2.12
    client1.mydomain has IPv6 address fd40:33c6:550d:6::12
    
    myserver:/ # cat /etc/hostname
    myserver.mydomain
    As you can see, it is happily resolving “hostname.mydomain”, but it will not resolve simply “hostname”. I need it to do that. That is, it would be extremely helpful to a shoddily written application beyond my control if I could get BIND to do this.

    According to /etc/hostname the server does know what domain it's in. Is there a setting anywhere to make BIND add the server's own domain name by default when a hostname without domain is queried?

    My /etc/named.conf:
    Code:
    options {
      directory "/var/lib/named";
      managed-keys-directory "/var/lib/named/dyn/";
      dump-file "/var/log/named_dump.db";
      statistics-file "/var/log/named.stats";
      listen-on-v6 { any; };
      notify no;
      disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
    };
    
    zone "." in {
      type hint;
      file "root.hint";
    };
    
    zone "localhost" in {
      type master;
      file "localhost.zone";
    };
    
    zone "0.0.127.in-addr.arpa" in {
      type master;
      file "127.0.0.zone";
    };
    
    zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {
      type master;
      file "127.0.0.zone";
    };
    
    logging {
      channel log_file { file "/var/log/named.log" size 200M; };
      category queries { log_file; };
      category xfer-in { log_file; };
      category xfer-out { log_file; };
      category default { log_file; };
    };
    
    zone "mydomain" in {
      file "master/mydomain.zone";
      type master;
    };
    
    zone "10.in-addr.arpa" in {
      file "master/10.in-addr.arpa.zone";
      type master;
    };
    
    zone "d.0.5.5.6.c.3.3.0.4.d.f.ip6.arpa" in {
      file "master/d.0.5.5.6.c.3.3.0.4.d.f.ip6.arpa.zone";
      type master;
    };
    The zone file for mydomain:
    Code:
    $ORIGIN mydomain.                                                            ; domain name to append to unqualified records
    $TTL 2D                                                                      ; default time-to-live
    
    @                 IN SOA    myserver.mydomain.  root.myserver.mydomain.  (   ; primary nameserver, hostmaster-email
                                2015070603                                       ; serial number
                                3H                                               ; time to refresh
                                1H                                               ; time to retry
                                1W                                               ; time to expire
                                1D  )                                            ; minimum TTL (time to live)
    
    @                 IN NS     myserver.mydomain.     ; these must be fully qualified and must not point to CNAME records!
    
    myserver          IN A      10.67.2.20
    myserver          IN AAAA   fd40:33c6:550d:6::20
    client1           IN A      10.67.2.12
    client1           IN AAAA   fd40:33c6:550d:6::12
    Any advice?

    Cheers,
    K.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,861

    Default Re: BIND/named server resolves “hostname.domain” but not “hostname”

    IMHO you are looking at the wrong place. You should look how the client is configured. That is done in it's /etc/resolv.conf.
    When you want the client to look up a mere hostsname myhost, an entry
    Code:
    search mydomain
    should direct the client to try for myhost.mydomain first.
    Henk van Velden

  3. #3

    Default Re: BIND/named server resolves “hostname.domain” but not “hostname”

    Yessss... that did the trick, thank you!

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,925
    Blog Entries
    2

    Default Re: BIND/named server resolves “hostname.domain” but not “hostname”

    From any Host,
    You should be able to return only your hostname with the following command
    Code:
    hostname
    You should also be able to return your Fully Qualified Domain Name with the following command
    Code:
    hostname -f
    This seems to work fully in LEAP 42.1, but for whatever reason does not work in 13.2 and likely won't be fixed(probably the simplest fix likely would be to just replace the 13.2 binary with the LEAP binary)
    I reported this awhile back in this bug
    https://bugzilla.opensuse.org/show_bug.cgi?id=952517

    I discovered this awhile back trying to execute a distro-agnostic script on 13.2, so I needed to fix by altering the unsupported "hostnbame -f" command (If you need something like this, post).

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •