On Sun, 16 Feb 2020 14:36:42 -0500
Tom Horsley <horsley1953(a)gmail.com> wrote:
I keep seeing signs that "network" will someday disappear
entirely and I'll be forced to use NetworkManager, so the
first question I haven't been able to find an answer
for:
What is the "proper" way to setup a network connection
using nmcli which will get an IP via DHCP, but will ignore
the DHCP provided DNS and use a different DNS server specified
manually? (I can do it using techniques like chattr +i on
/etc/resolv.conf, but that isn't exactly "proper" :-).
I'm not sure how to do it with nmcli, but I did it via the network icon
on the desktop, with some edits of configuration files in order to use
knot-resolver as a caching dns server with a dns provider other than my
ISP. It really improves the speed of page loading on sites that I
visit often. Here are my procedure notes. I don't remember the
procedure because it was months ago, so there might be something
missing that I fixed and didn't add to the notes. Bad dog! Bad, bad,
dog! You should be able to put all those steps in a script that runs at
startup.
"""
I was able to get knot-resolver to act as caching dns server with the
modem serving as its source.
For the connection, I set the dns lookup to 127.0.0.1 and told
NetworkManager to only get the dhcp address, no dns address. In the
connection icon in the gui.
I told NetworkManager in its configuration file,
/etc/NetworkManager/conf.d/config to disable dns management, to turn
off resolver, to not touch /etc/hosts.
I edited the /etc/hosts file, commented everything already there and
left only the line with 127.0.0.1.
I edited the knot-resolver configuration file, and added the procedures
entry to the tables. I turned off the dnssec lookup. I then used a
stub entry to tell it to only do lookups.
I have to do a systemctl restart kresd@01 after each reboot to get the
dns lookups working, but it saves the current table on shutdown, and
restores it on boot. So, it is working properly.
"""