I use 127.0.0.1 as my dns!
lol seriously! I use YourFriendlyDNS which in turn uses OpenDNS (which is a lot faster consistently for me than G* dns or any dns) and it's soon going to have added DNSCrypt support as well!
To note, Joom is right ping is not the right tool for job herem you're going to want to use something like dig! The application "dig" helped me get my server to where it is today with it's telling me everything that was wrong with my dns responses until I corrected them to where everything looks good to dig now:
Note the server output dns request/response ids of the first response (which makes a real request and caches it) matching the dig output. And note the second response (in the server output it just says returned cached ips) being at 0msec so less than 1 msec. For as long as I set the cache to be valid for I get 0msec dns responses to queries I've already made within that time.
Program state at end of output taken:
Server output:
Code:
bash-3.2# ./YourFriendlyDNS.app/Contents/MacOS/YourFriendlyDNS
YourFriendlyDNS settings storage location: "/var/root/Library/Application Support/YourFriendlyDNS"
YourFriendlyDNS settings file path: "/var/root/Library/Application Support/YourFriendlyDNS/YourFriendlyDNS.settings"
Using dns server port: 53
Using http server port: 80
DNS server started on address: QHostAddress("0.0.0.0") and port: 53
HTTP server started on address: QHostAddress("0.0.0.0") and port: 80
MessagesThread started, for handling server duties!
initial mode: false
Loading respondingIP: "172.16.42.221"
Auto-setting DNS TTL: 3600
dns server loaded: "208.67.222.222"
dns server loaded: "208.67.220.220"
whitelist entry loaded: "*startpage.com" QHostAddress("0.0.0.0")
whitelist entry loaded: "*gbatemp.net" QHostAddress("0.0.0.0")
whitelist entry loaded: "*ixquick-proxy.com" QHostAddress("0.0.0.0")
whitelist entry loaded: "*github*.com" QHostAddress("0.0.0.0")
whitelist entry loaded: "github.map.fastly.net" QHostAddress("0.0.0.0")
whitelist entry loaded: "preev.com" QHostAddress("0.0.0.0")
whitelist entry loaded: "*amazon.com" QHostAddress("0.0.0.0")
whitelist entry loaded: "*cloudfront.net" QHostAddress("0.0.0.0")
whitelist entry loaded: "*w3schools.com" QHostAddress("0.0.0.0")
blacklist entry loaded: "*srv.nintendo.net" QHostAddress("0.0.0.0")
blacklist entry loaded: "*d4c.nintendo.net" QHostAddress("0.0.0.0")
blacklist entry loaded: "*eshop.nintendo.net" QHostAddress("0.0.0.0")
blacklist entry loaded: "*cdn.nintendo.net" QHostAddress("0.0.0.0")
blacklist entry loaded: "*facebook*" QHostAddress("0.0.0.0")
blacklist entry loaded: "*fbcdn*" QHostAddress("0.0.0.0")
Matched WhiteList! "*startpage.com" to: "startpage.com"
Caching this domain-> "startpage.com"
Making DNS request type: 1 for domain: "startpage.com" request id: 39808 datagram: "\x9B\x80\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\tstartpage\x03""com\x00\x00\x01\x00\x01"
Got IP: "69.28.209.190" for domain: "startpage.com"
Got IP: "69.28.209.119" for domain: "startpage.com"
Got IP: "216.218.239.42" for domain: "startpage.com"
[A RECORD] to: QHostAddress("127.0.0.1") 60726
request: "\x9B\x80\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\tstartpage\x03""com\x00\x00\x01\x00\x01" answer offset: 31
response: "\x9B\x80\x81\x80\x00\x01\x00\x03\x00\x00\x00\x00\tstartpage\x03""com\x00\x00\x01\x00\x01\xC0\f\x00\x01\x00\x01\x00\x00\x0E\x10\x00\x04""E\x1C\xD1\xBE\xC0\f\x00\x01\x00\x01\x00\x00\x0E\x10\x00\x04""E\x1C\xD1w\xC0\f\x00\x01\x00\x01\x00\x00\x0E\x10\x00\x04\xD8\xDA\xEF*"
Matched WhiteList! "*startpage.com" to: "startpage.com"
Cached IPs returned! (first one): QHostAddress("69.28.209.190") for domain: "startpage.com"
Returning custom IP: "172.16.42.221" for domain: "gsp-ssl.ls.apple.com"
Returning custom IP: "172.16.42.221" for domain: "detectportal.firefox.com"
Returning custom IP: "172.16.42.221" for domain: "detectportal.firefox.com"
Matched WhiteList! "*startpage.com" to: "startpage.com"
Cached IPs returned! (first one): QHostAddress("69.28.209.190") for domain: "startpage.com"
Matched WhiteList! "*startpage.com" to: "startpage.com"
Cached IPs returned! (first one): QHostAddress("69.28.209.190") for domain: "startpage.com"
Matched WhiteList! "*gbatemp.net" to: "gbatemp.net"
Caching this domain-> "gbatemp.net"
Making DNS request type: 1 for domain: "gbatemp.net" request id: 2088 datagram: "\b(\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07gbatemp\x03net\x00\x00\x01\x00\x01"
Got IP: "62.210.180.159" for domain: "gbatemp.net"
[A RECORD] to: QHostAddress("127.0.0.1") 65012
request: "\b(\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07gbatemp\x03net\x00\x00\x01\x00\x01" answer offset: 29
response: "\b(\x81\x80\x00\x01\x00\x01\x00\x00\x00\x00\x07gbatemp\x03net\x00\x00\x01\x00\x01\xC0\f\x00\x01\x00\x01\x00\x00\x0E\x10\x00\x04>\xD2\xB4\x9F"
Matched WhiteList! "*gbatemp.net" to: "gbatemp.net"
Cached IPs returned! (first one): QHostAddress("62.210.180.159") for domain: "gbatemp.net"
Returning custom IP: "172.16.42.221" for domain: "twitter.com"
Returning custom IP: "172.16.42.221" for domain: "detectportal.firefox.com"
Returning custom IP: "172.16.42.221" for domain: "detectportal.firefox.com"
Dig output (talking to the local dns server running on the same machine):
Code:
TheMacOS:~ engineer1$ dig startpage.com
; <<>> DiG 9.8.3-P1 <<>> startpage.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39808
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;startpage.com. IN A
;; ANSWER SECTION:
startpage.com. 3600 IN A 69.28.209.190
startpage.com. 3600 IN A 69.28.209.119
startpage.com. 3600 IN A 216.218.239.42
;; Query time: 15 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Apr 30 03:03:06 2018
;; MSG SIZE rcvd: 79
TheMacOS:~ engineer1$:~ raw$ dig startpage.com
; <<>> DiG 9.8.3-P1 <<>> startpage.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16800
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;startpage.com. IN A
;; ANSWER SECTION:
startpage.com. 3600 IN A 69.28.209.190
startpage.com. 3600 IN A 69.28.209.119
startpage.com. 3600 IN A 216.218.239.42
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Apr 30 03:03:20 2018
;; MSG SIZE rcvd: 79
TheMacOS:~ engineer1$ dig gbatemp.net
; <<>> DiG 9.8.3-P1 <<>> gbatemp.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2088
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;gbatemp.net. IN A
;; ANSWER SECTION:
gbatemp.net. 3600 IN A 62.210.180.159
;; Query time: 25 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Apr 30 03:04:03 2018
;; MSG SIZE rcvd: 45
TheMacOS:~ engineer1$ dig gbatemp.net
; <<>> DiG 9.8.3-P1 <<>> gbatemp.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26592
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;gbatemp.net. IN A
;; ANSWER SECTION:
gbatemp.net. 3600 IN A 62.210.180.159
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Apr 30 03:04:06 2018
;; MSG SIZE rcvd: 45
Making DNS request type: 1 for domain: "startpage.com"
request id: 39808
matches dig:
; <<>> DiG 9.8.3-P1 <<>> startpage.com
;;..
;; ->>HEADER<<- opcode: QUERY, status: NOERROR,
id: 39808
Making DNS request type: 1 for domain: "gbatemp.net"
request id: 2088
also matches dig:
; <<>> DiG 9.8.3-P1 <<>> gbatemp.net
;; ...
;; ->>HEADER<<- opcode: QUERY, status: NOERROR,
id: 2088
The benefit of doing this(running your own personal local dns server) on top of using a fast dns like OpenDNS is that you get a fast dns as well as a fast local dns cache along with it!
Plus even though your dns is fast, by requesting from it less you help reduce the over all load on the servers to keep it fast for everyone!
Alright so now that I've got my dns responses proper and the thing working properly through all my testing, I should add DNSCrypt support and release a new version!