Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Locking-in DNS Servers in systemd  (Read 861 times)

0 Members and 1 Guest are viewing this topic.

AndyCountry

    Topic Starter


    Rookie

    Thanked: 1
    Locking-in DNS Servers in systemd
    « on: January 16, 2019, 08:02:55 PM »
    Hi there! My question is: How can I "lock down" the IP addy for the DNS service I'd like to use on a Mint19 system? It uses the new systemd. I haven't "learned" this new-fangled systemd stuff.

    As it stands now, when I open /etc/resolv.conf I find "127.0.0.53 .
    I change that to 208.67.222.222. Then run a dig command and it says my resolver is 208.67.222.222.

    When I disconnect from the network and reconnect, I find my manually configured DNS IP is back to 127.0.0.53 . I run another dig command and sure enough, my resolver is back to 127.0.0.53. I look in /etc/resolv.config and, of course it shows the 127.0.0.53 addy as well.

    Thanks in advance,
    Andy

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1004
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows XP
    Re: Locking-in DNS Servers in systemd
    « Reply #1 on: January 16, 2019, 10:51:04 PM »
    Your system is normal. Why do you need more information?
    What is still in use in North America is the system called "IPv4" which means Internet Protocol version four.

    If you really need to know, here it is:
    Everything you need to know about IPv4 and its configurations!
    Quote
    This course is over 6 hours in length and will cover all aspects of IPv4
    Get even more and mare stuff by searching for:
    Everything you ever wanted to know about IP addresses

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1108
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 8
    Re: Locking-in DNS Servers in systemd
    « Reply #2 on: January 17, 2019, 06:20:10 PM »
    Are you restarting the appropriate services after editing resolv.conf?

    $ sudo systemctl daemon-reload
    $ sudo systemctl restart systemd-networkd
    $ sudo systemctl restart systemd-resolved

    What may be occurring is that dig uses the configuration file directly, but the configuration is being rewritten by some other part of the system because the service was not restarted.

    Another thought: there is a per-network adapter configuration found in /etc/systemd/network/ for each adapter, which may include DNS information- reconnecting might be overriding the standard DNS resolver setting with the one set in the network adapter config.
    I was trying to dereference Null Pointers before it was cool.

    AndyCountry

      Topic Starter


      Rookie

      Thanked: 1
      Re: Locking-in DNS Servers in systemd
      « Reply #3 on: January 22, 2019, 04:08:58 PM »
      BC_Programmer,

      Thank you for your respectful and earnest response!

      When you said,What may be occurring is that dig uses the configuration file directly, but the configuration is being rewritten by some other part of the system because the service was not restarted."  I believe is truly spot-on.

      I looked in the /etc/systemd/network/ directory... has nothing in it. Empty.


      So... I had spent 5 or 6 hours trying to find the answer BEFORE I came to my friends at CH. And after I made the above post, I went back to searching the Web for another 2-3 hours. And lo-and-behold, I did manage to find this code that does "lock" Debian DNS configurations, which I will post in order to help others that may need this info in the future:

      create /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate file, and add this script to it:

      #!/bin/sh
      make_resolv_conf(){
         :
      }

      The final steps are to save and close the file, then set permissions:
       chmod +x /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate

      Again, BC, I appreciate your help. At least you take the time to try and understand the questions put to you, as your response illustrates. Cheers, mate!