Get the App
SLTechnology News&Howtos  ›  Servers  › 

Configure simple DNS through unbound software

Shulou Source: shulou.com Published: 2022-06-03 05:01:57 11月15日 Update

Software to implement DNS: unbound (it seems that bind is more powerful)

Unbound is the DNS software recommended by Red Hat.

Packages for unbound:

Unbound: the main package that implements DNS

Unbound-libs: a necessary library file for domain name resolution

Startup of the unbound service:

Systemctl start unbound

Configuration file for unbound:

/ etc/unbound/unbound.conf # main configuration file

/ etc/unbound/local.d/ #

Line 39 of the / etc/nsswitch.conf # / etc/nsswitch.conf file, "hosts:files dns", specifies the order in which a host is parsed

First look for the local file / etc/hosts, then DNS

/ etc/hosts # Mapping between local IP address and hostname

/ etc/resolv.conf # specify a DNS server for linux clients

Configure firewall to release DNS service

Firewall-cmd-add-service=dns-permanent

Start the unbound service and set up boot:

Systemctl start unbound

Systemctl enable unbound

Configure the firewall

Firewall-cmd-permanent-add-service=dns

Firewall-cmd-reload

Unbound main profile:

/ etc/unbound/unbound.conf

Server:

Interface:xxxx # IP address for listening. Default listener localhost

Access control list; (all hosts are denied by default except localhost)

Access-control: IP address / mask allow # hosts allowed to access

Access-control: IP address / mask refuse # forbidden host

Username: "" # any user can access

Include: / etc/unbound/local.d/*.conf

Local-zone:

Resource record: RR

Remote-control:

Stub-zone:

Forward-zone:

1. The forward and backward parsing files in unbound are merged into one:

Create a new file testyuming.com.conf under / etc/unbound/local.d/, with the following contents:

Local-zone: "testyuming.com." Static

Local-data: "testyuming.com. 86400 IN SOA 768047936.qq.com. Root 1 1D 1H 1W 1H"

Local-data: "testyuming.com. NS www.testyuming.com."

Local-data: "testyuming.com. MX 5 www.testyuming.com."

Local-data: "www.testyuming.com. A 192.168.1.118"

Local-data: "bbs.testyuming.com. A 192.168.1.118"

# local-data-ptr: "192.168.1.118 www.testyuming.com." Reverse parsing paradigm

two。 Use unbound-checkconf to check syntax

3. Restart the unbound service:

Systemctl restart unbound

4. Modify the / etc/resolv.conf file as follows:

Nameserver 192.168.1.118

5.

[root@localhost etc] # host www.testyuming.com

Www.testyuming.com has address 192.168.1.118

Configure to forward only DNS:

1.

Basic settings for the unbound main configuration file:

Interface: 192.168.1.118

Access-control: 0.0.0.0/0 allow

Username: ""

Find module-config in the configuration file

Cancel the comment and change it to module-config: "iterator"

two。

Restart unbound

Systemctl restart unbound

3.

Create a new file bb.conf under / etc/unbound/local.d/, with the following contents:

Forward-zone:

Name: ".

Forward-addr: server IP that can be parsed by DNS

Unbound-control flush domain name # clear cache

Tags: Files configurations services hosts addresses content software domain names servers firewalls monitoring fire protection power main programs companies customers clients library files comments users Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Apple Xiaomi Huawei MySQL