我在域控制面板中将名称服务器设置为ns1.mydomain.com
& 。我使用以下内容配置我的 Linux 服务器:ns2.mydomain.com
/etc/bind$ cat named.conf.local
zone "mydomain.com" {
type master;
file "/etc/bind/mydomain.com.db";
}
这是我的域配置(mydomain.com.db 文件):
/etc/bind$ cat mydomain.com.db
;
; BIND data file for mydomain.com
;
$TTL 3h
@ IN SOA ns1.mydomain.com. email.mydomain.com. (
1 ; Serial
3h ; Refresh after 3 hours
1h ; Retry after 1 hour
1w ; Expire after 1 week
1h ) ; Negative caching TTL of 1 day
;
@ IN NS ns1.mydomain.com.
@ IN NS ns2.mydomain.com.
mydomain.com. IN MX 10 mail.mydomain.com.
mydomain.com. IN A my_valid_server_ip_here
ns1 IN A my_valid_server_ip_here
ns2 IN A my_valid_server_ip_here
www IN CNAME mydomain.com.
mail IN A my_valid_server_ip_here
ftp IN CNAME mydomain.com.
; Subdomains
beta IN A my_valid_server_ip_here
api IN A my_valid_server_ip_here
这是 dig 命令的结果
dig @my_valid_server_ip_here mydomain.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @1my_valid_server_ip_here mydomain.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
我应该再等一会儿还是我的配置错误?
----更新
这是我的 ufw 的结果:
To Action From
-- ------ ----
22 ALLOW Anywhere
80/tcp ALLOW Anywhere
5432/tcp ALLOW Anywhere
53 ALLOW OUT Anywhere
-------更新:更新规则,因此新的 ufw 状态为
Status: active
Logging: on (low)
Default: reject (incoming), allow (outgoing)
New profiles: skip
To Action From
-- ------ ----
22 ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
5432/tcp ALLOW IN Anywhere
53 ALLOW IN Anywhere
问题存在,但 dig 也无法解决并抛出同样的错误!
答案1
超级疯狂的错误!! 没有人监听端口 53,绑定服务没有运行。因此运行此命令后:
sudo named -g -p 53
我得到了这个结果:
11-Oct-2016 11:09:25.010 BIND 9 is maintained by Internet Systems Consortium,
11-Oct-2016 11:09:25.010 Inc. (ISC), a non-profit 501(c)(3) public-benefit
11-Oct-2016 11:09:25.010 corporation. Support and training for BIND 9 are
11-Oct-2016 11:09:25.010 available at https://www.isc.org/support
11-Oct-2016 11:09:25.010 ----------------------------------------------------
11-Oct-2016 11:09:25.010 adjusted limit on open files from 65536 to 1048576
11-Oct-2016 11:09:25.010 found 1 CPU, using 1 worker thread
11-Oct-2016 11:09:25.010 using 1 UDP listener per interface
11-Oct-2016 11:09:25.010 using up to 4096 sockets
11-Oct-2016 11:09:25.012 loading configuration from '/etc/bind/named.conf'
11-Oct-2016 11:09:25.013 /etc/bind/named.conf:11: missing ';' before 'include'
11-Oct-2016 11:09:25.013 loading configuration: failure
11-Oct-2016 11:09:25.013 exiting (due to fatal error)
发生了“超级疯狂的错误”!!我忘记在区域配置文件中输入分号,所以绑定服务甚至无法运行。
zone "mydomain.com" {
type master;
file "/etc/bind/mydomain.com.db";
};
正确配置并重新启动bind9
服务后,这是 openports 的 netstat 输出:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 551/sshd
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 3489/named
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 619/nginx -g daemon
tcp 0 0 172.17.0.1:53 0.0.0.0:* LISTEN 3489/named
tcp 0 0 130.185.74.136:53 0.0.0.0:* LISTEN 3489/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 3489/named
tcp6 0 0 :::22 :::* LISTEN 551/sshd
tcp6 0 0 ::1:953 :::* LISTEN 3489/named
tcp6 0 0 :::80 :::* LISTEN 619/nginx -g daemon
tcp6 0 0 :::53 :::* LISTEN 3489/named
udp 0 0 172.17.0.1:53 0.0.0.0:* 3489/named
udp 0 0 130.185.74.136:53 0.0.0.0:* 3489/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 3489/named
udp6 0 0 :::53 :::* 3489/named
我不知道为什么使用时没有出现任何错误service start
!