RW - Primary/Secondary DNS Address In Python
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.
精彩评论