vps 之外的名称服务器

vps 之外的名称服务器

我使用 bind9 创建了 dns 服务器,服务器内部一切正常。我可以 ping 我的域,也可以挖掘它。但在我的 vps 之外,域名称没有名称服务器。

我用这个命令

dig @89.42.210.210 fdoc.ir

服务器内部 dig 命令输出

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @89.42.210.210 fdoc.ir
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4257
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;fdoc.ir.           IN  A

;; ANSWER SECTION:
fdoc.ir.        10800   IN  A   89.42.210.210

;; AUTHORITY SECTION:
fdoc.ir.        10800   IN  NS  ns2.fdoc.ir.
fdoc.ir.        10800   IN  NS  ns1.fdoc.ir.

;; ADDITIONAL SECTION:
ns1.fdoc.ir.        10800   IN  A   89.42.210.210
ns2.fdoc.ir.        10800   IN  A   89.42.210.210

;; Query time: 0 msec
;; SERVER: 89.42.210.210#53(89.42.210.210)
;; WHEN: Thu Feb 22 16:03:36 EST 2018
;; MSG SIZE  rcvd: 120

dig 命令在服务器外部输出

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @89.42.210.210 fdoc.ir
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 48479
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;fdoc.ir.           IN  A

;; Query time: 180 msec
;; SERVER: 89.42.210.210#53(89.42.210.210)
;; WHEN: Fri Feb 23 00:33:22 +0330 2018
;; MSG SIZE  rcvd: 36

nginx 配置

# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80;
    listen [::]:80;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/fdoc.ir/html/public;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name fdoc.ir www.fdoc.ir;


        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
            fastcgi_pass unix:/run/php/php7.1-fpm.sock;
            include snippets/fastcgi-php.conf;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

        location ~ /\.ht {
                deny all;
        }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #   include snippets/fastcgi-php.conf;
    #
    #   # With php7.0-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php7.0-fpm:
    #   fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

/etc/hosts

127.0.0.1   localhost
127.0.1.1   ubuntu 
89.42.210.210 fdoc.ir www.fdoc.ir

答案1

可能有两个罪犯。

首先检查绑定服务器是否正在监听外部 IP 或任何 IP(0.0.0.0),/etc/bind/named.conf.options例如

listen-on port 53 { any; }

第二个也是更可能的事情是检查你的 iptables 规则,以便它们允许 UDP 流量进入端口 53。如果你运行iptables -L -n它,应该会有类似

Chain INPUT (policy DROP)
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53

如果没有,您可以通过以 root 身份执行来临时添加这样的规则

iptables -I INPUT -p udp --dport 53 -j ACCEPT

当然,您的服务器和互联网之间的任何其他防火墙也可能阻止流量。

答案2

谢谢你的帮助,但问题解决了,这是问题

/etc/named.conf.local 
//include "/etc/bind/zones.rfc1918";

并且只需取消注释上面的行,一切就可以正常工作。

相关内容