---
description: dns&bind
---

# 20190306

\#yum -y install bind bind-chroot bind-utils

\#rpm -ql bind

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_Gd24yrSOQ0GsnjSbc%2Fimage.png?alt=media\&token=7d80e6b4-b3d1-4854-8343-f7ba56cbbf61)

\#systemctl stop firewalld

\#systemctl status firewalld

\#getenforce                                **Disabled**

\#systemctl start named

\#systemctl status named

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GdHD6AQ7EipB5Nhj0%2Fimage.png?alt=media\&token=f715dd84-fb7d-4c42-b8b1-953475ff65f4)

\#netstat tunlp | grep 53

&#x20;**檢查所有占用53port號的ip**

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GcoEtivREJ3btjpcw%2Fimage.png?alt=media\&token=0b941361-6250-4f18-ab89-f7761896c7b9)

**測試內網能不能抓到**

\#dig @127.0.0.1 www.pchome.com.tw

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GeGVAtOfdIZHhroWy%2Fimage.png?alt=media\&token=130323c8-ee1c-46c9-a470-c492b23ad177)

**測試外網**

\#dig @192.168.0.204 www.google.com.tw

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_Gei9WRiUEDYyQsySo%2Fimage.png?alt=media\&token=6bfaf1e1-5ef5-4351-a612-58cfc2453fb9)

**如果要讓外網也能使用的話**

\#gedit /etc/named.conf

**修改**

listen-on port 53 {127.0.0.1;};                 listen-on port 53 {any;};

**/讓內網以外的ip可以使用**

allow-query {localhost;};                          allow-query {any;};

**/讓其他使用者可以使用**

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GdWYhFvmS7W7Rcl2K%2Fimage.png?alt=media\&token=edd464b1-2d81-445c-8360-e695c392ecbe)

\#systemctl restart named

**再次執行一次 192.168.0.204**

\#dig @192.168.0.204 www.pchome.com.tw

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GfG3jqJXMQfuNMEwe%2Fimage.png?alt=media\&token=f320b5fe-cd5d-4f30-a125-fa398abf024e)

**windows使用者的模式下也能進行**

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GgjaSEaN1hd0_Q7LB%2Fimage.png?alt=media\&token=70d59095-ea7b-447e-8840-6016cd237ba6)



\#gedit /etc/named.rfc1912.zones

**在最下面增加**

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_GWgwNhbPp7PiAGffq%2F-L_GgtG7Mqh8ItbmQSgk%2Fimage.png?alt=media\&token=ea7b3238-31af-4701-bd5c-f1da31500e0e)

\#gedit /var/named/named.test

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_omFlUBdY-upk2WZ7q%2F-L_omIQY5ILkzRnB-HX2%2Fimage.png?alt=media\&token=d631ba1c-2814-4fbb-8222-935580687f64)

\#systemctl restart named

到終端機測試

![正向解析](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_omFlUBdY-upk2WZ7q%2F-L_omdJU3vPmScNLG_so%2Fimage.png?alt=media\&token=0b0fd7a0-4917-4725-a910-9c089eddcdf3)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_p09KCQMFMQpGTRE3e%2F-L_p0sPNMeKNUj1uDD_Z%2Fimage.png?alt=media\&token=853aa437-d8be-4d84-a21e-758cb1e686be)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_p09KCQMFMQpGTRE3e%2F-L_p14zDHlnJkQbHm3Xk%2Fimage.png?alt=media\&token=193df5e1-2509-4a6d-b5ad-800e65391e16)

![反向解析](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-L_p09KCQMFMQpGTRE3e%2F-L_p0bCYSjl6D1eGJDqf%2Fimage.png?alt=media\&token=dec81387-5a29-47b7-8844-90368a1861fb)

{% embed url="http://blog.kevinlinul.idv.tw/?p=188" %}

