Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 years ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
我在 BSD 许可证下为工作面试编写了一个基本的 DNS 服务器。
可能有人会发现它有用:
https://github.com/nephewtom/dns-server
I wrote a basic DNS server for a job interview under BSD license.
May be someone could find it useful:
https://github.com/nephewtom/dns-server
不存在“简单”的缓存 DNS 服务器这样的东西,特别是如果您想要良好的安全性的话。 最近的 DNS 攻击表明,递归 DNS 服务器中的缓存功能特别容易受到攻击。
重新评估您是否确实需要自己的本地缓存。 如果不这样做,您最好修改现有的 DNS 代理代码(例如“dnsmasq”)。
如果您确实想自行开发,可以使用一些不错的库,例如
ldns
可以提供对底层DNS数据包的访问。我自己将 ldns 与 libevent 结合使用来实现我在之前的问题中提到的模糊 DNS 服务器。
There's no such thing as a "simple" cacheing DNS server, particularly if you want decent security. Recent DNS attacks have shown that the cacheing function in recursive DNS servers is particularly vulnerable.
Re-evaluate whether you actually need local cacheing of your own. If you don't, you're probably better off modifying existing DNS proxy code (such as 'dnsmasq').
If you do want to roll-your-own, there are good libraries such as
ldns
which can provide the access to the underlying DNS packets.I'm using
ldns
myself in conjunction withlibevent
to implement the Fuzzing DNS server I mentioned in an earlier question.有许多 DNS 的免费软件实现。 你可以看看他们的源代码。 例如:
本书 DNS 和 BIND 可能会有所帮助。 当然,还有指定 DNS 的 RFC,请参阅 http://rfc-editor.org/。
There are a bunch of free software implementations of DNS. You could look at their source code. For example:
The book DNS and BIND might be helpful. And, of course, there are the RFCs that specify DNS, see http://rfc-editor.org/.
如果您确实需要这样做(这是一项巨大工作,请参阅 Alnitak 的回复),请从现有的好程序开始(而不是长期无人维护的单人实验)时间如djbdns)并修改它。
Unbound 可能是一个合理的选择。 (代码库比 BIND 的代码库小。)
If you really need to do that (it is a huge work, see Alnitak's reply), start from an existing good program (not a one-man experiment unmaintained for a long time like djbdns) and modify it.
Unbound is probably a reasonable choice for this. (The code base is smaller than BIND's one.)
从 djbdns 开始。
Start with djbdns.
或者,您可以使用 Ragel 状态机编译器 从头开始构建您的服务器。
Alternately, you could use the Ragel State Machine Compiler to build your server from scratch.