Superfast caching DNS for my customers

Discussion in 'Server Operation' started by Hagforce, May 27, 2008.

  1. Hagforce

    Hagforce New Member

    Hello

    I want to provide a superfast DNS server for my customers.
    As it greatly improves the surfing experience.

    Is there any way of making my server (bind 9) keep all query's in cache (that fits in memory) at all time, and regularly check the cache if its up to date.

    Or any other tips to speed things up?
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. Hagforce

    Hagforce New Member

    Thank you.

    I have setup a bind 9.5 server on Fedora 9 now.
    It works, but it only seems to cache for a short while.

    I would like it to keep cache for a long time, and update the cache with certain interwalls (check that the cache is up to date but still keep it)

    I see in the tutorial that these parameters is put in named.conf

    Code:
    1       ; Serial
    8H      ; Refresh
    2H      ; Retry
    4W      ; Expire
    1D)     ; Minimum TTL
    
    But with these parameters i just get the error "unknown option" (on all).

    4W ; Expire Seems like this parameter tell bind to keep cache in 4 weeks
    8H ; Refresh Refresh cache every 8 hours (does this check that the cache is up to date but still keep it?)
    1D) ; Minimum TTL Minimum time to keep record 1day, why only one day?

    Any way to get bind to act the way I want?
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's in your named.conf?
     
  5. Hagforce

    Hagforce New Member

    named.conf:

    Code:
    //
    // named.caching-nameserver.conf
    //
    // Provided by Red Hat caching-nameserver package to configure the
    // ISC BIND named DNS server as a caching only nameserver
    // (as a localhost DNS resolver only).
    //
    // See /usr/share/doc/bind*/sample/ for example named configuration files.
    //
    // DO NOT EDIT THIS FILE - use system-config-bind or an editor
    // to create named.conf - edits to this file will be lost on
    // caching-nameserver package upgrade.
    //
    
    options {
            listen-on port 53 {
                    127.0.0.1;
                    };
            listen-on-v6 port 53 {
                    none;
                    };
            directory       "/var/named";
            dump-file       "/var/named/data/cache_dump.db";
            statistics-file "/var/named/data/named_stats.txt";
            memstatistics-file "/var/named/data/named_mem_stats.txt";
            recursion yes;
            allow-query {
                    };
            allow-recursion {
                    127.0.0.1;
                    xxx.xx.66.0/24;
                    xxx.xxx.118.0/24;
                    xxx.xxx.119.0/24;
                    xxx.xx.94.0/24;
                    xxx.xx.95.0/24;
                    xxx.xxx.96.0/24;
                    xxx.xx.97.0/24;
                    xx.xx.89.0/24;
                    xx.xxx.0.0/24;
                    xx.xxx.1.0/24;
                    xx.xxx.2.0/24;
                    xx.xxx.3.0/24;
                    xx.xxx.4.0/24;
                    };
            query-source address *;
            listen-on port 53 {
                    xx.xxx.36.242;
                    };
            version "";
            forward first;
            forwarders {
                    };
    
            cleaning-interval 1440;
            max-cache-ttl 2419200;
            max-ncache-ttl 86400;
    
            max-ncache-ttl 86400;
            max-cache-size unlimited;
            stacksize unlimited;
            datasize unlimited;
            coresize unlimited;
    
    };
    
    logging {
            channel default_debug {
                    file "data/named.run";
                    severity dynamic;
            };
    };
    
    zone "." IN {
            type hint;
            file "named.ca";
    };
    
    include "/etc/named.rfc1912.zones";
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Can you post /etc/named.rfc1912.zones and named.ca as well?
     
  7. Hagforce

    Hagforce New Member

    named.rfc1912.zones:

    Code:
    // named.rfc1912.zones:
    //
    // Provided by Red Hat caching-nameserver package 
    //
    // ISC BIND named zone configuration for zones recommended by
    // RFC 1912 section 4.1 : localhost TLDs and address zones
    // and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
    // (c)2007 R W Franks
    // 
    // See /usr/share/doc/bind*/sample/ for example named configuration files.
    //
    
    zone "localhost.localdomain" IN {
    	type master;
    	file "named.localhost";
    	allow-update { none; };
    };
    
    zone "localhost" IN {
    	type master;
    	file "named.localhost";
    	allow-update { none; };
    };
    
    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" IN {
    	type master;
    	file "named.loopback";
    	allow-update { none; };
    };
    
    zone "1.0.0.127.in-addr.arpa" IN {
    	type master;
    	file "named.loopback";
    	allow-update { none; };
    };
    

    named.ca:

    Code:
    ; <<>> DiG 9.5.0b2 <<>> @a.root-servers.net . ns
    ; (2 servers found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10573
    ;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 14
    ;; WARNING: recursion requested but not available
    
    ;; QUESTION SECTION:
    ;.				IN	NS
    
    ;; ANSWER SECTION:
    .			518400	IN	NS	C.ROOT-SERVERS.NET.
    .			518400	IN	NS	D.ROOT-SERVERS.NET.
    .			518400	IN	NS	E.ROOT-SERVERS.NET.
    .			518400	IN	NS	F.ROOT-SERVERS.NET.
    .			518400	IN	NS	G.ROOT-SERVERS.NET.
    .			518400	IN	NS	H.ROOT-SERVERS.NET.
    .			518400	IN	NS	I.ROOT-SERVERS.NET.
    .			518400	IN	NS	J.ROOT-SERVERS.NET.
    .			518400	IN	NS	K.ROOT-SERVERS.NET.
    .			518400	IN	NS	L.ROOT-SERVERS.NET.
    .			518400	IN	NS	M.ROOT-SERVERS.NET.
    .			518400	IN	NS	A.ROOT-SERVERS.NET.
    .			518400	IN	NS	B.ROOT-SERVERS.NET.
    
    ;; ADDITIONAL SECTION:
    A.ROOT-SERVERS.NET.	3600000	IN	A	198.41.0.4
    A.ROOT-SERVERS.NET.	3600000	IN	AAAA	2001:503:ba3e::2:30
    B.ROOT-SERVERS.NET.	3600000	IN	A	192.228.79.201
    C.ROOT-SERVERS.NET.	3600000	IN	A	192.33.4.12
    D.ROOT-SERVERS.NET.	3600000	IN	A	128.8.10.90
    E.ROOT-SERVERS.NET.	3600000	IN	A	192.203.230.10
    F.ROOT-SERVERS.NET.	3600000	IN	A	192.5.5.241
    F.ROOT-SERVERS.NET.	3600000	IN	AAAA	2001:500:2f::f
    G.ROOT-SERVERS.NET.	3600000	IN	A	192.112.36.4
    H.ROOT-SERVERS.NET.	3600000	IN	A	128.63.2.53
    H.ROOT-SERVERS.NET.	3600000	IN	AAAA	2001:500:1::803f:235
    I.ROOT-SERVERS.NET.	3600000	IN	A	192.36.148.17
    J.ROOT-SERVERS.NET.	3600000	IN	A	192.58.128.30
    J.ROOT-SERVERS.NET.	3600000	IN	AAAA	2001:503:c27::2:30
    
    ;; Query time: 126 msec
    ;; SERVER: 198.41.0.4#53(198.41.0.4)
    ;; WHEN: Fri May 30 12:29:02 2008
    ;; MSG SIZE  rcvd: 500
    
     
  8. falko

    falko Super Moderator Howtoforge Staff

    What's in named.localhost and named.loopback?
     
  9. Hagforce

    Hagforce New Member

    named.localhost

    Code:
    $TTL 1D
    @	IN SOA	@ rname.invalid. (
    					0	; serial
    					1D	; refresh
    					1H	; retry
    					1W	; expire
    					3H )	; minimum
    	NS	@
    	A	127.0.0.1
    	AAAA	::1
    

    named.loopback

    Code:
    $TTL 1D
    @	IN SOA	@ rname.invalid. (
    					0	; serial
    					1D	; refresh
    					1H	; retry
    					1W	; expire
    					3H )	; minimum
    	NS	@
    	PTR	localhost.
    
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Try to use seconds instead:

    Code:
    $TTL        86400
    @	IN SOA	@ rname.invalid. (
                            2008060301       ; serial, todays date + todays serial #
                            86400              ; refresh, seconds
                            3600              ; retry, seconds
                            604800              ; expire, seconds
                            10800 )            ; minimum, seconds
     
  11. Hagforce

    Hagforce New Member

    Thank you.

    I`ll try this.

    What is this value: $TTL 1D

    What is the difference between the settings in named.loopback and named.localhost?

    Why not set Minimum TTL to a couple of days, or a week?
    This would make the server faster, right?
    The refresh interval would make the records valid anyway?

    He he, many noob questions, sorry :)
     
    Last edited: Jun 3, 2008
  12. falko

    falko Super Moderator Howtoforge Staff

Share This Page