Get the App
SLTechnology News&Howtos  ›  Network Security  › 

DNS setting (1)

Shulou Source: shulou.com Published: 2022-06-01 02:52:35 10月04日 Update

# dns configuration #

# set up the network service environment before you start

Client Settin

Vim / etc/resolv.conf # # Edit configuration file

Nameserver 172.25.254.109 # # add server

Server Settin

Yum install bind-y # # install the bind service

Systemctl status named # # View

Rpm-qc bind

Systemctl enable named # # Boot

Systemctl start named # # enable the service

Firewall-cmd-permanent-add-service=dns # # permanently add dns service

Firewall-cmd-reload

Netstat-antulpe | grep named # # View open ports

Vim / etc/name.conf

Listen-on port 53 {any;}; # # sets the open port. Any says it's open to all interface.

Allow-query {any;}; # # answer everyone's questions

Forwarders {172.25.254.250;}

Dnssec-validation no

Systemctl restart named

# forward resolution # #

# # forward resolution is to resolve domain names to ip

Vim / etc/name.conf

# # Delete forwarders {172.25.254.250;}

Vim / etc/named.rfc1912.zones # # enter the configuration file

Zone "westos.com" IN {

Type master

File "westos.com.zone"

Allow-update {none;}

}

Cd / var/named/

Cp-p named.localhost westos.com.zone # # copy with permission

Vim westos.com.zone

$TTL 1D

@ IN SOA dns.westos.com. Root.westos.com. (

0; serial

1D; refresh

1H; retry

1W; expire

3H); minimum

NS dns.westos.com.

Dns A 172.25.254.109

Www A 172.25.254.251

~

# # @ means that if zone is not added. Indicates that the domain name is automatically supplemented.

Systemctl restart named # # restart the service

# reverse resolution # #

Vim / etc/named.rfc1912.zones

Zone "254.25.172.in-addr.arpa" IN {

Type master

File "westos.com.ptr"

Allow-update {none;}

}

Cd / var/named/

Cp-p named.loopback westos.com.ptr

Vim westos.com.ptr

$TTL 1D

@ IN SOA dns.westos.com. Root.westos.com. (

0; serial

1D; refresh

1H; retry

1W; expire

3H); minimum

NS dns.westos.com.

A 172.25.254.109

109 PTR www.westos.com.

110 PTR www.hello.com.

~

# Bidirectional parsing #

Cd / var/named

Cp-p westos.com.zone westos.com.inter # # add permission to copy files

Vim westos.com.inter # # Edit public network configuration file

$TTL 1D

@ IN SOA dns.westos.com. Root.westos.com. (

0; serial

1D; refresh

1H; retry

1W; expire

3H); minimum

NS dns.westos.com.

Dns A 172.25.0.109

Www A 172.25.0.251

Www A 172.25.0.252

Bbs CNAME www.westos.com.

Westos.com. MX 1 172.25.0.109

~ # # change all network segments to 0 network segments

Cp-p / etc/named.rfc1912.zones / etc/named.rfc1912.zones.inter

Vim / etc/named.rfc1912.zones.inter

Zone "westos.com" IN {

Type master

File "westos.com.inter"

Allow-update {none;}

}

Vim / etc/named.conf # # Edit the main configuration file

/ *

Zone "." IN {

Type hint

File "named.ca"

}

Include "/ etc/named.rfc1912.zones"

Include "/ etc/named.root.key"

* / # # Log out

View localnet {

Match-clients {172.25.254.109;}

Zone "." IN {

Type hint

File "named.ca"

}

Include "/ etc/named.rfc1912.zones"

}; # # add a private network client (you can man 5 named.conf)

View internet {

Match-clients {any;}

Zone "." IN {

Type hint

File "named.ca"

}

Include "/ etc/named.rfc1912.zones.inter"

}; # # add a public network client

Systemctl restart named # # restart the service

Tags: Service file configuration open domain name customer client permission port network segment two-way that is everyone environment network network service first fixed permanent Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB Microsoft Linux Shulou Information