Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

First of all sorry for bad English.

I'm a newcomer to FreeBSD, and I'm going to like it. Before I tried FreeBSD, I had a Linux VPS (My ISP set it up for me). I decide to drop it in favor of FreeBSD and installed FreeBSD from scratch on VMWare ESXi 4.0 (My ISP just offers Linux VPS, but they agreed to let me set it up myself).

The problem is I know nothing about setting up DNS and Nameserver. (I'm just a web developer, my knowledge in network-related stuff is zero or less)

I followed this guide to setup bind nameserver:

The Server Spec:

My settings in Directi domain panel:


::1                     localhost               localhost    3rr0r   



I edit /etc/rc.conf:



zone "" {
    type master;
    file "master/";

zone "" {
        type slave;
        file "slave/";
        masters {


$TTL 3600        ; 1 hour default TTL    IN      SOA (
                                2010012208      ; Serial
                                10800           ; Refresh
                                3600            ; Retry
                                604800          ; Expire
                                300             ; Negative Reponse TTL

; DNS Servers
                IN      NS
                IN      NS
                IN      NS
                IN      NS

; MX Records
                IN      MX 10
                IN      MX 20

                IN      A

; Machine Names
localhost       IN      A
ns1             IN      A
ns2             IN      A
ns3             IN      A
ns4             IN      A
mx              IN      A
mail            IN      A

; Aliases
www             IN      CNAME


$TTL 3600 IN SOA (
                        2010012208      ; Serial
                        10800           ; Refresh
                        3600            ; Retry
                        604800          ; Expire
                        300 )           ; Negative Reponse TTL

        IN      NS
        IN      NS
        IN      NS
        IN      NS

1       IN      PTR
2       IN      PTR
3       IN      PTR
4       IN      PTR
5       IN      PTR
6       IN      PTR
7       IN      PTR

# named-checkzone /etc/namedb/master/
zone loaded serial 2010012208

# /etc/rc.d/named reload
// or
# rndc reload

When I tried this from the VPS itself:

# host -t ns name server name server name server name server

# dig ns "" "@localhost"

; <<>> DiG 9.6.1-P1 <<>> ns @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63012
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 4

;   IN NS

;; ANSWER SECTION:  3600 IN NS  3600 IN NS  3600 IN NS  3600 IN NS

;; ADDITIONAL SECTION:  3600 IN A  3600 IN A  3600 IN A  3600 IN A

;; Query time: 0 msec
;; WHEN: Sun Jan 24 01:28:49 2010
;; MSG SIZE  rcvd: 164

I tried this for 7 days, and still I can't browse my website:

  Tried to fetch SOA record for domain, but DNS server [] returned error code Refused 
  Error fetching SOA from []: Connection reset. Probably DNS server is offline. 
  Tried to fetch SOA record for domain, but DNS server [] returned error code Refused 
  Tried to fetch SOA record for domain, but DNS server [] returned error code Refused

It's an rock-solid OS and I didn't want to ignore it just because I can't setup DNS in bind or my ISP doesn't support FreeBSD.

And if related this is my /usr/local/etc/lighttpd.conf

$HTTP["host"] =~ "(^|\.)babaei\.net$" {
server.document-root = "...../www"
server.errorlog = "...../_error.log"
accesslog.filename = "...../_access.log"
server.error-handler-404 = "/_404.html"

I also posted similar question here:

Thanks in Advance.



Finally it works:

I just changed everything to VPS IP itself:

ns1             IN      A
ns2             IN      A
ns3             IN      A
ns4             IN      A

(This happens in domain panel also).

I also needed to change this line in


//     listen-on       {; };
// Changed to:
        listen-on       {; };

or simply it's not working.

I added



or I'll get:

error connecting to mail server port 25 : connection refused.

I'm still waiting till DNS databases across the NET is updating.

That's a shame!! They told me these IP's are authoritative for my domain, But it's not. I think these are my ISP's DNS Server, since I can browse them by a browser. I really don't know how they can handle this, But I'm happy for now.

share|improve this question
What's your question? – John Gardeniers Jan 24 '10 at 4:22
I think it's obvious!! it's not working. My domain does not point to my vps. – user32699 Jan 25 '10 at 9:52

2 Answers 2

Assuming that your question is "how can I get this to work", I think you're missing something fundamental here.

The NS records point (indirectly) to IP addresses of DNS servers which hold the DNS records of that domain. In your case these are [ns1, ns2, ns3, ns4]. So any client which looks up your domain name is expecting to find answers at one of these addresses, however they don't have the answer because you've set up the DNS records for your domain on your own VPS.

This means you need to do one of two things: You either need to have those 4 servers holding your DNS records, or you need to change the NS records to point to your VPS.

Assuming that those nameservers have been provided by your VPS provider, you usually get provided with a web frontend so you can add and modify records. In this case, you don't need to have BIND running on your VPS at all.

If you want your server's BIND to be the DNS server for your domain then the NS record for the domain must point to your VPS's IP address. Note that you're usually required to have at least two (different) NS records for the domain, so you may require two IP addresses for your VPS.

share|improve this answer
Well that's exactly what's confused me!! Yes I have an VPS with different IP than nameservers. and my VPS isn't one of them. (And as I said I know nothing about dns and nameserver). The funny thing is when you enter these IP's in the browser, it seems these IPs are in used somewhere else: I'm sorry Your answer is not seems clear to me. As I understood: 1. I must setup DNS server, and NS server 2. I must be slave zone of My ISP's DNS Server (They must be master zone) I'll be appreciated if you can correct me. – user32699 Jan 25 '10 at 10:14
The explanation by hmallett is the right one. None of the four listed name servers is authoritative for I assume that you simply forgot to configure them. Who manages these four boxes. He or she has to do something, it won't appear automagically. – bortzmeyer Jan 26 '10 at 14:25
tnx for the answer. My ISP manages these IPs and they said these IP's are free and I can use them. I already paid them for these IPs. Excuse me but how can you check these IPs that they are authoritative or not? – user32699 Jan 26 '10 at 14:54
I've clarified my answer in light of the comments. – hmallett Jan 26 '10 at 21:09
Thanks for editing the answer and clarification. Yes, these IPs are provided by my VPS provider. But as I said I installed VPS from scratch myself(they know nothing about *BSD)and there is no web frontend. But after reading you're great answer I decide to install webmin(for them)and I asked for help from my VPS provider, now they're working on it. I'll post the results here. I also double checked my friend's CentOSVPS who has a OpenVZVPS from this provider also, and there is no BIND on his VPS. This makes me believe I need not bind at all as you suggested. Thank you again for your suggestions. – user32699 Jan 27 '10 at 16:29

what address do you want to point to? you can just add: IN A x.x.x.x
to /etc/namedb/master/ Where x.x.x.x is the IP you want it to point to.


                IN      A
www             IN      CNAME
from /etc/namedb/master/ and restart named and see if that makes a difference.

You can also check your named.conf file with:

named-checkconf /etc/namedb/named.conf
and your zone file with:
named-checkzone /etc/namedb/master/

share|improve this answer
Thanks for the answer. I did exactly what you said, but still nothing happening. – user32699 Jan 25 '10 at 9:53
Wrong explanation (the A record is already there, the problem is a problem of delegation, not data). – bortzmeyer Jan 26 '10 at 14:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.