0

I have an embedded Linux device which connects to wifi. It is configured with DHCP and configured to use a specific DNS server. The current configuration works.

However, I want to remove the DNS configuration and let DHCP give me an automatic DNS (this can be done along with IP response as far as I understand). When I remove the nameserver from /etc/resolv.conf I am able to ping but name resolution does not work.

nslookup: write to '127.0.0.1': Connection refused

I'm probably missing some configuration. Can anyone help? I'm using wpa_supplicant and dhcpcd (we are not running network-manager/bind etc). Do I need additional daemon or is this just a configuration issue?

1 Answer 1

0

The DNS server address has to be written to the /etc/resolv.conf file. That's where programs expect to find it – there is no other standard place that dhcpcd would store the DHCP-provided server addresses; all DHCP clients need to update the resolv.conf file.

(If your /etc is read-only, the file can be a symlink to somewhere in /run or /tmp.)

dhcpcd will automatically update /etc/resolv.conf using the dhcpcd-hooks/20-resolv.conf hook script that comes as part of a standard dhcpcd installation. Make sure this script and the general dhcpcd-run-hooks script are present in your embedded system.

(On my system these scripts are at /usr/lib/dhcpcd, but the path might vary depending on compile options.)

1
  • brilliant! it works-thanks!. I should have read more carefully the hooks section.. May 6 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.