Advertisement
Typhoon

CentOS DNS-Server for .local Domain

Jun 22nd, 2014
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.47 KB | None | 0 0
  1. # cat /etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE=eth0
  3. TYPE=Ethernet
  4. UUID=07644a2c-ef2c-40e6-b456-c263ba66c688
  5. ONBOOT=yes
  6. NM_CONTROLLED=yes
  7. BOOTPROTO=static
  8. IPADDR=192.168.1.220
  9. PREFIX=24
  10. GATEWAY=192.168.1.1
  11. DNS1=192.168.1.220
  12. DOMAIN=local
  13. DEFROUTE=yes
  14. IPV4_FAILURE_FATAL=yes
  15. IPV6INIT=no
  16. NAME="System eth0"
  17. DNS2=8.8.8.8
  18. HWADDR=00:0C:29:DC:47:43
  19. LAST_CONNECT=1403433020
  20.  
  21. # cat /etc/sysconfig/network
  22. NETWORKING=yes
  23. HOSTNAME=centos.local
  24. NTPSERVERARGS=iburst
  25.  
  26. # cat /etc/hosts
  27. 127.0.0.1   localhost puppet.local centos.local localhost.localdomain localhost4 localhost4.localdomain4
  28. ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
  29.  
  30. # cat /etc/resolv.conf
  31. # Generated by NetworkManager
  32. search local
  33. nameserver 192.168.1.220
  34. nameserver 8.8.8.8
  35.  
  36. # cat /etc/named.conf
  37. //
  38. // named.conf
  39. //
  40. // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
  41. // server as a caching only nameserver (as a localhost DNS resolver only).
  42. //
  43. // See /usr/share/doc/bind*/sample/ for example named configuration files.
  44. //
  45.  
  46. options {
  47.     listen-on port 53 { 127.0.0.1; 192.168.1.220; };
  48.     listen-on-v6 port 53 { ::1; };
  49.     directory   "/var/named";
  50.     dump-file   "/var/named/data/cache_dump.db";
  51.         statistics-file "/var/named/data/named_stats.txt";
  52.         memstatistics-file "/var/named/data/named_mem_stats.txt";
  53.     allow-query     { localhost; 192.168.1.1/24; };
  54.     recursion yes;
  55.  
  56.     dnssec-enable yes;
  57.     dnssec-validation yes;
  58.     dnssec-lookaside auto;
  59.  
  60.     /* Path to ISC DLV key */
  61.     bindkeys-file "/etc/named.iscdlv.key";
  62.  
  63.     managed-keys-directory "/var/named/dynamic";
  64. };
  65.  
  66. logging {
  67.         channel default_debug {
  68.                 file "data/named.run";
  69.                 severity dynamic;
  70.         };
  71. };
  72.  
  73. zone "." IN {
  74.     type hint;
  75.     file "named.ca";
  76. };
  77.  
  78.  
  79. include "/etc/named.rfc1912.zones";
  80. include "/etc/named.root.key";
  81.  
  82. zone "local" IN {
  83.   type master;
  84.   file "local.zone";
  85.   allow-update { none; };
  86. };
  87.  
  88. zone "1.168.192.in-addr.arpa" IN {
  89.   type master;
  90.   file "localrr.zone";
  91.   allow-update { none; };
  92. };
  93.  
  94.  
  95. # cat /var/named/local.zone
  96. $TTL 86400
  97.  
  98. @     IN     SOA    puppet     ja.puppet.local. (
  99.                     2001062501 ; serial
  100.                     21600      ; refresh after 6 hours
  101.                     3600       ; retry after 1 hour
  102.                     604800     ; expire after 1 week
  103.                     86400 )    ; minimum TTL of 1 day
  104.  
  105.         IN  NS  puppet
  106.  
  107. puppet      IN  A   192.168.1.220
  108. centos      IN  A   192.168.1.220
  109. cent1       IN  A   192.168.1.221
  110. cent2       IN  A   192.168.1.222
  111.  
  112. # cat /var/named/localrr.zone
  113. $TTL 86400
  114. @     IN     SOA    local     ja.puppet.local. (
  115.                     2001062501 ; serial
  116.                     21600      ; refresh after 6 hours
  117.                     3600       ; retry after 1 hour
  118.                     604800     ; expire after 1 week
  119.                     86400 )    ; minimum TTL of 1 day
  120.  
  121.     IN  NS  puppet.
  122.  
  123. 220 IN  PTR puppet.local.
  124. 221 IN  PTR cent1.local.
  125. 222 IN  PTR cent2.local.
  126.  
  127. # host 192.168.1.222
  128. 222.1.168.192.in-addr.arpa domain name pointer cent2.local.
  129.  
  130. # host cent2.local
  131. cent2.local has address 192.168.1.222
  132.  
  133. # dig cent1.local @192.168.1.220
  134.  
  135. ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> cent1.local @192.168.1.220
  136. ;; global options: +cmd
  137. ;; Got answer:
  138. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56294
  139. ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
  140.  
  141. ;; QUESTION SECTION:
  142. ;cent1.local.           IN  A
  143.  
  144. ;; ANSWER SECTION:
  145. cent1.local.        86400   IN  A   192.168.1.221
  146.  
  147. ;; AUTHORITY SECTION:
  148. local.          86400   IN  NS  puppet.local.
  149.  
  150. ;; ADDITIONAL SECTION:
  151. puppet.local.       86400   IN  A   192.168.1.220
  152.  
  153. ;; Query time: 0 msec
  154. ;; SERVER: 192.168.1.220#53(192.168.1.220)
  155. ;; WHEN: Sun Jun 22 15:22:59 2014
  156. ;; MSG SIZE  rcvd: 82
  157.  
  158. # dig cent2.local @puppet.local
  159.  
  160. ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> cent2.local @puppet.local
  161. ;; global options: +cmd
  162. ;; Got answer:
  163. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48528
  164. ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
  165.  
  166. ;; QUESTION SECTION:
  167. ;cent2.local.           IN  A
  168.  
  169. ;; ANSWER SECTION:
  170. cent2.local.        86400   IN  A   192.168.1.222
  171.  
  172. ;; AUTHORITY SECTION:
  173. local.          86400   IN  NS  puppet.local.
  174.  
  175. ;; ADDITIONAL SECTION:
  176. puppet.local.       86400   IN  A   192.168.1.220
  177.  
  178. ;; Query time: 0 msec
  179. ;; SERVER: 127.0.0.1#53(127.0.0.1)
  180. ;; WHEN: Sun Jun 22 15:23:39 2014
  181. ;; MSG SIZE  rcvd: 82
  182.  
  183. # service named restart
  184. Stopping named: .                                          [  OK  ]
  185. Starting named:                                            [  OK  ]
  186.  
  187. #Turn ON named at boot :
  188.  
  189. # chkconfig --list named
  190. # chkconfig named on
  191. # chkconfig --list named
  192. named           0:vyp   1:vyp   2:zap   3:zap   4:zap   5:zap   6:vyp
  193.  
  194. #Check if is DNS port open in IPTABLES (FireWall)
  195.  
  196. # iptables --list
  197. Chain INPUT (policy ACCEPT)
  198. target     prot opt source               destination
  199. ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
  200. ACCEPT     icmp --  anywhere             anywhere
  201. ACCEPT     all  --  anywhere             anywhere
  202. ACCEPT     all  --  anywhere             anywhere
  203. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
  204. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
  205. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
  206. ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:netbios-ns
  207. ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:netbios-dgm
  208. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:netbios-ssn
  209. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:microsoft-ds
  210. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:domain
  211. ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:domain
  212. REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
  213.  
  214. Chain FORWARD (policy ACCEPT)
  215. target     prot opt source               destination
  216. ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
  217. ACCEPT     icmp --  anywhere             anywhere
  218. ACCEPT     all  --  anywhere             anywhere
  219. ACCEPT     all  --  anywhere             anywhere
  220. REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
  221.  
  222. Chain OUTPUT (policy ACCEPT)
  223. target     prot opt source               destination
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement