免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8743 | 回复: 5
打印 上一主题 下一主题

[DNS] bind9配置好后,内网测试正确,外网无法正常解析。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-09-07 16:28 |只看该作者 |倒序浏览
本帖最后由 Voidray 于 2011-09-07 16:42 编辑

bind9的服务器有一个公网ip,测试的客户机设置dns为内网ip时一切正常,设置为公网ip时就无法解析。

运行bind9的机器selinux已关闭,iptables已经开放53端口的udp和tcp,公网ip的53端口确认是打开状态,内网ip正反解析都是正常

  1. options {
  2.         listen-on port 53 { any; };
  3.         allow-query { any; };
  4.         allow-transfer { any; };
  5.         ......
  6. };

  7. view "net_resolver" {
  8.         recursion yes;
  9.         match-clients {
  10.                 any;
  11.                 };
  12.         allow-transfer {
  13.                 any;
  14.                 };
  15.         allow-query {
  16.                 any;
  17.                 };
  18.         ......
  19. };
复制代码
dig @内网ip 域名
一切正常

dig @公网ip 域名
;; global options:  printcmd
;; connection timed out; no servers could be reached


请问我应该如何排错和处理?

论坛徽章:
0
2 [报告]
发表于 2011-09-07 18:42 |只看该作者
dig @公网ip 域名 +tcp
一切正常

dig @公网ip 域名 +notcp
;; global options:  printcmd
;; connection timed out; no servers could be reached

发现是公网ip53端口的udp无法通过



listen-on port 53 { any; }; 改成 listen-on port 53 { 公网ip; 内网ip; };后named restart

netstate -an发现内网ip正在监听53的udp,而外网ip没有监听53的udp

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
3 [报告]
发表于 2011-09-07 20:22 |只看该作者
检查下dns的日志,看看为什么没有侦听外网接口.
或者,禁用下内网网卡,重启下named服务,看看能侦听不

论坛徽章:
0
4 [报告]
发表于 2011-09-07 21:23 |只看该作者
网卡是内网ip,公网ip是nat。


启动时日志如下:
Sep  7 21:25:36 ns1 named[15033]: starting BIND 9.3.6-P1-RedHat-9.3.6-16.P1.el5 -u named -t /var/named/chroot
Sep  7 21:25:36 ns1 named[15033]: found 4 CPUs, using 4 worker threads
Sep  7 21:25:36 ns1 named[15033]: using up to 4096 sockets
Sep  7 21:25:36 ns1 named[15033]: loading configuration from '/etc/named.conf'
Sep  7 21:25:36 ns1 named[15033]: using default UDP/IPv4 port range: [1024, 65535]
Sep  7 21:25:36 ns1 named[15033]: using default UDP/IPv6 port range: [1024, 65535]
Sep  7 21:25:36 ns1 named[15033]: no IPv6 interfaces found
Sep  7 21:25:36 ns1 named[15033]: listening on IPv4 interface eth0, 192.168.100.89#53
Sep  7 21:25:36 ns1 named[15033]: command channel listening on 127.0.0.1#953
Sep  7 21:25:36 ns1 named[15033]: the working directory is not writable

192.168.100.89是内网地址,对应公网ip的侦听没有启动。

listen-on port 53 里面已经配置了内网ip和公网ip

论坛徽章:
0
5 [报告]
发表于 2011-09-07 21:31 |只看该作者
本帖最后由 alsonluo 于 2011-09-07 21:32 编辑

是内网IP和公网IP分别绑定到服务器的网卡上,则分别在每个IP上侦听;如果只有内网IP在网卡上,公网IP通过NAT到内网IP,应该只需要把侦听内网IP的53端口就可以了。

论坛徽章:
0
6 [报告]
发表于 2011-09-07 21:36 |只看该作者
是内网IP和公网IP分别绑定到服务器的网卡上,则分别在每个IP上侦听;如果只有内网IP在网卡上,公网IP通过NA ...
alsonluo 发表于 2011-09-07 21:31


现在就是内网ip在网卡上,公网ip通过nat。selinux已关闭,iptables已关闭。路由只做了nat没做任何限制,没做硬件防火墙。

dig @公网ip 域名 +tcp 就可以正常解析
dig @公网ip 域名 +notcp 就无法解析。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP