# Error in DNS configuration.



## serjaomendes (Dec 14, 2009)

Hi, I Need help to configure my DNS Server, 

I have a domain, and need redirect to my server, and configure DNS Master. (sorry for my english)

Domain: atec.org.br
IP: 189.16.21.140

part of named.conf:

```
// RFC 1912  zone "atec.org.br" { 	
type master; 	
file "atec.org.br"; };  

zone "localhost"	{ type master; file "master/localhost-forward.db"; }; 
zone "127.in-addr.arpa" { type master; file "master/localhost-reverse.db"; }; 
zone "255.in-addr.arpa"	{ type master; file "master/empty.db"; };
```

zone file: atec.org.br


```
$TTL 86400
@ IN
SOA ns.atec.org.br. hostmaster.ns.atec.org.br. (
2003262236
1H
15
14D
12H )

atec.org.br.	IN NS ns.atec.org.br.
atec.org.br.	IN A 189.16.21.140
atec.org.br.	IN A 189.16.21.140

www.atec.org.br.	IN CNAME atec.org.br.
```


```
PING ns.atec.org.br (189.16.21.140): 56 data bytes
64 bytes from 189.16.21.140: icmp_seq=0 ttl=64 time=0.224 ms
64 bytes from 189.16.21.140: icmp_seq=1 ttl=64 time=0.126 ms
64 bytes from 189.16.21.140: icmp_seq=2 ttl=64 time=0.129 ms
64 bytes from 189.16.21.140: icmp_seq=3 ttl=64 time=0.128 ms
64 bytes from 189.16.21.140: icmp_seq=4 ttl=64 time=0.133 ms
^C
```


----------



## J65nko (Dec 14, 2009)

```
$TTL 86400
@ IN
SOA ns.atec.org.br. hostmaster.ns.atec.org.br. (
2003262236
1H
15
14D
12H )

[color=blue]atec.org.br.	IN NS ns.atec.org.br.[/color]
atec.org.br.	IN A 189.16.21.140


[color=blue]ns.atec.org.br.         IN A 189.16.21.140[/color]
www.atec.org.br.	IN A 189.16.21.140
```
You forgot to enter the A record for *ns.atec.org.br.* 

BTW There is no obligation to use CNAME, just use an A record, this saves an extra name lookup.
Don't forget to update the serial nr


----------



## DutchDaemon (Dec 14, 2009)

.. and reload the zone ...


----------



## serjaomendes (Dec 14, 2009)

Thank's a lot!

Ok, I has modified...

Actually the domain atec.org.br is redirected to 200.234.203.76 in a DNS Brazil Server.

How to Test the DNS is ok to response for web domain?


----------



## J65nko (Dec 14, 2009)

See http://www.daemonforums.org/showthread.php?t=4048 for a recent similar discussion.


----------



## DutchDaemon (Dec 14, 2009)

You can also run some tests using the dns/dnscheck port.


----------



## J65nko (Dec 14, 2009)

@DutchDeamon 

Instead of installing another port you simply can use http://www.squish.net/dnscheck/


----------



## DutchDaemon (Dec 14, 2009)

@J56nko

I rely on my own networks


----------



## serjaomendes (Dec 14, 2009)

Ok, thanks again.

Whois atec.org.br continue response by other server.

I forget configure a reverse, :S a Moment please.


----------



## serjaomendes (Dec 14, 2009)

```
zone "21.16.189.in-addr.arpa" {
        type master;
        file "21.16.189.in-addr.arpa";
}
```


```
$TTL 3600

21.16.189.in-addr.arpa. IN      SOA     ns.atec.org.br  hostmaster.atec.org.br (
        20091412;
        10800;
        3600;
        604800;
        300);

        IN      NS      ns.atec.org.br.

1       IN      PTR     atec.org.br.
2       IN      PTR     ns.atec.org.br.
3       IN      PTR     www.atec.org.br.
```


```
FW_Lenke# nslookup
> 189.16.21.140
Server:         200.176.2.10
Address:        200.176.2.10#53

** server can't find 140.21.16.189.in-addr.arpa.: NXDOMAIN
>


FW_Lenke# nslookup
> ns.atec.org.br
Server:         200.176.2.10
Address:        200.176.2.10#53

** server can't find ns.atec.org.br: NXDOMAIN
>
```


----------



## DutchDaemon (Dec 14, 2009)

Doing an external lookup on a zonefile that only _you_ have won't give a lot of results. I'm guessing that DNS delegation for that in-addr.arpa zone isn't pointing to your namserver, so no one will ever query it. Try looking it up on your own nameserver (`$ dig @your_ip -x 189.16.21.140`). FYI, rDNS for your IP range is handled by embratel.net.br.


----------



## serjaomendes (Dec 14, 2009)

```
FW_Lenke# dig 189.16.21.140 -x 189.16.21.140

; <<>> DiG 9.4.2 <<>> 189.16.21.140 -x 189.16.21.140
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 51428
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;189.16.21.140.                 IN      A

;; AUTHORITY SECTION:
.                       10800   IN      SOA     A.ROOT-SERVERS.NET. NSTLD.VERISIGN-GRS.COM. 2009121400 1800 900 604800 86400

;; Query time: 74 msec
;; SERVER: 200.176.2.10#53(200.176.2.10)
;; WHEN: Mon Dec 14 12:59:44 2009
;; MSG SIZE  rcvd: 106

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 33964
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;140.21.16.189.in-addr.arpa.    IN      PTR

;; ANSWER SECTION:
140.21.16.189.in-addr.arpa. 73681 IN    CNAME   140.128-191.21.16.189.in-addr.arpa.

;; AUTHORITY SECTION:
128-191.21.16.189.in-addr.arpa. 10800 IN SOA    ns.embratel.net.br. admin.embratel.net.br. 2008100901 3600 900 604800 86400

;; Query time: 72 msec
;; SERVER: 200.176.2.10#53(200.176.2.10)
;; WHEN: Mon Dec 14 12:59:44 2009
;; MSG SIZE  rcvd: 130

FW_Lenke#
```


----------



## DutchDaemon (Dec 14, 2009)

It's [cmd=]dig *@*189.16.21.140 -x 189.16.21.140[/cmd]


----------



## serjaomendes (Dec 14, 2009)

```
FW_Lenke# dig @189.16.21.140 -x 189.16.21.140

; <<>> DiG 9.4.2 <<>> @189.16.21.140 -x 189.16.21.140
; (1 server found)
;; global options:  printcmd
;; connection timed out; no servers could be reached
FW_Lenke#
```


----------



## J65nko (Dec 14, 2009)

Here the same, but I can ping.
	
	



```
$ dig -x 189.16.21.140 @189.16.21.140

; <<>> DiG 9.3.4 <<>> -x 189.16.21.140 @189.16.21.140
; (1 server found)
;; global options:  printcmd
;; connection timed out; no servers could be reached

$ ping -c2 189.16.21.140
PING 189.16.21.140 (189.16.21.140): 56 data bytes
64 bytes from 189.16.21.140: icmp_seq=0 ttl=45 time=267.380 ms
64 bytes from 189.16.21.140: icmp_seq=1 ttl=45 time=257.115 ms
--- 189.16.21.140 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 257.115/262.247/267.380/5.157 ms
```

Does *netstat -an -f inet* show that 189.16.21.140 is LISTENing on port 53 for TCP and UDP?


----------



## serjaomendes (Dec 14, 2009)

```
FW_Lenke# netstat -an -f inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0      0  189.16.21.140.22       189.16.21.130.61901    ESTABLISHED
tcp4       0      0  *.22                   *.*                    LISTEN
tcp4       0      0  *.*                    *.*                    CLOSED
tcp46      0      0  *.80                   *.*                    LISTEN
tcp4       0      0  *.3306                 *.*                    LISTEN
tcp4       0      0  *.3000                 *.*                    LISTEN
tcp4       0      0  *.199                  *.*                    LISTEN
tcp4       0      0  *.21                   *.*                    LISTEN
udp4       0      0  189.16.21.140.49755    200.176.2.10.53
udp4       0      0  *.3000                 *.*
udp4       0      0  *.161                  *.*
udp4       0      0  *.514                  *.*
udp4       0      0  *.520                  *.*
icm4       0      0  *.*                    *.*
FW_Lenke#
```

I Has started named


----------



## serjaomendes (Dec 14, 2009)

```
FW_Lenke# /etc/rc.d/named onestart
wrote key file "/var/named/etc/namedb/rndc.key"
Starting named.
FW_Lenke# netstat -an -f inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0     52  189.16.21.140.22       189.16.21.130.61901    ESTABLISHED
tcp4       0      0  *.22                   *.*                    LISTEN
tcp4       0      0  *.*                    *.*                    CLOSED
tcp46      0      0  *.80                   *.*                    LISTEN
tcp4       0      0  *.3306                 *.*                    LISTEN
tcp4       0      0  *.3000                 *.*                    LISTEN
tcp4       0      0  *.199                  *.*                    LISTEN
tcp4       0      0  *.21                   *.*                    LISTEN
udp4       0      0  *.3000                 *.*
udp4       0      0  *.161                  *.*
udp4       0      0  *.514                  *.*
udp4       0      0  *.520                  *.*
icm4       0      0  *.*                    *.*
FW_Lenke#
```


----------



## DutchDaemon (Dec 14, 2009)

Well, it's not running .. as [cmd=]rndc status[/cmd] will probably tell you. See /var/log/messages for a reason. Named is picky about errors in named.conf and/or zonefiles, but rarely prints a helpful error to standard output.


----------



## serjaomendes (Dec 14, 2009)

Sorry for my ignorance.

Now I HAve started, is simples this :


```
FW_Lenke# /etc/rc.d/named onestart
wrote key file "/var/named/etc/namedb/rndc.key"
Starting named.
```
Or more services ?


----------



## DutchDaemon (Dec 14, 2009)

Starting != Running. What is the output of [cmd=]rndc status[/cmd], and what's in /var/log/messages about named?


----------



## serjaomendes (Dec 14, 2009)

Ok, an error in file named.conf was fixed...now:


```
FW_Lenke# netstat -an -f inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0      0  127.0.0.1.953          *.*                    LISTEN
tcp4       0      0  127.0.0.1.53           *.*                    LISTEN
tcp4       0      0  189.16.21.140.22       189.16.21.130.61901    ESTABLISHED
tcp4       0      0  *.22                   *.*                    LISTEN
tcp4       0      0  *.*                    *.*                    CLOSED
tcp46      0      0  *.80                   *.*                    LISTEN
tcp4       0      0  *.3306                 *.*                    LISTEN
tcp4       0      0  *.3000                 *.*                    LISTEN
tcp4       0      0  *.199                  *.*                    LISTEN
tcp4       0      0  *.21                   *.*                    LISTEN
udp4       0      0  189.16.21.140.49275    200.176.2.10.53
udp4       0      0  189.16.21.140.52385    201.10.1.2.53
udp4       0      0  *.63692                *.*
udp4       0      0  127.0.0.1.53           *.*
udp4       0      0  *.3000                 *.*
udp4       0      0  *.161                  *.*
udp4       0      0  *.514                  *.*
udp4       0      0  *.520                  *.*
icm4       0      0  *.*                    *.*
FW_Lenke#
```

Log.....


```
Dec 14 14:03:58 FW_Lenke named[7695]: starting BIND 9.4.2 -t /var/named -u bind
Dec 14 14:03:58 FW_Lenke named[7695]: command channel listening on 127.0.0.1#953
Dec 14 14:03:58 FW_Lenke named[7695]: command channel listening on ::1#953
Dec 14 14:03:59 FW_Lenke named[7695]: dns_master_load: atec.org.br:3: unexpected end of line
Dec 14 14:03:59 FW_Lenke named[7695]: dns_master_load: atec.org.br:2: unexpected end of input
Dec 14 14:03:59 FW_Lenke named[7695]: zone atec.org.br/IN: loading from master file atec.org.br failed:
Dec 14 14:03:59 FW_Lenke named[7695]: running
```


----------



## DutchDaemon (Dec 14, 2009)

Ok, BIND is only running on localhost (not on the public IP address). If that's not what you want, you'll have to instruct named.conf(5) to bind to/listen on your public IP address as well. 

Anyway, to return to the previous command, this is now (in this case):
[cmd=]dig @127.0.0.1 -x 189.16.21.140[/cmd].

Again: having a PTR (rDNS) record for this IP range is fine, but only _you_ will use it, no one else. All PTR queries will be handled by Embratel's nameservers unless they delegate this range to your nameserver.


----------



## serjaomendes (Dec 14, 2009)

```
Dec 14 14:18:26 FW_Lenke named[8042]: starting BIND 9.4.2 -t /var/named -u bind
Dec 14 14:18:27 FW_Lenke named[8042]: command channel listening on 127.0.0.1#953
Dec 14 14:18:27 FW_Lenke named[8042]: command channel listening on ::1#953
Dec 14 14:18:27 FW_Lenke named[8042]: dns_master_load: atec.org.br:3: unexpected end of line
Dec 14 14:18:27 FW_Lenke named[8042]: dns_master_load: atec.org.br:2: unexpected end of input
Dec 14 14:18:27 FW_Lenke named[8042]: zone atec.org.br/IN: loading from master file atec.org.br failed:
Dec 14 14:18:27 FW_Lenke named[8042]: running
```


```
$TTL 86400
@ IN
SOA ns.atec.org.br. hostmaster.ns.atec.org.br. (
20091412;
1H;
15;
14D;
12H; )

atec.org.br.    IN NS ns.atec.org.br.
atec.org.br.    IN A 189.16.21.140

ns.atec.org.br.         IN A 189.16.21.140
www.atec.org.br.        IN A 189.16.21.140
```


```
FW_Lenke# dig @127.0.0.1 -x 189.16.21.140

; <<>> DiG 9.4.2 <<>> @127.0.0.1 -x 189.16.21.140
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52217
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;140.21.16.189.in-addr.arpa.    IN      PTR

;; AUTHORITY SECTION:
21.16.189.in-addr.arpa. 300     IN      SOA     ns.atec.org.br.21.16.189.in-addr.arpa. hostmaster.atec.org.br.21.16.189.in-addr.arpa. 20091412 10800 3600 604800 300

;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 14 14:19:33 2009
;; MSG SIZE  rcvd: 106

FW_Lenke#
```

a question, my PC name FW_Lenke# How to change to NS.atec.org.br ?


----------



## DutchDaemon (Dec 14, 2009)

Set your hostname in /etc/rc.conf.


----------



## DutchDaemon (Dec 14, 2009)

btw,


```
@ IN
SOA ns.atec.org.br. hostmaster.ns.atec.org.br. (
```

must be


```
@ IN SOA ns.atec.org.br. hostmaster.ns.atec.org.br. (
```


----------



## serjaomendes (Dec 14, 2009)

DutchDaemon said:
			
		

> Set your hostname in /etc/rc.conf.



I Has changed, and now, restart some service ?


----------



## serjaomendes (Dec 14, 2009)

```
Dec 14 14:35:44 FW_Lenke named[8333]: starting BIND 9.4.2 -t /var/named -u bind
Dec 14 14:35:45 FW_Lenke named[8333]: command channel listening on 127.0.0.1#953
Dec 14 14:35:45 FW_Lenke named[8333]: command channel listening on ::1#953
Dec 14 14:35:45 FW_Lenke named[8333]: running
```


```
FW_Lenke# netstat -an -f inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0      0  127.0.0.1.953          *.*                    LISTEN
tcp4       0      0  127.0.0.1.53           *.*                    LISTEN
tcp4       0      0  189.16.21.140.53       *.*                    LISTEN
tcp4       0     52  189.16.21.140.22       189.16.21.130.61901    ESTABLISHED
```


----------



## DutchDaemon (Dec 14, 2009)

serjaomendes said:
			
		

> I Has changed, and now, restart some service ?



You can run it from the shell as well (for now):

`# hostname ns.atec.org.br`

Restart your shell afterwards.


----------



## serjaomendes (Dec 14, 2009)

Thank's a lot.

For all, thank's so much.
Now, i believe the DNS is OK!


```
[189.16.21.140] returned an authoritative response in 297 ms:

Header
rcode:	Success
id:	0	opcode:	Standard query
is a response:	True	authoritative:	True
recursion desired:	True	recursion avail:	False
truncated:	False
questions:	1	answers:	3
authority recs:	0	additional recs:	1
Questions
name	class	type
atec.org.br	IN	ANY
Answer records
name	class	type	data	time to live
atec.org.br	IN	SOA	
server:	ns.atec.org.br
email:	hostmaster@ns.atec.org.br
serial:	20091412
refresh:	3600
retry:	15
expire:	1209600
minimum ttl:	43200
	86400s	(1d)
atec.org.br	IN	NS	ns.atec.org.br	86400s	(1d)
atec.org.br	IN	A	189.16.21.140	86400s	(1d)
Authority records
[none]
Additional records
name	class	type	data	time to live
ns.atec.org.br	IN	A	189.16.21.140	86400s	(1d)
```


----------



## J65nko (Dec 14, 2009)

```
$ dig +norecurse www.atec.org.br. @189.16.21.140   

; <<>> DiG 9.3.4 <<>> +norecurse www.atec.org.br. @189.16.21.140
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62255
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;www.atec.org.br.               IN      A

;; ANSWER SECTION:
www.atec.org.br.        86400   IN      A       189.16.21.140

;; AUTHORITY SECTION:
atec.org.br.            86400   IN      NS      ns.atec.org.br.

;; ADDITIONAL SECTION:
ns.atec.org.br.         86400   IN      A       189.16.21.140

;; Query time: 258 msec
;; SERVER: 189.16.21.140#53(189.16.21.140)
;; WHEN: Mon Dec 14 20:21:01 2009
;; MSG SIZE  rcvd: 82
```
This part seems to work from the Netherlands too


----------



## serjaomendes (Dec 14, 2009)

Amsterdan rulez!


----------



## DutchDaemon (Dec 14, 2009)

No it doesn't.


----------

