RW - Python 中的主/辅 DNS 地址
我想从系统读取主要和辅助 DNS 地址,并将其更改为任何用户给定的地址。
通过某些图书馆可以实现这一点吗?
另一种方法是我阅读 /etc/resolv.conf 并进行更改,这就是我所做的。
顺便说一句,我目前的解决方案是针对 Ubuntu 操作系统的,现在如果我也得到同样操作系统的解决方案,那就没问题了。
I want to read the primary and secondary dns addresses from the system and want to change it to any user given address.
Is this possible through some library.
An alternative approach is that I read the /etc/resolv.conf and do the changes, which is what I've done.
BTW the current solution I have is for Ubuntu OS, and for now if I get if for the same OS also it would be fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
/etc/resolv.conf
是 DNS 服务器的权威来源,因此您最好在那里进行检查。有点题外话,但请注意它被 DHCP 覆盖,因此如果您需要添加自己的 DNS 服务器,您必须编辑 /etc/dhcp3/dhclient.conf 并添加类似以下内容:
或者
还请注意 Ubuntu(位于我使用的至少是 9.04) 仅支持最多 3 个 DNS 服务器。
/etc/resolv.conf
IS the authoritative source of DNS servers, so you better check there.A bit off-topic, but note that it's being overriden by DHCP, so if you need to add own DNS server, you have to edit /etc/dhcp3/dhclient.conf and add there something like:
or
Also note that Ubuntu (at least 9.04 I'm using) supports only up to 3 DNS servers.