LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   quick question about the dig command and FQDNs (https://www.linuxquestions.org/questions/linux-server-73/quick-question-about-the-dig-command-and-fqdns-911590/)

mman12 11-03-2011 12:21 AM

quick question about the dig command and FQDNs
 
I'm attempting to configure a DNS server using google as my FQDN forwarder. (8.8.8.8 or 8.8.4.4) I believe I've configured everything correctly but since this is my first time attempting this via linux I'm not entirely certain everything is working properly.

My primary concern is whether the server is resolving queries through google or not. I've read that the dig command could be used to determine this, but I cant figure out exactly how.

Would someone be able to tell me how I can be certain that my server is checking name resolution queries with google by using dig or any other command please?

bathory 11-03-2011 01:22 AM

Hi,

You can see the resolver in the dig output, e.g:
Code:

dig linuxquestions.org

; <<>> DiG 9.8.1 <<>> linuxquestions.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36062
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;linuxquestions.org.            IN      A

;; ANSWER SECTION:
linuxquestions.org.    1440    IN      A      75.126.162.205

;; Query time: 96 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Nov  3 08:21:34 2011
;; MSG SIZE  rcvd: 52

Regards

mman12 11-03-2011 07:22 AM

Thank you Bathory, this is exactly what I needed, but now I have a new problem. My server is definitely not using google to resolve queries.

I originally believed that configuring the forwarders, in the etc/bind/named.conf.options, to 8.8.8.8 and/or 8.8.4.4 file would allow resolution through goole, but apparently not.

I've experimented a little, and now wonder if changing the nameserver line in the etc/resolv.conf to google's address would get everything working. Any ideas?
Would it just be easier for me to upload my code and let you dissect it at this point?

bathory 11-03-2011 08:03 AM

Quote:

I've experimented a little, and now wonder if changing the nameserver line in the etc/resolv.conf to google's address would get everything working. Any ideas?
We are talking for 2 different things:
In my post above I assumed that you want to use google as a resolver, i.e. use its namerver(s) in /etc/resolv.conf
If you want to use google as a forwarder for your nameserver, you need to add its namerver(s) in the forwarders option in named.conf and also use
Code:

forward only;
Note that in this case the answer will come from your dns. You can achieve the same without forwarders, if you configure your server as a caching dns (using the hint zone).

Quote:

Would it just be easier for me to upload my code and let you dissect it at this point?
Feel free to do so if you want, but you have to explain what exactly are you trying to do with your nameserver.

Regards

mman12 11-03-2011 05:37 PM

I'm so sorry, you're right. I was confusing terminology. I did a little more research, and what I'm trying to do is configure my DNS server to forward to google. Eventually I would like to host my zone, but that's a project for another day. At the moment what I really want to know is how do I find proof that queries are being forwarded?

I may have messed something else up for all I know, so here are my configurations.

(resolv.conf)
# Generated by NetworkManager
domain localdomain
search myzone.org
nameserver 192.168.8.2



(db.192.168.0)
;
$TTL 604800
0.168.192.in-addr.arpa. IN SOA ns1.myzone.org. admin.myzone.org. (
1;
3h;
1h;
1w;
1h );
;
0.168.192.in-addr.arpa. IN NS ns1.myzone.org.

10.0.168.192.in-addr.arpa. IN PTR myzone.org.



(db.myzone.org)
;
$TTL 3h
@ IN SOA ns1.myzone.org. admin.myzone.org. (
1;
3h;
1h;
1w;
1h );
;
@ IN NS ns1.myzone.org.
myzone.org. IN MX 10 mail.myzone.org.
myzone.org. IN A 192.168.0.10
ns1 IN A 192.168.0.10
www IN CNAME myzone.org.
mail IN A 192.168.0.10
ftp IN CNAME myzone.org.



(named.conf.options)
options {
directory "/var/cache/bind";
//
forwarders {
8.8.8.8;
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};



(named.conf.local)
//
zone "myzone.org" {
type master;
file "/etc/bind/zones/master/db.myzone.org";
};

zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/master/db.192.168.0";
};


I don't expect some one to write the whole server for me, or even spell check it, but I greatly appreciate any help offered.

bathory 11-03-2011 06:28 PM

You should add a
Code:

forward first;
option if you want to run your own authoritative server along with forwarding queries.

Quote:

At the moment what I really want to know is how do I find proof that queries are being forwarded?
You can use tcpdump.
First run:
Code:

tcpdump -w dns.pcap -i eth0 port 53
and do some queries to your dns (e.g. dig linuxquestions.org, dig google.com etc) to capture some packets, stop the command above and read the captured packets:
Code:

tcpdump -n -r dns.pcap
You'll see something like the following proving that your dns forwards queries to 8.8.8.8
Quote:

reading from file dns.pcap, link-type EN10MB (Ethernet)
01:20:30.390190 IP 192.168.254.1.2528 > 8.8.8.8.53: 52735+ [1au] A? linuxquestions.org. (47)
01:20:30.473711 IP 8.8.8.8.53 > 192.168.254.1.2528: 52735 1/0/1 A 75.126.162.205 (63)
01:20:35.926546 IP 192.168.254.1.40859 > 8.8.8.8.53: 7108+ [1au] A? google.com. (39)
01:20:36.015160 IP 8.8.8.8.53 > 192.168.254.1.40859: 7108 6/0/1 A 209.85.148.106, A 209.85.148.99, A 209.85.148.147, A 209.85.148.103, A 209.85.148.105, A 209.85.148.104 (135)

mman12 11-03-2011 09:51 PM

IT WORKS!!!, quite well in fact. Thank you very much Bathory, I couldn't of done it without your help.


All times are GMT -5. The time now is 05:53 PM.