我试图在Arch Linux机器上设置绑定dns控制器https://wiki.archlinux.org/index.php/BIND。我需要做的主要事情是,这样我就不再需要在win7 dev框中再次编辑Windows / system32 / drivers / etc / hosts文件,并且可以删除其中的所有自定义条目,并让映射虚拟主机给我的条目。
这是我当前的/etc/named.conf http://dpaste.com/1XZ8JJR这是我的/var/named/falcon.local.zone http://dpaste.com/094JGPR
我将域名更改为ld.pvt
,所以当您看到对falcon.local的引用时,这些引用正在升级
有关此计算机的更多信息,主机名:falcon,多个角色;主备份san zfs阵列,仅用于个人内部专业开发人员的apache LAMP堆栈,dns(新),ssh等。
我想要的是这台dns服务器计算机(falcon),使其所有共享相同子域(ld.pvt)的虚拟主机资源可用。
资源可能看起来像这样:
bleedingedgewebsites.com.ld.pvt (domain mimick, for development)
falcon.ld.pvt (root address, this one will just list directory, so i can easily click into any forgotton resources or resources missing vhost entries)
phpmyadmin.ld.pvt
tickets.ld.pvt
jenkins.ld.pvt
在区域文件中,我更喜欢对内部资源使用通配符,但不必(例如* .ld.pvt)),那么我就无需逐一列出每个文件,并且每次我想出一些东西新的。,我只想将条目添加到vhost文件中,然后在开发机和VIOLA的地址栏中键入它!
这些可以是A记录,还是CNAMES?
(根据最近的研究,我了解到通配符可能会出现在虚拟主机中,这里只需要一个条目...)
SOA区域应该是ns1.ld.pvt
,还是<hostname>.ld.pvt
,还是前者,但是两者都有A记录?
在Arch网站上还有另一个例子。即时消息夹在这一个https://wiki.archlinux.org/index.php/BIND#1._Creating_a_zonefile之间,该文件免责声明它只是一个起点,而其他所有都更适合我需要的内容,但具体内容不一像这样https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-14-04 https:// help.github.com/articles/tips-for-configuring-an-a-record-with-your-dns-provider/都是一样的吗?
我需要一个很好的例子,/var/named/ld.pvt.zone /etc/named.conf主条目
我只需要任何一种可行的解决方案就可以开始。
为了使绑定正常工作,要遵循一些规则以正确配置它。
您需要选择一个域,为其添加区域记录,在该区域记录顶部的主机名中仅添加一个主机名条目,否则所有提及的内容仅是域。
在配置文件(例如domain.com)中,将所有域名以点号结尾是一个好习惯。
NS名称可以是域名。
A记录可以是机器的ip,而不是本地主机的ip,因为网络中的其他机器将拉该指定的ip。
一旦有了记录,就可以随意添加域名,也可以通配符,这就是我所做的。因此,现在所有以我选择的域结尾的域都映射到Web开发内容。
要使用DNS服务的计算机(即客户端)上的适配器IP属性中的DNS设置,您要将DNS设置为DNS服务器的局域网。
仅需要进行调整的是/etc/named.conf、/var/named/ld.pvt.zone以及我上面刚刚提到的IP属性。
这是配置文件,请尽情享受!
// vim:set ts=4 sw=4 et:
acl "trusted" {
192.168.1.0/24;
127.0.0.0/8;
};
options {
directory "/var/named";
pid-file "/run/named/named.pid";
listen-on { trusted; };
listen-on-v6 { any; };
allow-query { trusted; };
allow-transfer { none; };
allow-update { none; };
forwarders {
8.8.4.4;
8.8.8.8;
};
query-source address * port 53;
version none;
hostname none;
server-id none;
};
logging {
channel default_file {
file "/var/log/named/default.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel general_file {
file "/var/log/named/general.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel database_file {
file "/var/log/named/database.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel security_file {
file "/var/log/named/security.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel config_file {
file "/var/log/named/config.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel resolver_file {
file "/var/log/named/resolver.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel xfer-in_file {
file "/var/log/named/xfer-in.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel xfer-out_file {
file "/var/log/named/xfer-out.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel notify_file {
file "/var/log/named/notify.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel client_file {
file "/var/log/named/client.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel unmatched_file {
file "/var/log/named/unmatched.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel queries_file {
file "/var/log/named/queries.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel network_file {
file "/var/log/named/network.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel update_file {
file "/var/log/named/update.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel dispatch_file {
file "/var/log/named/dispatch.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel dnssec_file {
file "/var/log/named/dnssec.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
channel lame-servers_file {
file "/var/log/named/lame-servers.log" versions 3 size 5m;
severity dynamic;
print-time yes;
};
category default { default_file; };
category general { general_file; };
category database { database_file; };
category security { security_file; };
category config { config_file; };
category resolver { resolver_file; };
category xfer-in { xfer-in_file; };
category xfer-out { xfer-out_file; };
category notify { notify_file; };
category client { client_file; };
category unmatched { unmatched_file; };
category queries { queries_file; };
category network { network_file; };
category update { update_file; };
category dispatch { dispatch_file; };
category dnssec { dnssec_file; };
category lame-servers { lame-servers_file; };
};
zone "ld.pvt" IN {
type master;
file "ld.pvt.zone";
};
$TTL 7200
@ 1D IN SOA ld.pvt. root.ld.pvt. (
2007011622 ; Serial
3H ; Refresh
15M ; Retry
1W ; Expire - 1 week
1D ) ; Minimum
IN NS ld.pvt.
ld.pvt. IN A 192.168.1.10
*.ld.pvt. IN CNAME ld.pvt.
您可能需要
# mkdir /var/db/nscd
# touch /etc/netgroup
# systemctl restart named
使用journalctl -xn查找错误。
一旦运行,您就应该能够ping通任何东西。ld.pvt,现在您的虚拟主机将知道该怎么做!
现在,在客户端计算机上,您需要调整DNS,并刷新dns解析器缓存。nscd -K
然后,nscd
或者对于Winbox,ipconfig /flushdns
然后尝试在您的LAN上ping通到新的what.ld.pvt 。
要将客户端框放在地图上,您需要添加一个指向其ip的A记录,例如 automated-pooper-scooper.ld.pvt. IN A 192.168.1.44
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句