delete all nameservers in resolv.conf on my Linux VPS server , DNS still working ?
Asked by duncanb7
at 2024-07-26 04:52:31

Point:500 Replies:3 POST_ID:828615USER_ID:11059
Topic:
Apache Web Server;Linux Networking;Miscellaneous Networking
Dear Exports,
it might be easy question for you
In my VPS server, I check the nameserver of DNS at /etc/resolv.conf that
is only existing one nameserver 8.8.8.8 which I know that is Google public DNS server and
let me to find all world wide IP from domain name. Now I try a test to delete
everything so that the resolv.conf is blank file now . So I try to made a test with
the command ,dig yahoo.com . The result is shown as follows.
Why I'm be able to get the domain name information such as its IP when
I already deleted nameserver 8.8.8.8 in resolv.conf. ?
And I check the server is 127.0.0.1 that is locahost (;; SERVER: 127.0.0.1#53(127.0.0.1))
Why my local address 127.0.0.1 can be public DNS server ?
I believe there is DNS forwarding to 8.8.8.8 from 127.0.0.1, but
I searched it in /etc/named.conf and found nothing inside.
So how 127.0.0.1 can public DNS server ?
Somewhere it might forward DNS from 127.0.0.1 to 8.8.8.8 if resolv.conf is blank file
Please advise
Duncan
Dig yahoo.com
================================================================
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> yahoo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46039
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 7, ADDITIONAL: 7
;; QUESTION SECTION:
;yahoo.com. IN A
;; ANSWER SECTION:
yahoo.com. 1800 IN A 206.190.36.45
yahoo.com. 1800 IN A 98.139.183.24
yahoo.com. 1800 IN A 98.138.253.109
;; AUTHORITY SECTION:
yahoo.com. 164060 IN NS ns3.yahoo.com.
yahoo.com. 164060 IN NS ns5.yahoo.com.
yahoo.com. 164060 IN NS ns4.yahoo.com.
yahoo.com. 164060 IN NS ns8.yahoo.com.
yahoo.com. 164060 IN NS ns2.yahoo.com.
yahoo.com. 164060 IN NS ns6.yahoo.com.
yahoo.com. 164060 IN NS ns1.yahoo.com.
;; ADDITIONAL SECTION:
ns2.yahoo.com. 164060 IN A 68.142.255.16
ns8.yahoo.com. 164060 IN A 202.165.104.22
ns6.yahoo.com. 164060 IN A 202.43.223.170
ns5.yahoo.com. 164060 IN A 119.160.247.124
ns4.yahoo.com. 164060 IN A 98.138.11.157
ns3.yahoo.com. 164060 IN A 203.84.221.53
ns1.yahoo.com. 164060 IN A 68.180.131.16
;; Query time: 253 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 26 19:42:32 2013
;; MSG SIZE rcvd: 313
/etc/named.conf
==========================================================
include "/etc/rndc.key";
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
options {
/* make named use port 53 for the source of all queries, to allow
* firewalls to block all ports except 53:
*/
// query-source port 53;
/* We no longer enable this by default as the dns posion exploit
has forced many providers to open up their firewalls a bit */
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // the default
pid-file "/var/run/named/named.pid";
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
/* memstatistics-file "data/named_mem_stats.txt"; */
allow-transfer {"none";};
};
logging {
/* If you want to enable debugging, eg. using the 'rndc trace' command,
* named will try to write the 'named.run' file in the $directory (/var/named").
* By default, SELinux policy does not allow named to modify the /var/named" directory,
* so put the default debug log file in data/ :
*/
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
// All BIND 9 zones are in a "view", which allow different zones to be served
// to different types of client addresses, and for options to be set for groups
// of zones.
//
// By default, if named.conf contains no "view" clauses, all zones are in the
// "default" view, which matches all clients.
//
// If named.conf contains any "view" clause, then all zones MUST be in a view;
// so it is recommended to start off using views to avoid having to restructure
// your configuration files in the future.
view "localhost_resolver" {
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
* If all you want is a caching-only nameserver, then you need only define this view:
*/
match-clients { 127.0.0.0/24; };
match-destinations { localhost; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
/* these are zones that contain definitions for all the localhost
* names and addresses, as recommended in RFC1912 - these names should
* ONLY be served to localhost clients:
*/
include "/var/named/named.rfc1912.zones";
};
view "internal" {
/* This view will contain zones you want to serve only to "internal" clients
that connect via your directly attached LAN interfaces - "localnets" .
*/
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
// include "/var/named/named.rfc1912.zones";
// you should not serve your rfc1912 names to non-localhost clients.
// These are your "authoritative" internal zones, and would probably
// also be included in the "localhost_resolver" view above :
zone "vps.mysite" {
type master;
file "/var/named/vps.mysite.db";
};
zone "mysite" {
type master;
file "/var/named/mysite.db";
};
};
view "external" {
/* This view will contain zones you want to serve only to "external" clients
* that have addresses that are not on your directly attached LAN interface subnets:
*/
recursion no;
// you'd probably want to deny recursion to external clients, so you don't
// end up providing free DNS service to all takers
// all views must contain the root hints zone:
zone "." IN {
type hint;
file "/var/named/named.ca";
};
// These are your "authoritative" external zones, and would probably
// contain entries for just your web and mail servers:
// BEGIN external zone entries
zone "vps.mysite" {
type master;
file "/var/named/vps.mysite.db";
};
zone "mysite" {
type master;
file "/var/named/mysite.db";
};
};
it might be easy question for you
In my VPS server, I check the nameserver of DNS at /etc/resolv.conf that
is only existing one nameserver 8.8.8.8 which I know that is Google public DNS server and
let me to find all world wide IP from domain name. Now I try a test to delete
everything so that the resolv.conf is blank file now . So I try to made a test with
the command ,dig yahoo.com . The result is shown as follows.
Why I'm be able to get the domain name information such as its IP when
I already deleted nameserver 8.8.8.8 in resolv.conf. ?
And I check the server is 127.0.0.1 that is locahost (;; SERVER: 127.0.0.1#53(127.0.0.1))
Why my local address 127.0.0.1 can be public DNS server ?
I believe there is DNS forwarding to 8.8.8.8 from 127.0.0.1, but
I searched it in /etc/named.conf and found nothing inside.
So how 127.0.0.1 can public DNS server ?
Somewhere it might forward DNS from 127.0.0.1 to 8.8.8.8 if resolv.conf is blank file
Please advise
Duncan
Dig yahoo.com
================================================================
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> yahoo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46039
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 7, ADDITIONAL: 7
;; QUESTION SECTION:
;yahoo.com. IN A
;; ANSWER SECTION:
yahoo.com. 1800 IN A 206.190.36.45
yahoo.com. 1800 IN A 98.139.183.24
yahoo.com. 1800 IN A 98.138.253.109
;; AUTHORITY SECTION:
yahoo.com. 164060 IN NS ns3.yahoo.com.
yahoo.com. 164060 IN NS ns5.yahoo.com.
yahoo.com. 164060 IN NS ns4.yahoo.com.
yahoo.com. 164060 IN NS ns8.yahoo.com.
yahoo.com. 164060 IN NS ns2.yahoo.com.
yahoo.com. 164060 IN NS ns6.yahoo.com.
yahoo.com. 164060 IN NS ns1.yahoo.com.
;; ADDITIONAL SECTION:
ns2.yahoo.com. 164060 IN A 68.142.255.16
ns8.yahoo.com. 164060 IN A 202.165.104.22
ns6.yahoo.com. 164060 IN A 202.43.223.170
ns5.yahoo.com. 164060 IN A 119.160.247.124
ns4.yahoo.com. 164060 IN A 98.138.11.157
ns3.yahoo.com. 164060 IN A 203.84.221.53
ns1.yahoo.com. 164060 IN A 68.180.131.16
;; Query time: 253 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 26 19:42:32 2013
;; MSG SIZE rcvd: 313
/etc/named.conf
==========================================================
include "/etc/rndc.key";
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
options {
/* make named use port 53 for the source of all queries, to allow
* firewalls to block all ports except 53:
*/
// query-source port 53;
/* We no longer enable this by default as the dns posion exploit
has forced many providers to open up their firewalls a bit */
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // the default
pid-file "/var/run/named/named.pid";
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
/* memstatistics-file "data/named_mem_stats.txt"; */
allow-transfer {"none";};
};
logging {
/* If you want to enable debugging, eg. using the 'rndc trace' command,
* named will try to write the 'named.run' file in the $directory (/var/named").
* By default, SELinux policy does not allow named to modify the /var/named" directory,
* so put the default debug log file in data/ :
*/
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
// All BIND 9 zones are in a "view", which allow different zones to be served
// to different types of client addresses, and for options to be set for groups
// of zones.
//
// By default, if named.conf contains no "view" clauses, all zones are in the
// "default" view, which matches all clients.
//
// If named.conf contains any "view" clause, then all zones MUST be in a view;
// so it is recommended to start off using views to avoid having to restructure
// your configuration files in the future.
view "localhost_resolver" {
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
* If all you want is a caching-only nameserver, then you need only define this view:
*/
match-clients { 127.0.0.0/24; };
match-destinations { localhost; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
/* these are zones that contain definitions for all the localhost
* names and addresses, as recommended in RFC1912 - these names should
* ONLY be served to localhost clients:
*/
include "/var/named/named.rfc1912.zones";
};
view "internal" {
/* This view will contain zones you want to serve only to "internal" clients
that connect via your directly attached LAN interfaces - "localnets" .
*/
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
// include "/var/named/named.rfc1912.zones";
// you should not serve your rfc1912 names to non-localhost clients.
// These are your "authoritative" internal zones, and would probably
// also be included in the "localhost_resolver" view above :
zone "vps.mysite" {
type master;
file "/var/named/vps.mysite.db";
};
zone "mysite" {
type master;
file "/var/named/mysite.db";
};
};
view "external" {
/* This view will contain zones you want to serve only to "external" clients
* that have addresses that are not on your directly attached LAN interface subnets:
*/
recursion no;
// you'd probably want to deny recursion to external clients, so you don't
// end up providing free DNS service to all takers
// all views must contain the root hints zone:
zone "." IN {
type hint;
file "/var/named/named.ca";
};
// These are your "authoritative" external zones, and would probably
// contain entries for just your web and mail servers:
// BEGIN external zone entries
zone "vps.mysite" {
type master;
file "/var/named/vps.mysite.db";
};
zone "mysite" {
type master;
file "/var/named/mysite.db";
};
};