【问题标题】:Linking Domain Name to Server [closed]将域名链接到服务器[关闭]
【发布时间】:2013-04-16 18:57:08
【问题描述】:

因此,我第一次深入研究了在没有控制面板的情况下运行服务器的世界,通过终端执行所有操作,并在需要时偶尔登录桌面 gui。

据我所知,我几乎所有东西都在工作,防火墙很麻烦,但我想我现在已经搞定了。

最后一件我不知道的事情是如何让我购买的域名正确指向我的服务器(我一直通过控制面板完成此操作,之前大部分操作都是自动化的)。

这些是我到目前为止所采取的步骤(这些可能是错误的,我一直在疯狂地谷歌搜索,但到处都告诉我做一些不同的事情,所以如果有问题,请告诉我)。

  • 购买的名称名称,例如“mydomain.com”
  • 让服务器运行 Ubuntu 64 位。 IP 地址,例如“1.2.3.4”
  • 主机为我提供了 3 个“DNS 解析器”,例如:“1.1.1.1”、“1.1.1.2”、“1.1.1.3”

  • 我已经在我的服务器上设置了主机名

  • 在终端输出中运行“主机名”:mydomain
  • 检查 /etc/hostname 输出:mydomain.com

  • 我已将这 3 个 DNS 解析器添加到我的 /etc/resolv.conf 文件中,如下所示:

    domain mydomain.com
    search mydomain.com
    nameserver 1.1.1.1
    nameserver 1.1.1.2
    nameserver 1.1.1.3
    
  • 我已经在我的 httpd.conf 文件中设置了虚拟主机:

    <VirtualHost 1.2.3.4:80>
    ServerName mydomain.com
    ServerAlias mydomain
    DocumentRoot /var/www/mysite
    </VirtualHost>
    

从现在开始,我一直在玩各种不同的东西。目前我已经进入我的域名注册面板并将三个域名服务器设置为“ns1.mydomain.com”、“ns2.mydomain.com”、“ns3.mydomain.com”。

我已经安装了 webmin 来尝试设置 DNS 区域记录,这就是我目前在各种命令的输出中得到的结果:

(其中 1.1.1.1、1.1.1.2、1.1.1.3 是那些 DNS 解析器)

[b]nslookup -sil 本地主机[/b]

conn@duckfusion:~$ nslookup -sil localhost
;; Got SERVFAIL reply from 1.1.1.2, trying next server
;; Got SERVFAIL reply from 1.1.1.3, trying next server
;; connection timed out; no servers could be reached

[b]nslookup -sil mydomain.com[/b]

conn@duckfusion:~$ nslookup -sil mydomain.com
;; Got SERVFAIL reply from 1.1.1.2, trying next server
;; Got SERVFAIL reply from 1.1.1.3, trying next server
;; connection timed out; no servers could be reached

这是我的“named.conf”文件:

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

[u]named.conf.options[/u]

options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

         forwarders {
                1.1.1.1; 1.1.1.2; 1.1.1.3; 208.67.222.222; 208.67.220.220;
         };

        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================
        dnssec-validation auto;

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
        allow-query {
                any;
                };
        listen-on port 53 {
                any;
                };
};

[u]named.conf.local[/u]

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "mydomain.com" {
        type master;
        file "/var/lib/bind/mydomain.com.hosts";
        };

[u]/var/lib/bind/mydomain.com.hosts[/u](其中 1.2.3.4 是我服务器的 IP)

$ttl 38400
mydomain.com. IN      SOA     mydomain.com. me.myemail.com. (
                        1366054515
                        10800
                        3600
                        604800
                        38400 )
mydomain.com. IN      NS      mydomain.com.
mydomain.com. IN      A       1.2.3.4
www.mydomain.com.     IN      A       1.2.3.4
mail.mydomain.com.    IN      A       1.2.3.4
ftp.mydomain.com.     IN      A       1.2.3.4
ns1.mydomain.com.     IN      A       1.2.3.4
ns2.mydomain.com.     IN      A       1.2.3.4
ns3.mydomain.com.     IN      A       1.2.3.4
mydomain.com. IN      NS      ns1.mydomain.com.
mydomain.com. IN      NS      ns2.mydomain.com.
mydomain.com. IN      NS      ns3.mydomain.com.
mydomain.com. IN      MX      10 mail.mydomain.com.

这就是我所知道的。

我显然可以通过 IP 地址作为 URL 访问服务器,但目前还不能通过域名。

谁能告诉我:

A) 我哪里出错了 B) 我需要做什么才能实现这一目标?

非常感谢。

【问题讨论】:

标签: linux ubuntu dns named


【解决方案1】:

运行您自己的命名是多余的,不需要。有效设置如下所示:

  1. 您的 Web 服务器托管服务提供商(您的网站所在的位置)为您提供了一些 DNS 解析器。这些旨在为您的 Web 服务器提供 DNS 解析,以便它可以找到 Internet 上的其他主机。这些解析器与托管您的域无关,您无法更改它们的域定义。
  2. 您的 DNS 托管服务提供商拥有自己的 DNS 服务器,默认情况下使用这些服务器托管您的 DNS“A”记录。如果您确实重新配置了 DNS 托管帐户以使用 Web 提供商的 DNS 服务器,那么这是一个错误。您无法将 DNS 记录添加到这些服务器。
  3. 在您的 DNS 托管服务提供商的控制面板上,首先将其设置回使用他们的 DNS 服务器;然后为您的域创建一个“A”记录,指向您的网络服务器主机的 IP。

总结:

DNS Hosting Provider
    DNS Server(s) contain:
        www.yourserver.com      A     1.2.3.4
        alias.yourserver.com    CNAME www.yourserver.com (maybe)
        yourserver.com          MX    where.you.receive.mail (maybe)

Web Hosting Provider
    Your web server at 1.2.3.4
        /etc/resolv.conf
            nameserver 1.1.1.1
            nameserver 1.1.1.2
            nameserver 1.1.1.3

这就是其他人能够找到您的服务器所需要做的一切。

运行您自己的 DNS 的唯一原因是托管由多台计算机组成的整个网络,在防火墙后面,或者托管整个 C 类或更多 IP 地址集。为此,您需要与其他提供商达成对等和路由协议,我认为您没有。

编辑

$ dig duckfusion.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> duckfusion.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32080
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 17

;; QUESTION SECTION:
;duckfusion.com.                        IN      A

;; ANSWER SECTION:
duckfusion.com.         1800    IN      A       87.117.219.53
duckfusion.com.         1800    IN      A       192.31.186.140

;; AUTHORITY SECTION:
duckfusion.com.         172800  IN      NS      dns4.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns5.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns3.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns1.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns2.registrar-servers.com.

【讨论】:

  • 嗨,好的,这就是我到目前为止所得到的: - 域名已在 namecheap 注册 - 在域名控制面板中,我已将 DNS 设置为 namecheap 的 DNS 服务器 - 我已创建 A 记录在控制面板中将该域名指向我的 Web 服务器的 IP 地址:@ 1.2.3.4 A www 1.2.3.4 A 这是否可以在无需执行任何其他操作的情况下工作?因为我这样做已经有一段时间了,而且还没有解决。我知道它说最多可能需要 72 小时,但根据我的经验,这些事情通常很快......干杯。
  • 发布真实的主机名和 IP 地址。无论如何,这是公共信息,可以让我们检查可见性。另外,关闭服务器上的命名。
  • 域名:duckfusion.com ----- IP:87.117.219.53
  • 为我解决,但我得到两个不同的地址:192.31.186.14087.117.219.53。有关完整的dig 输出,请参阅我编辑的答案。
  • 另外,www.duckfusion.com 仅解析为 87.117.219.53
猜你喜欢
  • 1970-01-01
  • 2016-07-11
  • 2021-09-21
  • 2013-05-14
  • 2015-12-04
  • 1970-01-01
  • 1970-01-01
  • 2021-07-23
  • 2021-09-26
相关资源
最近更新 更多