Linux伺服器—安裝bind
安裝bind
1、安裝bind軟體,需要安裝3 個bind、bind-chroot、bind-util
[root@localhost pub]# yum install -y bind bind-chroot bind-utils
Installed:
bind.i686 32:9.8.2-0.17.rc1.el6_4.6
Complete!
2、修改配置檔案“/etc/named.conf”,追加“forward”
[root@localhost pub]# gedit /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; };
# listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;
allow-query { localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;
managed-keys-directory “/var/named/dynamic”;
forward only;
forwarders{
8.8.8.8;
}
};
3、設定防火牆,這裡需要用到53埠。需要開啟tcp和udp的53埠,記得重啟防火牆
[root@localhost pub]# gedit /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 53 -j ACCEPT
-A INPUT -m state –state NEW -m udp -p udp –dport 53 -j ACCEPT
[root@localhost phpMyAdmin]# service iptables restart
iptables:將鏈設定為政策 ACCEPT:filter nat [確定]
iptables:清除防火牆規則: [確定]
iptables:正在解除安裝模組: [確定]
iptables:應用防火牆規則: [確定]
iptables:載入額外模組:nf_conntrack_ftp [確定]
[root@localhost phpMyAdmin]#
4、啟動服務
[root@localhost pub]# service named start
啟動 named: [確定]
[root@localhost pub]#
5、測試,命令格式“dig 網站 @ip”,這裡用迴環地址來測試,看是否能請求成功
[root@localhost pub]# dig www.baidu.com @127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> www.baidu.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51491
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 1191 IN CNAME www.a.shifen.com.
www.a.shifen.com. 299 IN A 14.215.177.38 //這個就是請求到的結果
www.a.shifen.com. 299 IN A 14.215.177.39
;; Query time: 3053 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Aug 14 19:02:59 2018
;; MSG SIZE rcvd: 90
6、更改配置檔案named.conf,讓所有機器都可以使用該服務。
1)將配置檔案中的迴環地址改為any,意味著允許任何人使用
[root@localhost pub]# gedit /etc/named.conf
options {
listen-on port 53 {any; };
# listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;
managed-keys-directory “/var/named/dynamic”;
forward only;
forwarders{
8.8.8.8;
}
};
2)找一個其他ip地址來測試
[root@localhost pub]# service named restart //重啟服務
停止 named: [確定]
啟動 named: [確定]
[root@localhost pub]# dig www.baidu.com @192.168.0.113
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> www.baidu.com @192.168.0.113
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37134
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 871 IN CNAME www.a.shifen.com.
www.a.shifen.com. 299 IN A 14.215.177.39
www.a.shifen.com. 299 IN A 14.215.177.38
;; Query time: 474 msec
;; SERVER: 192.168.0.113#53(192.168.0.113)
;; WHEN: Tue Aug 14 19:06:19 2018
;; MSG SIZE rcvd: 90
1、安裝bind軟體,需要安裝3 個bind、bind-chroot、bind-util
[root@localhost pub]# yum install -y bind bind-chroot bind-utils
Installed:
bind.i686 32:9.8.2-0.17.rc1.el6_4.6
Complete!
2、修改配置檔案“/etc/named.conf”,追加“forward”
[root@localhost pub]# gedit /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; };
# listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;
allow-query { localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;
managed-keys-directory “/var/named/dynamic”;
forward only;
forwarders{
8.8.8.8;
}
};
3、設定防火牆,這裡需要用到53埠。需要開啟tcp和udp的53埠,記得重啟防火牆
[root@localhost pub]# gedit /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 53 -j ACCEPT
-A INPUT -m state –state NEW -m udp -p udp –dport 53 -j ACCEPT
[root@localhost phpMyAdmin]# service iptables restart
iptables:將鏈設定為政策 ACCEPT:filter nat [確定]
iptables:清除防火牆規則: [確定]
iptables:正在解除安裝模組: [確定]
iptables:應用防火牆規則: [確定]
iptables:載入額外模組:nf_conntrack_ftp [確定]
[root@localhost phpMyAdmin]#
4、啟動服務
[root@localhost pub]# service named start
啟動 named: [確定]
[root@localhost pub]#
5、測試,命令格式“dig 網站 @ip”,這裡用迴環地址來測試,看是否能請求成功
[root@localhost pub]# dig www.baidu.com @127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> www.baidu.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51491
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 1191 IN CNAME www.a.shifen.com.
www.a.shifen.com. 299 IN A 14.215.177.38 //這個就是請求到的結果
www.a.shifen.com. 299 IN A 14.215.177.39
;; Query time: 3053 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Aug 14 19:02:59 2018
;; MSG SIZE rcvd: 90
6、更改配置檔案named.conf,讓所有機器都可以使用該服務。
1)將配置檔案中的迴環地址改為any,意味著允許任何人使用
[root@localhost pub]# gedit /etc/named.conf
options {
listen-on port 53 {any; };
# listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;
managed-keys-directory “/var/named/dynamic”;
forward only;
forwarders{
8.8.8.8;
}
};
2)找一個其他ip地址來測試
[root@localhost pub]# service named restart //重啟服務
停止 named: [確定]
啟動 named: [確定]
[root@localhost pub]# dig www.baidu.com @192.168.0.113
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> www.baidu.com @192.168.0.113
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37134
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 871 IN CNAME www.a.shifen.com.
www.a.shifen.com. 299 IN A 14.215.177.39
www.a.shifen.com. 299 IN A 14.215.177.38
;; Query time: 474 msec
;; SERVER: 192.168.0.113#53(192.168.0.113)
;; WHEN: Tue Aug 14 19:06:19 2018
;; MSG SIZE rcvd: 90
相關文章
- Linux伺服器---安裝bindLinux伺服器
- linux伺服器—配置bindLinux伺服器
- Linux伺服器---配置bindLinux伺服器
- 伺服器安裝Linux中安裝 Apache伺服器LinuxApache
- Linux伺服器---安裝apacheLinux伺服器Apache
- Linux伺服器—安裝mysqlLinux伺服器MySql
- Linux伺服器---安裝mysqlLinux伺服器MySql
- Linux伺服器—安裝TomcatLinux伺服器Tomcat
- Linux伺服器---安裝swatLinux伺服器
- Linux伺服器---安裝sambaLinux伺服器Samba
- Linux伺服器---安裝squidLinux伺服器UI
- Linux伺服器---安裝vsftpdLinux伺服器FTP
- Linux伺服器---安裝jdkLinux伺服器JDK
- linux伺服器安裝nginxLinux伺服器Nginx
- Linux伺服器---安裝nfsLinux伺服器NFS
- linux 伺服器安裝 nginxLinux伺服器Nginx
- Linux伺服器—安裝telnetLinux伺服器
- Linux伺服器---安裝telnetLinux伺服器
- linux伺服器安裝字型Linux伺服器
- DNS解析服務(bind)安裝DNS
- linux伺服器安裝jdk步驟Linux伺服器JDK
- linux雲伺服器如何安裝mysql?Linux伺服器MySql
- Linux伺服器---郵件伺服器openwebmail安裝Linux伺服器WebAI
- Linux系統下安裝Apache伺服器LinuxApache伺服器
- Ubuntu Linux 伺服器和桌面的安裝!UbuntuLinux伺服器
- Linux伺服器配置——安裝CentOS以及源配置Linux伺服器CentOS
- 在linux centos伺服器上安裝telnet命令LinuxCentOS伺服器
- linux伺服器如何安裝寶塔皮膚Linux伺服器
- Linux伺服器---郵件服務postfix安裝Linux伺服器
- 雲伺服器linux centos安裝圖形介面伺服器LinuxCentOS
- linux下安裝dns域名解析伺服器LinuxDNS伺服器
- 【linux運維】Linux伺服器玩轉vsftpd安裝與配置Linux運維伺服器FTP
- linux中安裝JDK linux中安裝Tomcat linux中安裝Mysql 及故障解析 linux系統安裝redisLinuxJDKTomcatMySqlRedis
- Linux安裝解除安裝MySQLLinuxMySql
- linux 安裝yum 安裝phpLinuxPHP
- Linux伺服器配置——安裝配置JDK1 7Linux伺服器JDK
- 雲伺服器安裝Ubuntu和Linux的區別伺服器UbuntuLinux
- Linux下編譯安裝nginx1.8.1伺服器Linux編譯Nginx伺服器