Welcome to the Linux Foundation Forum!

Lab 6.2 always get DNS reply from internet

Posts: 2
edited December 2016 in LFS211 Class Forum

I tried to do Lab 6.2 with centos 7 virtual machine. But dig @localhost always get replies from internet:


  1. [wan@centos ~]$ dig @localhost www.exapmle.com A
  2. ; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.4 <<>> @localhost www.exapmle.com A
  3. ; (2 servers found)
  4. ;; global options: +cmd
  5. ;; Got answer:
  6. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23488
  7. ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 5
  8. ;; OPT PSEUDOSECTION:
  9. ; EDNS: version: 0, flags:; udp: 4096
  10. ;; QUESTION SECTION:
  11. ;www.exapmle.com. IN A
  12. ;; ANSWER SECTION:
  13. www.exapmle.com. 3497 IN A 103.224.182.207
  14. ;; AUTHORITY SECTION:
  15. exapmle.com. 172696 IN NS ns2.above.com.
  16. exapmle.com. 172696 IN NS ns1.above.com.
  17. ;; ADDITIONAL SECTION:
  18. ns1.above.com. 172696 IN A 103.224.212.5
  19. ns1.above.com. 172696 IN A 103.224.182.5
  20. ns2.above.com. 172696 IN A 103.224.182.6
  21. ns2.above.com. 172696 IN A 103.224.212.6
  22. ;; Query time: 0 msec
  23. ;; SERVER: 127.0.0.1#53(127.0.0.1)
  24. ;; WHEN: 12 06 21:51:12 CST 2016
  25. ;; MSG SIZE rcvd: 166

But dig from another host get the desired result. DNS is working.


  1. wan@sucrose:~$ dig @centos foo.example.com A
  2. ; <<>> DiG 9.10.3-P4-Ubuntu <<>> @centos foo.example.com A
  3. ; (1 server found)
  4. ;; global options: +cmd
  5. ;; Got answer:
  6. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7800
  7. ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 3
  8. ;; OPT PSEUDOSECTION:
  9. ; EDNS: version: 0, flags:; udp: 4096
  10. ;; QUESTION SECTION:
  11. ;foo.example.com. IN A
  12. ;; ANSWER SECTION:
  13. foo.example.com. 30 IN A 192.168.121.11
  14. ;; AUTHORITY SECTION:
  15. example.com. 30 IN NS localhost.
  16. ;; ADDITIONAL SECTION:
  17. localhost. 86400 IN A 127.0.0.1
  18. localhost. 86400 IN AAAA ::1
  19. ;; Query time: 0 msec
  20. ;; SERVER: 172.18.207.35#53(172.18.207.35)
  21. ;; WHEN: Tue Dec 06 21:39:28 CST 2016
  22. ;; MSG SIZE rcvd: 127

I need help.

config file:


  1. [root@centos ~]# cat /etc/named.conf
  2. //
  3. // named.conf
  4. //
  5. // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
  6. // server as a caching only nameserver (as a localhost DNS resolver only).
  7. //
  8. // See /usr/share/doc/bind*/sample/ for example named configuration files.
  9. //
  10. options {
  11. listen-on port 53 { any; };
  12. directory "/var/named";
  13. dump-file "/var/named/data/cache_dump.db";
  14. statistics-file "/var/named/data/named_stats.txt";
  15. memstatistics-file "/var/named/data/named_mem_stats.txt";
  16. allow-query { any; };
  17. /*
  18. - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
  19. - If you are building a RECURSIVE (caching) DNS server, you need to enable
  20. recursion.
  21. - If your recursive DNS server has a public IP address, you MUST enable access
  22. control to limit queries to your legitimate users. Failing to do so will
  23. cause your server to become part of large scale DNS amplification
  24. attacks. Implementing BCP38 within your network would greatly
  25. reduce such attack surface
  26. */
  27. recursion yes;
  28. dnssec-enable yes;
  29. dnssec-validation yes;
  30. /* Path to ISC DLV key */
  31. bindkeys-file "/etc/named.iscdlv.key";
  32. managed-keys-directory "/var/named/dynamic";
  33. pid-file "/run/named/named.pid";
  34. session-keyfile "/run/named/session.key";
  35. };
  36. logging {
  37. channel default_debug {
  38. file "data/named.run";
  39. severity dynamic;
  40. };
  41. };
  42. zone "." IN {
  43. type hint;
  44. file "named.ca";
  45. };
  46. zone "example.com" IN {
  47. type master;
  48. file "example.com";
  49. };
  50. include "/etc/named.rfc1912.zones";
  51. include "/etc/named.root.key";

zone file:


  1. [root@centos ~]# cat /var/named/example.com
  2. $TTL 30
  3. @ IN SOA localhost. admin.example.com. (
  4. 2016120907 ; serial YYYYMMDDRR format
  5. 3H ; refresh
  6. 1H ; retry
  7. 2H ; expire
  8. 1M) ; neg ttl
  9. IN NS localhost.;
  10. www.example.com. IN A 192.168.111.45
  11. www.example.com. IN AAAA fe80::22c9:d0ff:1ecd:c0ef
  12. foo.example.com. IN A 192.168.121.11
  13. bar.example.com. IN CNAME www.example.com.
  14. ;generate one hundred entries host1 thru host100
  15. $GENERATE 1-100 host$.example.com. IN A 10.20.45.$

errors:


  1. [root@centos ~]# systemctl status named.service -l
  2. named.service - Berkeley Internet Name Domain (DNS)
  3. Loaded: loaded (/usr/lib/systemd/system/named.service; disabled; vendor preset: disabled)
  4. Active: active (running) since 2016-12-06 21:55:44 CST; 3min 54s ago
  5. Process: 2469 ExecStart=/usr/sbin/named -u named $OPTIONS (code=exited, status=0/SUCCESS)
  6. Process: 2460 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z /etc/named.conf; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
  7. Main PID: 2473 (named)
  8. CGroup: /system.slice/named.service
  9. └─2473 /usr/sbin/named -u named
  10. 12 06 21:55:44 centos.home named[2473]: zone localhost.localdomain/IN: loaded serial 0
  11. 12 06 21:55:44 centos.home named[2473]: zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
  12. 12 06 21:55:44 centos.home named[2473]: zone localhost/IN: loaded serial 0
  13. 12 06 21:55:44 centos.home named[2473]: all zones loaded
  14. 12 06 21:55:44 centos.home named[2473]: running
  15. 12 06 21:55:44 centos.home systemd[1]: Started Berkeley Internet Name Domain (DNS).
  16. 12 06 21:55:56 centos.home named[2473]: error (network unreachable) resolving 'www.exapmle.com/A/IN': 2001:7fe::53#53
  17. 12 06 21:55:56 centos.home named[2473]: error (network unreachable) resolving './NS/IN': 2001:7fe::53#53
  18. 12 06 21:55:56 centos.home named[2473]: error (network unreachable) resolving 'com/DS/IN': 2001:503:ba3e::2:30#53
  19. 12 06 21:55:56 centos.home named[2473]: error (network unreachable) resolving 'com/DS/IN': 2001:500:3::42#53

 

Comments

  • Posts: 2
    edited December 2016

    I think I didn't set /etc/resolv.conf correctly. Problem solved after I changed my ip settings from static to dhcp.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training