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.
相關文章
- DNS (域名解析伺服器), DNS子域授權DNS伺服器
- 主從DNS域名解析伺服器DNS伺服器
- Linux——DNS域名解析服務LinuxDNS
- Linux DNS 伺服器安裝、配置和維護LinuxDNS伺服器
- Linux---DNS域名解析如何配置LinuxDNS
- DNS域名解析DNS
- Linux下安裝nfs伺服器LinuxNFS伺服器
- Linux下安裝、配置Apache伺服器LinuxApache伺服器
- linux apache泛域名解析及dns相關LinuxApacheDNS
- 第3步: 域名解析伺服器的過程(DNS)伺服器DNS
- DNS域名解析過程DNS
- DNS域名解析服務DNS
- Linux系統下安裝Apache伺服器LinuxApache伺服器
- AIX 6.1下改變域名解析順序(DNS, LOCAL)AIDNS
- ubuntu18.04安裝dns伺服器UbuntuDNS伺服器
- Orace RAC安裝-DNS安裝DNS
- 什麼是DNS域名解析DNS
- Linux 下安裝Samba 檔案共享伺服器LinuxSamba伺服器
- 伺服器安裝Linux中安裝 Apache伺服器LinuxApache
- Linux下安裝、解除安裝mysqlLinuxMySql
- linux下安裝snap安裝工具Linux
- Linux下編譯安裝nginx1.8.1伺服器Linux編譯Nginx伺服器
- DNS域名解析服務及其配置DNS
- Linux下DNS簡單部署(主從域名伺服器)LinuxDNS伺服器
- 必看:詳解DNS域名解析:重新整理本地DNS快取,使域名解析儘快生效DNS快取
- Linux的DNS域名解析服務(正向,反向,主從,分離)LinuxDNS
- Linux下JDK安裝與解除安裝LinuxJDK
- Linux伺服器下 php7安裝redis的方法Linux伺服器PHPRedis
- Linux下安裝DockerLinuxDocker
- Linux下安裝RedisLinuxRedis
- mysql linux下安裝MySqlLinux
- Linux 下安裝 RedisLinuxRedis
- Linux下安裝GitLinuxGit
- Linux下安裝pymysqlLinuxMySql
- Linux下安裝jiebaLinuxJieba
- Linux下安裝GensimLinux
- Linux下SuperLU安裝Linux
- Linux下安裝RabbitMQLinuxMQ