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: http://www.freebsd.org/doc/handbook/network-dns.html

The Server Spec:

My settings in Directi domain panel:



::1                     localhost localhost.babaei.net               localhost localhost.babaei.net             3rr0r.babaei.net 3rr0r             3rr0r.babaei.net.


domain  babaei.net
search babaei.net

I edit /etc/rc.conf:



zone "babaei.net" {
    type master;
    file "master/babaei.net";

zone "1.168.192.in-addr.arpa" {
        type slave;
        file "slave/1.168.192.in-addr.arpa";
        masters {


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

; DNS Servers
                IN      NS      ns1.babaei.net.
                IN      NS      ns2.babaei.net.
                IN      NS      ns3.babaei.net.
                IN      NS      ns4.babaei.net.

; MX Records
                IN      MX 10   mx.babaei.net.
                IN      MX 20   mail.babaei.net.

                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   babaei.net.


$TTL 3600

1.168.192.in-addr.arpa. IN SOA ns1.babaei.net. root.babaei.net. (
                        2010012208      ; Serial
                        10800           ; Refresh
                        3600            ; Retry
                        604800          ; Expire
                        300 )           ; Negative Reponse TTL

        IN      NS      ns1.babaei.net.
        IN      NS      ns2.babaei.net.
        IN      NS      ns3.babaei.net.
        IN      NS      ns4.babaei.net.

1       IN      PTR     babaei.net.
2       IN      PTR     ns1.babaei.net.
3       IN      PTR     ns2.babaei.net.
4       IN      PTR     ns3.babaei.net.
5       IN      PTR     ns4.babaei.net.
6       IN      PTR     mx.babaei.net.
7       IN      PTR     mail.babaei.net.

# named-checkzone babaei.net /etc/namedb/master/babaei.net
zone babaei.net/IN: loaded serial 2010012208

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

When I tried this from the VPS itself:

# host -t ns babaei.net
babaei.net name server ns4.babaei.net.
babaei.net name server ns2.babaei.net.
babaei.net name server ns3.babaei.net.
babaei.net name server ns1.babaei.net.

# dig ns "babaei.net" "@localhost"

; <<>> DiG 9.6.1-P1 <<>> ns babaei.net @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

;babaei.net.   IN NS

babaei.net.  3600 IN NS ns2.babaei.net.
babaei.net.  3600 IN NS ns1.babaei.net.
babaei.net.  3600 IN NS ns3.babaei.net.
babaei.net.  3600 IN NS ns4.babaei.net.

ns1.babaei.net.  3600 IN A
ns2.babaei.net.  3600 IN A
ns3.babaei.net.  3600 IN A
ns4.babaei.net.  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 ns1.babaei.net [] returned error code Refused 
  Error fetching SOA from ns2.babaei.net []: Connection reset. Probably DNS server is offline. 
  Tried to fetch SOA record for domain, but DNS server ns3.babaei.net [] returned error code Refused 
  Tried to fetch SOA record for domain, but DNS server ns4.babaei.net [] 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.

  • What's your question? 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

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.

  • 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 babaei.net 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 babei.net to point to? you can just add:

babei.net. IN A x.x.x.x
to /etc/namedb/master/babaei.net Where x.x.x.x is the IP you want it to point to.


                IN      A
www             IN      CNAME   babaei.net.
from /etc/namedb/master/babaei.net 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 babaei.net /etc/namedb/master/babaei.net

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy