DNS Forwarder

Install a DNS forwarder on CentOS 6.3:

   1 yum install bind

Edit /etc/named.conf:

   1 options {
   2         directory "/var/named";
   3         forwarders { 8.8.8.8; 8.8.4.4; };
   4 };
   5 
   6 zone "example.lan" in {
   7   type forward;
   8   forwarders { 192.168.3.56; };
   9 };
  10 
  11 zone "xpto.lan" in {
  12   type forward;
  13   forwarders { 10.0.3.3; };
  14 };

Run the following commands:

   1 service named start
   2 chkconfig named on
   3 netstat -a -n | grep ":53" | grep LISTEN

Check records with dig

   1 dig @8.8.8.8 www.sapo.pt
   2 
   3 ; <<>> DiG 9.9.3-P2 <<>> @8.8.8.8 www.sapo.pt
   4 ; (1 server found)
   5 ;; global options: +cmd
   6 ;; Got answer:
   7 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1365
   8 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
   9 
  10 ;; OPT PSEUDOSECTION:
  11 ; EDNS: version: 0, flags:; udp: 512
  12 ;; QUESTION SECTION:
  13 ;www.sapo.pt.                   IN      A
  14 
  15 ;; ANSWER SECTION:
  16 www.sapo.pt.            221     IN      A       213.13.146.140
  17 
  18 ;; Query time: 41 msec
  19 ;; SERVER: 8.8.8.8#53(8.8.8.8)
  20 ;; WHEN: Mon Feb 24 15:52:15 WET 2014
  21 ;; MSG SIZE  rcvd: 56

Check records with nslookup

   1 nslookup
   2 >server 8.8.8.8
   3 >set type=any
   4 >set debug
   5 >www.sapo.pt
   6 Server:         8.8.8.8
   7 Address:        8.8.8.8#53
   8 
   9 ------------
  10     QUESTIONS:
  11         www.sapo.pt, type = ANY, class = IN
  12     ANSWERS:
  13     ->  www.sapo.pt
  14         internet address = 213.13.146.140
  15         ttl = 113
  16     ->  www.sapo.pt
  17         has AAAA address 2001:8a0:2104:ff:213:13:146:140
  18         ttl = 713
  19     AUTHORITY RECORDS:
  20     ADDITIONAL RECORDS:
  21 ------------
  22 Non-authoritative answer:
  23 Name:   www.sapo.pt
  24 Address: 213.13.146.140
  25 www.sapo.pt     has AAAA address 2001:8a0:2104:ff:213:13:146:140
  26 
  27 Authoritative answers can be found from:

DNSForwarder (last edited 2023-05-26 14:15:11 by 127)