我正在build立一对专用服务器,并且在设置我的域名服务器时遇到问题。 其中一个是LEMP服务器(用nginx代替Apache的LAMP),另一个将仅作为电子邮件服务器运行,运行exim / dovecot / ASSP反垃圾邮件(无Apache)。 LEMP服务器是CentOS 5.5,没有控制面板,而电子邮件服务器是CentOS 5.5,cPanel / WHM。
所以,我有问题让DNS正确设置。 我有两个域,每个域指向这些服务器之一。 名称服务器与域名注册机构正确注册,名称服务器IP也正确input。 我已经在注册服务机构向技术支持部门发表过演讲,他们确认一切都是在他们的最后。 不知道多less关于DNS,我search域名服务器和DNS,直到我几乎失明,花了几个小时搞乱configuration。
最后,我得到了LEMP服务器的DNS正常工作(没有cPanel)。 满意这个胜利,我试图模仿这种configuration,并重复使用电子邮件服务器的过程,这只是没有发生。 名称服务器启动和停止,但域不能parsing。
我已经尝试过的东西
通过标准程序在WHM中设置DNS清除所有DNS信息,卸载BIND,然后重新安装所有这些,并再次通过WHM程序设置DNS清除所有DNS信息,并通过shell(完全在cPanel之外)设置BIND,通过使用我的LEMP服务器的configuration和区域文件作为模板
命名运行就好,但没有任何解决。 当我“挖掘任何example.com”我得到一个SERVFAIL消息。 Nslookups不会返回任何信息。
这是我的configuration和区域文件。
named.conf中
controls { inet 127.0.0.1 allow { localhost; } keys { coretext-key; }; }; 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"; // Those options should be used carefully because they disable port // randomization // query-source port 53; // query-source-v6 port 53; allow-query { any; }; allow-query-cache { any; }; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; view "localhost_resolver" { match-clients { 127.0.0.0/24; }; match-destinations { localhost; }; recursion yes; //zone "." IN { // type hint; // file "/var/named/named.ca"; //}; include "/etc/named.rfc1912.zones"; }; view "internal" { /* This view will contain zones you want to serve only to "internal" clients that connect via your directly attached LAN interfaces - "localnets" . */ match-clients { localnets; }; match-destinations { localnets; }; recursion yes; zone "." IN { type hint; file "/var/named/named.ca"; }; // include "/var/named/named.rfc1912.zones"; // you should not serve your rfc1912 names to non-localhost clients. // These are your "authoritative" internal zones, and would probably // also be included in the "localhost_resolver" view above : zone "example.com" { type master; file "data/db.example.com"; }; zone "3.2.1.in-addr.arpa" { type master; file "data/db.1.2.3"; }; }; view "external" { /* This view will contain zones you want to serve only to "external" clients * that have addresses that are not on your directly attached LAN interface subnets: */ match-clients { any; }; match-destinations { any; }; recursion no; // you'd probably want to deny recursion to external clients, so you don't // end up providing free DNS service to all takers allow-query-cache { none; }; // Disable lookups for any cached data and root hints // all views must contain the root hints zone: //include "/etc/named.rfc1912.zones"; zone "." IN { type hint; file "/var/named/named.ca"; }; zone "example.com" { type master; file "data/db.example.com"; }; zone "3.2.1.in-addr.arpa" { type master; file "data/db.1.2.3"; }; }; include "/etc/rndc.key";
db.example.com
$TTL 1D ; ; Zone file for example.com ; ; Mandatory minimum for a working domain ; @ IN SOA ns1.example.com. contact.example.com. ( 2011042905 ; serial 8H ; refresh 2H ; retry 4W ; expire 1D ; default_ttl ) NS ns1.example.com. NS ns2.example.com. ns1 A 1.2.3.4 ns2 A 1.2.3.5 example.com. A 1.2.3.4 localhost A 127.0.0.1 www CNAME example.com. mail CNAME example.com. ;
db.1.2.3
$TTL 1D $ORIGIN 3.2.1.in-addr.arpa. @ IN SOA ns1.example.com contact.example.com. ( 2011042908 ; 8H ; 2H ; 4W ; 1D ; ) NS ns1.example.com. NS ns2.example.com. 4 PTR hostname.example.com. 5 PTR hostname.example.com. ;
还值得注意的是:这两个服务器都被pipe理。 技术支持非常敏感,而且很大程度上是无用的。 几个小时和他们一起问我问题来缩小什么是错的,然后他们把票交给下一class的技术人员,他们忽略了已经发生的一切,花了他的整个class次问最后一个人问的所有相同的问题。
总之:
任何帮助将是伟大的。 我将文件中的域和IP更改为generics,但是如果您需要了解相关域,请告诉我。
谢谢!
UPDATE
我发现我在/etc/resolv.conf中没有127.0.0.1,所以我添加了它,以及我已经命名监听的两个公有IP。
的resolv.conf
search www.example.com example.com nameserver 127.0.0.1 nameserver 7.8.9.10 ;Was in here by default, authoritative nameserver of hosting company nameserver 1.2.3.4 ;Public IP #1 nameserver 1.2.3.5 ;Public IP #2
现在,当我从主机DIG.com.com,它解决。 如果我尝试从我的其他服务器(在同一个数据中心),或从互联网,DIG超时或我SERVFAIL。
我将开始validation,您的服务器运行:
netstat -an | grep ^udp | grep 53
它应该显示一个类似的行
udp 0 0 0.0.0.0:53 0.0.0.0:*
如果named没有运行,那么停止它(只是为了清理),然后启动并查看它写入日志文件(/ var / log / messages,/var/named/data/named.run)。 可能有一些错误,阻止守护进程成功启动。
然后,我会尽可能多地从named.conf中删除。 最小的基本configuration应该更容易排除故障。 然后,我会一点一点地添加条目,以查看哪个条目导致服务器瘫痪。
也可以单独尝试从服务器和外部客户端本地parsing事物。 我希望你会发现什么是错的。
您的ns1.example.com的“example.com”与www.example.com的“example.com”是否相同?
如果是,那么whois example.com列出你的namservers的IP地址? 如果没有,您需要让您的注册商使用您的域名服务器的IP地址设置“胶水logging”,因为如果他们不知道ns1.example.com的IP地址, IP已经是。
另外,为了确保你没有设置防火墙块或其他东西,可以尝试从其他地方dig www.example.com @1.2.3.4 (1.2.3.4是ns1.example.com的IP地址),看看是否可行。