You are not logged in.

#1 2019-03-22 09:47:08

Willem
Member
From: Wellington, NZ
Registered: 2009-10-09
Posts: 18

[SOLVED] Configure specific DNS to be used - resolve.conf dhcpcd

Hi,

I'm trying to manually specify the Google DNS servers to be used (and not the ISPs DNS servers) but not succeeding.
Any help would be greatly appreciated. I think only dhcpcd is being used.

resolvconf -l
# resolv.conf from eth0.dhcp
# Generated by dhcpcd from eth0.dhcp
domain hub
search hub
nameserver 8.8.8.8
nameserver 8.8.4.4

# resolv.conf from eth0.dhcp6
# Generated by dhcpcd from eth0.dhcp6
search hub
nameserver 2407:7000:9b47:a200:a691:b1ff:fe20:ce56

# resolv.conf from eth0.ra
# Generated by dhcpcd from eth0.ra
search hub
nameserver 2407:7000:9b47:a200:a691:b1ff:fe20:ce56

/etc/dhcpcd.conf:
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# Most distributions have NTP support.
#option ntp_servers
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
noipv4ll
#added
static domain_name_servers=8.8.8.8 8.8.4.4

/etc/systemd/resolved.conf:
[Resolve]
DNS=8.8.8.8 8.8.4.4

ps -aux | grep resolve
root      1229  0.0  0.0   6268  2312 pts/1    S+   22:42   0:00 grep --color=auto resolve

Last edited by Willem (2019-03-22 23:12:53)

Offline

#2 2019-03-22 10:26:01

Pryka
Member
Registered: 2018-02-07
Posts: 85

Re: [SOLVED] Configure specific DNS to be used - resolve.conf dhcpcd

Add

nohook resolv.conf 

to /etc/dhcpcd.conf

This should prevent dhcpcd from overwriting resolv.conf

Offline

#3 2019-03-22 19:48:09

Willem
Member
From: Wellington, NZ
Registered: 2009-10-09
Posts: 18

Re: [SOLVED] Configure specific DNS to be used - resolve.conf dhcpcd

Thanks for the reply, I added it to the bottom of /etc/dhcpcd.conf:

static domain_name_servers=8.8.8.8 8.8.4.4
nohook resolv.conf

Contents /etc/resolv.conf after reboot stayed the same. Not sure if I forced those values in the file or if there is a process that still puts it there. I can't see any other service running other than dhcpd

When now running:
resolvconf -l
there is no output

ls -al /etc/resolv.conf
-rw-r--r-- 1 root root 38 Mar 23 00:27 /etc/resolv.conf

For now to just get it working I reluctantly:
chattr -i resolv.conf
vi resolv.conf
chattr +i resolv.conf

and the contents don't get overwritten after reboot but would rather have it working as designed, reading and using a configuration file.

Offline

#4 2019-03-22 20:39:27

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 670

Re: [SOLVED] Configure specific DNS to be used - resolve.conf dhcpcd

Are you using openresolv?

If you are, then set the servers in /etc/resolvconf.conf:

name_servers="8.8.8.8 8.8.4.4"

And afterwards run resolvconf -u, to generate /etc/resolv.conf.

Offline

#5 2019-03-22 23:12:28

Willem
Member
From: Wellington, NZ
Registered: 2009-10-09
Posts: 18

Re: [SOLVED] Configure specific DNS to be used - resolve.conf dhcpcd

ps -aux | grep resolv
root      1278  0.0  0.0   6268  2304 pts/1    S+   12:13   0:00 grep --color=auto resolv

However if I make the changes and run resolvconf -u I can see it modified /etc/resolv.conf

Thanks all for the replies, sort of working (though still in mysterious ways, but probably my system which is dirty or something running that I'm not aware off).

Last edited by Willem (2019-03-22 23:17:27)

Offline

Board footer

Powered by FluxBB