linux下安裝dns域名解析伺服器
linux下安裝dns域名解析伺服器
系統:Red Hat Enterprise Linux 8.2
1、基本安裝
[root@localhost /]# dnf install bind-chroot bind bind-utils bind-libs bind-devel -y
2、拷貝sample檔案
[root@localhost /]# cp -rf /usr/share/doc/bind/sample/* /var/named/
3、建立相關檔案
[root@localhost etc]# touch /var/named/chroot/var/named/data/cache_dump.db
[root@localhost etc]# touch /var/named/chroot/var/named/data/named_stats.txt
[root@localhost etc]# touch /var/named/chroot/var/named/data/named_mem_stats.txt
[root@localhost etc]# touch /var/named/chroot/var/named/data/named.run
[root@localhost etc]# mkdir /var/named/chroot/var/named/dynamic
[root@localhost etc]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind
4、相關檔案許可權
[root@localhost etc]# chmod -R 777 /var/named/chroot/var/named/data
[root@localhost etc]# chmod -R 777 /var/named/chroot/var/named/dynamic
5、修改主配置檔案
[root@localhost etc]# vim /var/named/chroot/etc/named.conf
options
{
directory "/var/named"; // "Working" directory
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
secroots-file "data/named.secroots";
recursing-file "data/named.recursing";
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
allow-query { any; };
allow-query-cache { localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
managed-keys-directory "/var/named/dynamic";
include "/etc/crypto-policies/back-ends/bind.config";
};
zone "mufeng.com" IN {
type master;
file "mufeng.com";
};
zone "35.35.192.in-addr.arpa"{
type master;
file "192.arpa.zone";
};
6、修改區域配置檔案
[root@localhost named]# cp named.localhost ygx.com
[root@localhost named]# vim mufeng.com
$TTL 1D
@ IN SOA mufeng.com. admin.mufeng.com. (
2020 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS ns.mufeng.com.
IN A 192.35.35.1
ns IN A 192.35.35.1
www IN A 192.35.35.1
[root@localhost named]# cp mufeng.com 192.arpa.zone
[root@localhost named]# vim 192.arpa.zone
$TTL 1D
@ IN SOA mufeng.com. admin.mufeng.com. (
2020 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS ns.mufeng.com.
1 IN PTR ns.mufeng.com.
1 IN PTR www.mufeng.com.
[root@localhost named]# pwd
/var/named/chroot/var/named
7、防火牆以及selinux配置
[root@localhost named]# firewall-cmd --add-port=53/tcp --permanent
success
[root@localhost named]# firewall-cmd --add-service=dns --permanent
success
[root@localhost named]# firewall-cmd --reload
success
[root@localhost named]# getsebool -a | grep named
named_tcp_bind_http_port --> off
named_write_master_zones --> on
[root@localhost named]# setsebool named_tcp_bind_http_port on
[root@localhost named]# getsebool -a | grep named
named_tcp_bind_http_port --> on
named_write_master_zones --> on
8、開機自動啟動bind-chroot
[root@localhost named]# /usr/libexec/setup-named-chroot.sh /var/named/chroot on
[root@localhost named]# systemctl disable named
[root@localhost named]# systemctl start named-chroot
[root@localhost named]# systemctl enable named-chroot
Created symlink /etc/systemd/system/multi-user.target.wants/named-chroot.service → /usr/lib/systemd/system/named-chroot.service.
9、驗證dns伺服器是否安裝成功
9.1 開啟bind-chroot服務
[root@localhost named]# systemctl start named-chroot
9.2 修改域名解析檔案
[root@localhost named]# vim /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 192.35.35.1
9.3 驗證是否配置成功
[root@localhost named]# nslookup www.mufeng.com
Server: 192.35.35.1
Address: 192.35.35.1#53
Name: www.mufeng.com
Address: 192.35.35.1
[root@localhost named]# nslookup 192.35.35.1
1.35.35.192.in-addr.arpa name = www.mufeng.com.
1.35.35.192.in-addr.arpa name = ns.mufeng.com.
相關文章
- Linux——DNS域名解析服務LinuxDNS
- Linux---DNS域名解析如何配置LinuxDNS
- 主從DNS域名解析伺服器DNS伺服器
- linux apache泛域名解析及dns相關LinuxApacheDNS
- DNS域名解析DNS
- ubuntu18.04安裝dns伺服器UbuntuDNS伺服器
- Linux系統下安裝Apache伺服器LinuxApache伺服器
- 第3步: 域名解析伺服器的過程(DNS)伺服器DNS
- linux下安裝snap安裝工具Linux
- 伺服器安裝Linux中安裝 Apache伺服器LinuxApache
- DNS域名解析服務DNS
- Linux下編譯安裝nginx1.8.1伺服器Linux編譯Nginx伺服器
- linux 下安裝 jdkLinuxJDK
- linux下安裝dockerLinuxDocker
- linux下nginx安裝LinuxNginx
- Linux下安裝OpenCVLinuxOpenCV
- Linux下安裝nginxLinuxNginx
- linux下安裝elasticsearchLinuxElasticsearch
- Linux 下安裝 RedisLinuxRedis
- Linux下安裝RedisLinuxRedis
- InfluxDB Linux 下安裝Linux
- mysql linux下安裝MySqlLinux
- Linux下安裝RabbitMQLinuxMQ
- Linux下安裝pymysqlLinuxMySql
- Linux下安裝jiebaLinuxJieba
- Linux下安裝GensimLinux
- Linux下SuperLU安裝Linux
- Linux下安裝GitLinuxGit
- linux下安裝pythonLinuxPython
- Linux 下安裝 ComposerLinux
- Linux下expect安裝Linux
- linux伺服器安裝字型Linux伺服器
- Linux伺服器---安裝apacheLinux伺服器Apache
- Linux伺服器—安裝bindLinux伺服器
- Linux伺服器---安裝bindLinux伺服器
- Linux伺服器—安裝mysqlLinux伺服器MySql
- Linux伺服器---安裝mysqlLinux伺服器MySql
- Linux伺服器—安裝TomcatLinux伺服器Tomcat