大网数据广告活动
服务器运维问答

Use an external subdomain as a zone in my local DNS server

· 52CE 我爱测

This is my situation: I have a .net, (example.net) domain. the domain is setup (on my registrars's platform) to point to my hosting provider's DNS (via CUSTOM DNS setup). The hosting provider offers a DNS Zone editor. What I need…

问题原文

原帖链接 · John Smith · CC BY-SA 4.0

This is my situation:

I have a .net, (example.net) domain.

the domain is setup (on my registrars's platform) to point to my hosting provider's DNS (via CUSTOM DNS setup).

The hosting provider offers a DNS Zone editor.

What I need to do is to point a subdomain: (lan.example.net) to my local server, which is currently running bind9.

How exactly should I delegate only that subdomain to my local server and setup bind9 so the subdomain can be used by the intranet where the bind9 is located (so lan.example.net can be accessible by intranet's PC's without connection to internet. Those PC's will be resolving to the local bind9 server).

  • Do I need to setup an A record on hosting provider DNS zone editor pointing to my WAN IP?

  • Do I need to open port (53) on my local server bind9 so the hosting provider can communicate to my local DNS?

I'd also need to create more subdomains (managed by my local bind9), like this:

site1.lan.example.net
site2.lan.example.net

Since lan.example.net is already delagated to local DNS, I should be able to add more subdomains, for internal use.

Any help would be appreciated. Thanks.

已采纳解答

原帖链接 · Vinícius Ferrão · CC BY-SA 4.0

You don't need to delegate from the public facing DNS to the internal one. You may only delegate if you want to use DNSSEC in the internal zones. Which may not be the case.

Also delegating from the external DNS, with the NS and A (glue) records will expose that you have an internal DNS running at a given IP address, and again, this may not be what you want. If this is what you want you'll also need to open ports 53/tcp and 53/udp on your local firewall to allow zone transfers: AXFR and IXFR.

For BIND9 you can do something like this, to create additional internal subzones:

; Nameservers records
ns.example.net.         IN      A       192.168.0.10
ns1.example.net.        IN      A       192.168.0.3
ns2.example.net.        IN      A       192.168.0.4

; Delegated internal zones
local.example.net.      IN      NS      ns.example.net.
mgmt.example.net.       IN      NS      ns.example.net.

; Delegated external zones
subzone.example.net.    IN      NS      ns.example.net.
whatever.example.net.   IN      NS      ns.example.net.

; Delegated external zone with its own nameservers (and glue records)
fnord.example.net.      IN      NS      ns1.fnord.example.net.
fnord.example.net.      IN      NS      ns2.fnord.example.net.
ns1.fnord.example.net.  IN      A       198.51.100.1
ns2.fnord.example.net.  IN      A       198.51.100.2

The original configuration was in another question similar to this one, which can be found here: Can one server do DNS for a domain and a subdomain?

Finally you may also take a look at BIND9 views. To avoid exposing your internal network to public facing DNS servers. Without this you'll leak your internal IPs and networks. You basically need to create an ACL on BIND9 with your internal clients:

acl internal {
   192.168.0.0/24;
   localhost;
};

view "internalview" {
  zone "lan.example.net " IN {
    type master;
    file "zones/lan.example.net";
    allow-transfer { nameservers; };
  };
};

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-06-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。