dig and nameserver - where from dig should get anwser?

Discussion in 'General' started by tom, Nov 8, 2006.

  1. tom

    tom Member

    I use dig to see which nameserver ist replying:
    dig server-1.de
    And I see NOT bind managed by ISP ist replying. But that the local bind should answer even if I try:
    dig gmx.de
    the answer should come from the local bind. Right? But is does'nt.

    resolf.conf has this entries:

    I should be able to remove the external nameserver:
    nameserver 1.2.2.4
    nameserver 1.2.2.1


    but if I do that dig does find any answer :-(
    What would be right to do? Do I have to add a new “pri. server-1.de” zone pointing to 1.2.3.4

    pri. server-1.de contains this:

    Even I get this error during bind is starting if I don't change the DefaultAddress 127.0.0.1 in /etc/proftpd_ispconfig.conf to
    I’m using xen: Dom0 ip 1.2.3.4 and domU with ispconig ip 10.0.1.1
     
    Last edited: Nov 8, 2006
  2. falko

    falko Super Moderator Howtoforge Staff

    If you want to ask your local DNS server, you must run
    Code:
    dig @localhost gmx.de
    What's the output of
    Code:
    netstat -tap
    ? What's in /etc/hosts? Which distribution do you use?
     
  3. tom

    tom Member

    Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 *:mysql                 *:*                     LISTEN     1186/mysqld
    tcp        0      0 *:81                    *:*                     LISTEN     1522/ispconfig_http
    tcp        0      0 *:ftp                   *:*                     LISTEN     2482/proftpd: (acce
    tcp        0      0 server-1.d:domain *:*                     LISTEN     1052/named
    tcp        0      0 localhost:domain        *:*                     LISTEN     1052/named
    tcp        0      0 *:smtp                  *:*                     LISTEN     2624/master
    tcp        0      0 localhost:953           *:*                     LISTEN     1052/named
    tcp6       0      0 *:imaps                 *:*                     LISTEN     1095/couriertcpd
    tcp6       0      0 *:pop3s                 *:*                     LISTEN     1116/couriertcpd
    tcp6       0      0 *:pop3                  *:*                     LISTEN     1103/couriertcpd
    tcp6       0      0 *:imap2                 *:*                     LISTEN     1077/couriertcpd
    tcp6       0      0 *:ssh                   *:*                     LISTEN     1407/sshd
    tcp6       0      0 *:smtp                  *:*                     LISTEN     2624/master
    tcp6       0      0 ip6-localhost:953       *:*                     LISTEN     1052/named
    tcp6       0     52 ::ffff:10.0.1.1:ssh     dslb-088-074-097-:25330 ESTABLISHED22396/14


    Code:
    x01:~# cat /etc/hosts
    127.0.0.1 localhost
    10.0.1.1 server-1.de server-1.de  x01
     
  4. falko

    falko Super Moderator Howtoforge Staff

    named is running. Does
    Code:
    dig @localhost gmx.de
    work?
     
  5. tom

    tom Member

    yes
    dig @localhost gmx.de
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Looks good. Do you still see errors in your log files?

    BTW, I've just seen this in your named.conf:

    Code:
    [B][COLOR="Red"]zone " server-1.de" {[/COLOR][/B]
    type master;
    [B][COLOR="Red"]file "pri. server-1.de ";[/COLOR][/B]
    };
    Should be

    Code:
    [B][COLOR="Red"]zone "server-1.de" {[/COLOR][/B]
    type master;
    [B][COLOR="Red"]file "pri.server-1.de";[/COLOR][/B]
    };
    instead.

    What's the output of
    Code:
    dig @localhost server-1.de
    ?
     
  7. tom

    tom Member

    yes

    Even again I've got an other problem which I already had before: I can't recieve mail at localhost.
    In local-host-names I find already "localhost.localdomain":
     
    Last edited: Nov 13, 2006
  8. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/main.cf (please strip out the comments)?

    The dig output looks ok (although you should check if you want the A record to point to a local IP address).
    What errors do you see in your logs?
     
  9. tom

    tom Member

    server01:/etc/postfix# grep ^[^#].* main.cf
    Code:
    smtpd_banner = $myhostname ESMTP
    biff = no
    append_dot_mydomain = no
    myhostname = server-1.de
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = mail.server-1.de, server-1.de, localhost.de, localhost
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_command =
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    home_mailbox = Maildir/
    virtual_maps = hash:/etc/postfix/virtusertable
    I don't see another way than pointig to the local address because that's the address that belongs to the the server (It's a domU on an dom0)

    Code:
    Nov 14 16:47:33 server-1 named[1052]: invalid command from 127.0.0.1#49873: bad auth
    Nov 14 16:47:35 server-1 named[27487]: starting BIND 9.2.4 -u bind -t /var/lib/named
    Nov 14 16:47:35 server-1 named[27487]: using 1 CPU
    Nov 14 16:47:35 server-1 named[27487]: loading configuration from '/etc/bind/named.conf'
    Nov 14 16:47:35 server-1 named[27487]: listening on IPv4 interface lo, 127.0.0.1#53
    Nov 14 16:47:35 server-1 named[27487]: binding TCP socket: address in use
    Nov 14 16:47:35 server-1 named[27487]: listening on IPv4 interface eth0, 10.0.1.1#53
    Nov 14 16:47:35 server-1 named[27487]: binding TCP socket: address in use
    
     
    Last edited: Nov 14, 2006
  10. falko

    falko Super Moderator Howtoforge Staff

    Please run
    Code:
    postconf -e 'mydestination = /etc/postfix/local-host-names'
    /etc/init.d/postfix restart
    So I guess it's behind a router? Then point the domain to the router's public IP address becasue otherwise nobody can access your machine/web sites if he's outside your network.

    Have a look here: http://www.howtoforge.com/forums/showthread.php?t=6863
     
  11. tom

    tom Member

    The "mail loops back to itself" problem is gone since I've taken the line "localhost.localdomain.server-1.de" from /etc/postfix/local-host-name.

    I don't even know how to emty the mailq which holds old mail like:

    Yes and no, but everybody can reach the webserver by directing the traffic with iptaples, nat and forwarding.

    My question an my concept was: If dig or a local client is asking for a domain should'nt bind anwser the questin by using its cache.
    For example sombody is using a hyperlink on a website which is located on this example server configured with ispconfig. Bind already know the anwser because its asked another dns server before.
    The resolving anwser from the local bind must be faster and even save some trafic than asking another dns server every time. That is the reason
    why I am wondering about the default answer from dig. dig is getting the another from outsite dns server but not from the local dns bind and I think that could be like that. Why not? Do you know what I mean?

    Ok, it's fine now. I've kill nearly 20 bind daemons.

    Thanks a lot.

    But still I don't understand why it is nessesary to kill the bind process than to stop it.

    I tried to stop bind whith:
    rndc stop

    and with
    /etc/init.d/bind9 stop

    but every time I get this notice:

    Stopping domain name service: namedrndc: connection to remote host closed
    This may indicate that the remote server is using an older version of
    the command protocol, this host is not authorized to connect,
    or the key is invalid.
    .
     
    Last edited: Nov 16, 2006
  12. falko

    falko Super Moderator Howtoforge Staff

    You can empty the mail queue like this (but this will delete all mails in the queue):
    Code:
    postsuper -d ALL
     
  13. tom

    tom Member

    ok, thanks.

    What's about my topic question btw. my last qustion? :)
     
  14. falko

    falko Super Moderator Howtoforge Staff

    Have a look here: http://forums.devshed.com/dns-36/rndc-connection-to-remote-host-closed-310861.html
     
  15. tom

    tom Member

    ok, thanks for the hint.

    My question an my concept was: If dig or a local client is asking for a domain should'nt bind anwser the questin by using its cache.
    For example sombody is using a hyperlink on a website which is located on this example server configured with ispconfig. Bind already know the anwser because its asked another dns server before.
    The resolving anwser from the local bind must be faster and even save some trafic than asking another dns server every time. That is the reason
    why I am wondering about the default answer from dig. dig is getting the another from outsite dns server but not from the local dns bind and I think that could be like that. Why not? Do you know what I mean?
     
  16. falko

    falko Super Moderator Howtoforge Staff

    The computer of your visitor will ask the DNS servers that he put into his network settings or that he got by DHCP.

    Your own server will always ask the DNS servers that are in /etc/resolv.conf. If you have a caching nameserver and want to save traffic, you can put
    Code:
    nameserver 127.0.0.1
    into /etc/resolv.conf (as the first record).
     
  17. tom

    tom Member

    Ok, I got that.

    As far as I know bind is a caching nameserver as defauld.

    Thanks a lot for your help and your patience falko
     
    Last edited: Nov 20, 2006
  18. tom

    tom Member

    Now I think I've found a solution for my question but this contains more questions.

    Bind9 as a caching nameserver is resolving dns questions as defauld configured by /etc/resolv.conf. If this local caching nameserver bind9 is'nt able to resolv a dns question by its zone files or by using its cache it will use forwarders.

    If configured it like that:
    Code:
    /etc/resolv.conf
    nameserver 10.0.1.1
    and /etc/bind/namd.conf
    Code:
    options {
            pid-file "/var/run/bind/run/named.pid";
            directory "/etc/bind";
            forwarders { 1.0.0.100;1.0.0.101; };
            forward only;
            auth-nxdomain no;
    But after rebooting I go two new problems:

    1.
    After rebooting the resolv.conf file was overwritten whith the old entries so it looks like that again:

    Which script is overwriting the file /etc/resolv.conf during the reboot ?
    2.
    The second problem ist the two named are started by defauld that I find this after a fresh reboot:
    I don't understand why two named are started during the reboot and I supposed the is one to much.

    This startscripts I've are there:
    but it don't seems to be more than usual.

    I suppose there are other startscrips to start bind in chroot but I not used to it..
     
  19. falko

    falko Super Moderator Howtoforge Staff

    Which distribution are you using?

    I wouldn't worry about this.
     
  20. tom

    tom Member

    Debian Sarge

    Problably I've found the solution. The dhcpd is rewriting the resonv.conf during its starts. I've commented out the line "SET_DNS='yes'"
    in /etc/dhcpc/config that is looks like that now :
    Code:
    #SET_DNS='yes'
    It seems to stop overwriting the resolv.conf during rebooting.

    Edit:
    It is not the final solution because I'm getting plenty mail containing errors like the following now:
    Code:
    	The Postfix program
    
    <[email protected]>: [localhost.localdomain]: Name or service
        not known
    mail.log
    Code:
    Nov 20 17:42:03 server-1 postfix/smtp[1962]: 32C411F5FF: to=<[email protected]>, relay=none, delay=0, status=bounced ([localhost.localdomain]: Name or service not known)

    /etc/postfix/locl-host-names contails:
    Code:
    ###################################
    localhost
    server01.de
    localhost.server01.de
    localhost.de
    localhost.localdomain
    [url]www.server-1.de[/url]
    #### MAKE MANUAL ENTRIES BELOW THIS LINE! ####
    I've changed /etc/dhcpc/config back to last contend by setting the chaged line again to
    Code:
    SET_DNS='yes'
    and did a reboot. The mail messing are gone...
    Why I got this bloody mail now? :confused:
    Sure? Why it starts two?
    It seems to me that the error message which arised during to stard bind is the result of the two named. If I kill both and start only one there is no errormessage during bind is starting.
     
    Last edited: Nov 20, 2006

Share This Page