How to make Ubuntu server 18.04 use dns-nameservers from /etc/network/interfaces?












2














On Ubuntu server 18.04 I've disabled netplan and using /etc/network/interfaces.



sudo apt-get -y install ifupdown

cat <<EOM | sudo bash -c 'cat > /etc/network/interfaces'
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.5.5
netmask 255.255.255.0
gateway 192.168.5.254
dns-nameservers 192.168.5.53 192.168.5.5
EOM

sudo ifdown --force eth0 lo && sudo ifup -a

sudo systemctl stop networkd-dispatcher
sudo systemctl disable networkd-dispatcher
sudo systemctl mask networkd-dispatcher
sudo apt-get -y purge nplan netplan.io


But apparently the systemd-resolve doesn't take into account the dns-nameservers field.



In the /etc/resolv.conf it puts only this:



nameserver 127.0.0.53


Output of ls -la /etc/resolv.conf is:



lrwxrwxrwx 1 root root 39 Oct  2 15:28 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf


Output of the sudo systemd-resolve --status | grep -A3 Server is empty.



I can define DNS servers in /etc/systemd/resolved.conf like this:



[Resolve]
DNS=192.168.5.53 192.168.5.5


Then the output of sudo systemd-resolve --status | grep -A3 Server is:



     DNS Servers: 192.168.5.53
192.168.5.5
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa


And they are used correctly and appear in /etc/resolv.conf.



How to make the dns-nameservers config line work?










share|improve this question




















  • 1




    Please edit your question to show the result of the terminal command: sudo systemd-resolve --status | grep -A3 Servers
    – chili555
    Oct 2 '18 at 13:14
















2














On Ubuntu server 18.04 I've disabled netplan and using /etc/network/interfaces.



sudo apt-get -y install ifupdown

cat <<EOM | sudo bash -c 'cat > /etc/network/interfaces'
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.5.5
netmask 255.255.255.0
gateway 192.168.5.254
dns-nameservers 192.168.5.53 192.168.5.5
EOM

sudo ifdown --force eth0 lo && sudo ifup -a

sudo systemctl stop networkd-dispatcher
sudo systemctl disable networkd-dispatcher
sudo systemctl mask networkd-dispatcher
sudo apt-get -y purge nplan netplan.io


But apparently the systemd-resolve doesn't take into account the dns-nameservers field.



In the /etc/resolv.conf it puts only this:



nameserver 127.0.0.53


Output of ls -la /etc/resolv.conf is:



lrwxrwxrwx 1 root root 39 Oct  2 15:28 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf


Output of the sudo systemd-resolve --status | grep -A3 Server is empty.



I can define DNS servers in /etc/systemd/resolved.conf like this:



[Resolve]
DNS=192.168.5.53 192.168.5.5


Then the output of sudo systemd-resolve --status | grep -A3 Server is:



     DNS Servers: 192.168.5.53
192.168.5.5
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa


And they are used correctly and appear in /etc/resolv.conf.



How to make the dns-nameservers config line work?










share|improve this question




















  • 1




    Please edit your question to show the result of the terminal command: sudo systemd-resolve --status | grep -A3 Servers
    – chili555
    Oct 2 '18 at 13:14














2












2








2







On Ubuntu server 18.04 I've disabled netplan and using /etc/network/interfaces.



sudo apt-get -y install ifupdown

cat <<EOM | sudo bash -c 'cat > /etc/network/interfaces'
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.5.5
netmask 255.255.255.0
gateway 192.168.5.254
dns-nameservers 192.168.5.53 192.168.5.5
EOM

sudo ifdown --force eth0 lo && sudo ifup -a

sudo systemctl stop networkd-dispatcher
sudo systemctl disable networkd-dispatcher
sudo systemctl mask networkd-dispatcher
sudo apt-get -y purge nplan netplan.io


But apparently the systemd-resolve doesn't take into account the dns-nameservers field.



In the /etc/resolv.conf it puts only this:



nameserver 127.0.0.53


Output of ls -la /etc/resolv.conf is:



lrwxrwxrwx 1 root root 39 Oct  2 15:28 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf


Output of the sudo systemd-resolve --status | grep -A3 Server is empty.



I can define DNS servers in /etc/systemd/resolved.conf like this:



[Resolve]
DNS=192.168.5.53 192.168.5.5


Then the output of sudo systemd-resolve --status | grep -A3 Server is:



     DNS Servers: 192.168.5.53
192.168.5.5
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa


And they are used correctly and appear in /etc/resolv.conf.



How to make the dns-nameservers config line work?










share|improve this question















On Ubuntu server 18.04 I've disabled netplan and using /etc/network/interfaces.



sudo apt-get -y install ifupdown

cat <<EOM | sudo bash -c 'cat > /etc/network/interfaces'
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.5.5
netmask 255.255.255.0
gateway 192.168.5.254
dns-nameservers 192.168.5.53 192.168.5.5
EOM

sudo ifdown --force eth0 lo && sudo ifup -a

sudo systemctl stop networkd-dispatcher
sudo systemctl disable networkd-dispatcher
sudo systemctl mask networkd-dispatcher
sudo apt-get -y purge nplan netplan.io


But apparently the systemd-resolve doesn't take into account the dns-nameservers field.



In the /etc/resolv.conf it puts only this:



nameserver 127.0.0.53


Output of ls -la /etc/resolv.conf is:



lrwxrwxrwx 1 root root 39 Oct  2 15:28 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf


Output of the sudo systemd-resolve --status | grep -A3 Server is empty.



I can define DNS servers in /etc/systemd/resolved.conf like this:



[Resolve]
DNS=192.168.5.53 192.168.5.5


Then the output of sudo systemd-resolve --status | grep -A3 Server is:



     DNS Servers: 192.168.5.53
192.168.5.5
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa


And they are used correctly and appear in /etc/resolv.conf.



How to make the dns-nameservers config line work?







networking dns systemd systemd-resolved






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 4 '18 at 6:48







Velkan

















asked Oct 2 '18 at 8:17









VelkanVelkan

2,2451826




2,2451826








  • 1




    Please edit your question to show the result of the terminal command: sudo systemd-resolve --status | grep -A3 Servers
    – chili555
    Oct 2 '18 at 13:14














  • 1




    Please edit your question to show the result of the terminal command: sudo systemd-resolve --status | grep -A3 Servers
    – chili555
    Oct 2 '18 at 13:14








1




1




Please edit your question to show the result of the terminal command: sudo systemd-resolve --status | grep -A3 Servers
– chili555
Oct 2 '18 at 13:14




Please edit your question to show the result of the terminal command: sudo systemd-resolve --status | grep -A3 Servers
– chili555
Oct 2 '18 at 13:14










3 Answers
3






active

oldest

votes


















1














You need the package resolvconf, too.



So, to get rid of netplan completely:




  1. Configure /etc/network/interfaces

  2. Install ifupdown and friends: $ sudo apt install ifupdown resolvconf

  3. Remove netplan: $ sudo apt remove nplan netplan.io






share|improve this answer





























    0















    How to make the dns-nameservers config line work?




    As you can see by the status command, the line is working perfectly:



    DNS Servers: 192.168.5.53
    192.168.5.5


    The symbolic link /etc/resolv.conf shows:



    nameserver 127.0.0.53


    That indicates that dnsmasq is running here: https://help.ubuntu.com/community/Dnsmasq



    In short, this means that domain name lookups will first query a local cache to see if the site has been visited before. 127.0.0.xx is 'local' in this context. If so, the local cache will provide the IP address. If the site has not been visited before and no reference is available in the local cache, only then will the listed DNS nameservers; 192.168.5.53 and 192.168.5.5, in your case, be used.



    The readings you’ve gven above are entirely normal and expected.






    share|improve this answer





















    • It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
      – Velkan
      Oct 3 '18 at 6:27












    • May we see: ls -al /etc/resolv.conf
      – chili555
      Oct 3 '18 at 13:31










    • Added the /etc/resolv.conf.
      – Velkan
      Oct 4 '18 at 7:50



















    -1














    network interfaces files have been changed a lot on ubuntu 18.
    I suggest you to check this website or another one to correctly configure your network adapter



    how to configure network ubuntu 18



    Anyways you can also (and that's the easiest way) configure your ip and nameservers from the network manager on settings.






    share|improve this answer





















    • I don't care about netplan. And the server has no NetworkManager.
      – Velkan
      Oct 2 '18 at 9:59












    • then google your problems
      – xavi Bansus
      Oct 2 '18 at 10:00










    • On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
      – Velkan
      Oct 2 '18 at 11:19













    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1080230%2fhow-to-make-ubuntu-server-18-04-use-dns-nameservers-from-etc-network-interfaces%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You need the package resolvconf, too.



    So, to get rid of netplan completely:




    1. Configure /etc/network/interfaces

    2. Install ifupdown and friends: $ sudo apt install ifupdown resolvconf

    3. Remove netplan: $ sudo apt remove nplan netplan.io






    share|improve this answer


























      1














      You need the package resolvconf, too.



      So, to get rid of netplan completely:




      1. Configure /etc/network/interfaces

      2. Install ifupdown and friends: $ sudo apt install ifupdown resolvconf

      3. Remove netplan: $ sudo apt remove nplan netplan.io






      share|improve this answer
























        1












        1








        1






        You need the package resolvconf, too.



        So, to get rid of netplan completely:




        1. Configure /etc/network/interfaces

        2. Install ifupdown and friends: $ sudo apt install ifupdown resolvconf

        3. Remove netplan: $ sudo apt remove nplan netplan.io






        share|improve this answer












        You need the package resolvconf, too.



        So, to get rid of netplan completely:




        1. Configure /etc/network/interfaces

        2. Install ifupdown and friends: $ sudo apt install ifupdown resolvconf

        3. Remove netplan: $ sudo apt remove nplan netplan.io







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 7 '18 at 12:07









        ahaaha

        1112




        1112

























            0















            How to make the dns-nameservers config line work?




            As you can see by the status command, the line is working perfectly:



            DNS Servers: 192.168.5.53
            192.168.5.5


            The symbolic link /etc/resolv.conf shows:



            nameserver 127.0.0.53


            That indicates that dnsmasq is running here: https://help.ubuntu.com/community/Dnsmasq



            In short, this means that domain name lookups will first query a local cache to see if the site has been visited before. 127.0.0.xx is 'local' in this context. If so, the local cache will provide the IP address. If the site has not been visited before and no reference is available in the local cache, only then will the listed DNS nameservers; 192.168.5.53 and 192.168.5.5, in your case, be used.



            The readings you’ve gven above are entirely normal and expected.






            share|improve this answer





















            • It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
              – Velkan
              Oct 3 '18 at 6:27












            • May we see: ls -al /etc/resolv.conf
              – chili555
              Oct 3 '18 at 13:31










            • Added the /etc/resolv.conf.
              – Velkan
              Oct 4 '18 at 7:50
















            0















            How to make the dns-nameservers config line work?




            As you can see by the status command, the line is working perfectly:



            DNS Servers: 192.168.5.53
            192.168.5.5


            The symbolic link /etc/resolv.conf shows:



            nameserver 127.0.0.53


            That indicates that dnsmasq is running here: https://help.ubuntu.com/community/Dnsmasq



            In short, this means that domain name lookups will first query a local cache to see if the site has been visited before. 127.0.0.xx is 'local' in this context. If so, the local cache will provide the IP address. If the site has not been visited before and no reference is available in the local cache, only then will the listed DNS nameservers; 192.168.5.53 and 192.168.5.5, in your case, be used.



            The readings you’ve gven above are entirely normal and expected.






            share|improve this answer





















            • It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
              – Velkan
              Oct 3 '18 at 6:27












            • May we see: ls -al /etc/resolv.conf
              – chili555
              Oct 3 '18 at 13:31










            • Added the /etc/resolv.conf.
              – Velkan
              Oct 4 '18 at 7:50














            0












            0








            0







            How to make the dns-nameservers config line work?




            As you can see by the status command, the line is working perfectly:



            DNS Servers: 192.168.5.53
            192.168.5.5


            The symbolic link /etc/resolv.conf shows:



            nameserver 127.0.0.53


            That indicates that dnsmasq is running here: https://help.ubuntu.com/community/Dnsmasq



            In short, this means that domain name lookups will first query a local cache to see if the site has been visited before. 127.0.0.xx is 'local' in this context. If so, the local cache will provide the IP address. If the site has not been visited before and no reference is available in the local cache, only then will the listed DNS nameservers; 192.168.5.53 and 192.168.5.5, in your case, be used.



            The readings you’ve gven above are entirely normal and expected.






            share|improve this answer













            How to make the dns-nameservers config line work?




            As you can see by the status command, the line is working perfectly:



            DNS Servers: 192.168.5.53
            192.168.5.5


            The symbolic link /etc/resolv.conf shows:



            nameserver 127.0.0.53


            That indicates that dnsmasq is running here: https://help.ubuntu.com/community/Dnsmasq



            In short, this means that domain name lookups will first query a local cache to see if the site has been visited before. 127.0.0.xx is 'local' in this context. If so, the local cache will provide the IP address. If the site has not been visited before and no reference is available in the local cache, only then will the listed DNS nameservers; 192.168.5.53 and 192.168.5.5, in your case, be used.



            The readings you’ve gven above are entirely normal and expected.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 2 '18 at 20:30









            chili555chili555

            38.2k55177




            38.2k55177












            • It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
              – Velkan
              Oct 3 '18 at 6:27












            • May we see: ls -al /etc/resolv.conf
              – chili555
              Oct 3 '18 at 13:31










            • Added the /etc/resolv.conf.
              – Velkan
              Oct 4 '18 at 7:50


















            • It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
              – Velkan
              Oct 3 '18 at 6:27












            • May we see: ls -al /etc/resolv.conf
              – chili555
              Oct 3 '18 at 13:31










            • Added the /etc/resolv.conf.
              – Velkan
              Oct 4 '18 at 7:50
















            It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
            – Velkan
            Oct 3 '18 at 6:27






            It's working perfectly only if you hardcode IPs into /etc/systemd/resolved.conf, otherwise the status command output is empty. So the dns-nameservers doesn't work at all. Sorry for the confusing description.
            – Velkan
            Oct 3 '18 at 6:27














            May we see: ls -al /etc/resolv.conf
            – chili555
            Oct 3 '18 at 13:31




            May we see: ls -al /etc/resolv.conf
            – chili555
            Oct 3 '18 at 13:31












            Added the /etc/resolv.conf.
            – Velkan
            Oct 4 '18 at 7:50




            Added the /etc/resolv.conf.
            – Velkan
            Oct 4 '18 at 7:50











            -1














            network interfaces files have been changed a lot on ubuntu 18.
            I suggest you to check this website or another one to correctly configure your network adapter



            how to configure network ubuntu 18



            Anyways you can also (and that's the easiest way) configure your ip and nameservers from the network manager on settings.






            share|improve this answer





















            • I don't care about netplan. And the server has no NetworkManager.
              – Velkan
              Oct 2 '18 at 9:59












            • then google your problems
              – xavi Bansus
              Oct 2 '18 at 10:00










            • On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
              – Velkan
              Oct 2 '18 at 11:19


















            -1














            network interfaces files have been changed a lot on ubuntu 18.
            I suggest you to check this website or another one to correctly configure your network adapter



            how to configure network ubuntu 18



            Anyways you can also (and that's the easiest way) configure your ip and nameservers from the network manager on settings.






            share|improve this answer





















            • I don't care about netplan. And the server has no NetworkManager.
              – Velkan
              Oct 2 '18 at 9:59












            • then google your problems
              – xavi Bansus
              Oct 2 '18 at 10:00










            • On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
              – Velkan
              Oct 2 '18 at 11:19
















            -1












            -1








            -1






            network interfaces files have been changed a lot on ubuntu 18.
            I suggest you to check this website or another one to correctly configure your network adapter



            how to configure network ubuntu 18



            Anyways you can also (and that's the easiest way) configure your ip and nameservers from the network manager on settings.






            share|improve this answer












            network interfaces files have been changed a lot on ubuntu 18.
            I suggest you to check this website or another one to correctly configure your network adapter



            how to configure network ubuntu 18



            Anyways you can also (and that's the easiest way) configure your ip and nameservers from the network manager on settings.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 2 '18 at 9:23









            xavi Bansusxavi Bansus

            342




            342












            • I don't care about netplan. And the server has no NetworkManager.
              – Velkan
              Oct 2 '18 at 9:59












            • then google your problems
              – xavi Bansus
              Oct 2 '18 at 10:00










            • On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
              – Velkan
              Oct 2 '18 at 11:19




















            • I don't care about netplan. And the server has no NetworkManager.
              – Velkan
              Oct 2 '18 at 9:59












            • then google your problems
              – xavi Bansus
              Oct 2 '18 at 10:00










            • On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
              – Velkan
              Oct 2 '18 at 11:19


















            I don't care about netplan. And the server has no NetworkManager.
            – Velkan
            Oct 2 '18 at 9:59






            I don't care about netplan. And the server has no NetworkManager.
            – Velkan
            Oct 2 '18 at 9:59














            then google your problems
            – xavi Bansus
            Oct 2 '18 at 10:00




            then google your problems
            – xavi Bansus
            Oct 2 '18 at 10:00












            On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
            – Velkan
            Oct 2 '18 at 11:19






            On google it's possible to find how to configure netplan. If you think that my question is about configuring netplan then flag it as a duplicate.
            – Velkan
            Oct 2 '18 at 11:19




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1080230%2fhow-to-make-ubuntu-server-18-04-use-dns-nameservers-from-etc-network-interfaces%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?