开发者

RW - Primary/Secondary DNS Address In Python

开发者 https://www.devze.com 2023-01-01 00:52 出处:网络
I want to read the primary and secondary dns addresses from the system and want to change it to any user given address.

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 li开发者_如何学Cbrary.

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.


/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:

append domain-name-servers <DNS-ip>;

or

prepend domain-name-servers <DNS-ip>;

Also note that Ubuntu (at least 9.04 I'm using) supports only up to 3 DNS servers.

0

精彩评论

暂无评论...
验证码 换一张
取 消