I have a server with the public ip-address (lets say) 198.20.30.40
I am trying to setup a DNS server on this host so that I can resolve all request to "stackoverflow.com" being made to get resolved as the "198.20.30.40" instead of the actual stackoverflow. Of-course I have set the Primary-DNS server in the client requesting stackoverflow as 198.20.30.40. There are other open-dns server (8.8.8.8) set as secondary DNS.
After following the tutorial, I am unable to get it to work.
This is what I am getting when I do a "dig". It looks like it is working
$ dig stackoverflow.com
; <<>> DiG 9.8.3-P1 <<>> stackoverflow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43984
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;stackoverflow.com. IN A
;; AUTHORITY SECTION:
stackoverflow.com. 86400 IN SOA ns.stackoverflow.com. hostmaster.linux.bogus. 990 28800 7200 2419200 86400
;; Query time: 152 msec
;; SERVER: 198.20.30.40#53(198.20.30.40)
;; WHEN: Thu Mar 3 15:14:45 2016
;; MSG SIZE rcvd: 90
However, when I do nslookup, I get the following. It does not give the ip address of my server ie. 198.20.30.40
$ nslookup stackoverflow.com
;; Got recursion not available from 198.20.30.40, trying next server
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: stackoverflow.com
Address: x.y.z.d
Here is what my /etc/bind/named.conf.local configuration file looks like
zone "stackoverflow.com" {
type master;
notify no;
file "/etc/bind/stackoverflow.com";
};
zone "30.20.198.in-addr.arpa" {
type master;
file "/etc/bind/198.20.30";
};
My /etc/bind/stackoverflow.com
$TTL 3D
@ IN SOA ns.stackoverflow.com. hostmaster.linux.bogus. (
990 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS ns ; Inet Address of name server
MX 10 mail.linux.bogus. ; Primary Mail Exchanger
MX 20 mail.friend.bogus. ; Secondary Mail Exchanger
;
localhost A 198.20.30.40
ns A 198.20.30.40
www CNAME ns
media CNAME ns
jobs CNAME ns
ir CNAME ns
help CNAME ns
mail A 198.20.30.40
My /etc/bind/198.20.30
$TTL 3D
@ IN SOA ns.stackoverflow.com. hostmaster.linux.bogus. (
989 ; Serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
NS ns.stackoverflow.com.
40 PTR ns.stackoverflow.com.
40 PTR jobs.stackoverflow.com.
40 PTR help.stackoverflow.com.