resolv.conf Got Overwritten When Setting DNS in Ubuntu?
The solution is, add following line in /etc/network/interfaces
For beginners, HOW TO is more important than the answer itself.
When tracing the problem, I noted that when editing resolv.conf it shows:
Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
Hey, it’s not about resolv.conf, it’s about resolvconf. The two filenames look almost the same except for the missing dot. When you execute resolvconf, it provides more information. Okay, let’s check the manual:
…To make ifup push name‐server information to resolvconf when it configures an interface, add dns- lines to the relevant iface stanza in /etc/network/interfaces. To add nameserver addresses add a line beginning with dns-nameservers.
dns-nameservers 126.96.36.199 188.8.131.52
Yeah, that’s the answer!
So what beginners can learn from this?
- Read the system information carefully, especially the ERRORs and CAUTIONs.
- Follow the lead in the information and DON’T be afraid of long manual.