4

When I make changes to dhclient.conf such as modifying the DNS search path (so that the changes don't get lost on reboot or DHCP renews), how do I regenerate /etc/resolv.conf? That page suggests dhclient -r; dhclient which releases the address, thus disrupting my connection and preventing me from reaching the host again. Is there another way of doing this? Thanks.

xyzzyrz
  • 896
  • I don't use dhcp, but I do use the command 'resolvconf -u' to re-write resolv.conf when doing some VPN related tasks. – Scott Salley Apr 19 '13 at 22:11
  • @ScottSalley I did try just issuing resolvconf -u but it doesn't incorporate the changes made to dhclient.conf. – xyzzyrz Apr 19 '13 at 22:14
  • Are the change you make specific to dhcp on your network, or are they more general? If they are more general, you could add them to /etc/resolvconf/resolv.conf.d/base and then 'resolvconf -u' would do you some good. – Scott Salley Apr 19 '13 at 23:44
  • @ScottSalley It's changes like the supersede domain-name "..."; directive in the page I linked to, as an example. If I add them to /etc/resolvconf/resolv.conf.d/base won't they just get overwritten on e.g. next reboot/renew? – xyzzyrz Apr 20 '13 at 00:50

1 Answers1

-1

Just use your favorite editor to edit /etc/resolv.conf (or /run/resolvconf/resolv.conf if you are running Ubuntu 12.04 or later with resolvconf active).

After a reboot or an interface downup cycle, resolv.conf should be correctly regenerated so that you can reconnect. If that isn't the case then you have another problem.

jdthood
  • 12,625
  • That's actually the type of hack I do today in a one-off fashion (so far can handle supersede domain-name only), but since this is part of a general-purpose configuration management system, I was hoping for a more systematic way rather than writing/reproducing code to understand the various types of clauses in dhclient.conf and applying them to resolv.conf. – xyzzyrz Apr 20 '13 at 08:28