nameserver in /etc/resolv.conf vs /etc/sysconfig/ifcfg-eth0 on Centos 6 / RHEL 6 server












0















If nameservers are configured with both nameserver entries in /etc/resolv.conf and DNS1/DNS2 entries in /etc/sysconfig/network-scripts/ifcfg-eth0 on a Centos 6 / RHEL 6 server, which one will take precedence? Please help! Thanks in advance!!










share|improve this question





























    0















    If nameservers are configured with both nameserver entries in /etc/resolv.conf and DNS1/DNS2 entries in /etc/sysconfig/network-scripts/ifcfg-eth0 on a Centos 6 / RHEL 6 server, which one will take precedence? Please help! Thanks in advance!!










    share|improve this question



























      0












      0








      0








      If nameservers are configured with both nameserver entries in /etc/resolv.conf and DNS1/DNS2 entries in /etc/sysconfig/network-scripts/ifcfg-eth0 on a Centos 6 / RHEL 6 server, which one will take precedence? Please help! Thanks in advance!!










      share|improve this question
















      If nameservers are configured with both nameserver entries in /etc/resolv.conf and DNS1/DNS2 entries in /etc/sysconfig/network-scripts/ifcfg-eth0 on a Centos 6 / RHEL 6 server, which one will take precedence? Please help! Thanks in advance!!







      centos-6 nameserver rhel-6






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 6 at 15:24







      Karunkar Borah

















      asked Jan 6 at 13:42









      Karunkar BorahKarunkar Borah

      13




      13






















          2 Answers
          2






          active

          oldest

          votes


















          0














          The system uses the info in the /etc/resolv.conf file. However, that file is created from the entry in the sysconfig folder (e.g., at reboot).






          share|improve this answer
























          • Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

            – Karunkar Borah
            Jan 6 at 14:39



















          0














          Well i tried it out and found out that /etc/resolv.conf takes presedence over /etc/sysconfig/network-scripts/ifcfg-eth file. You can go through my configuration and a dig output below. I rebooted the system after initially saving this configuration.



          [root@KKcentOSVM karunakar]# cat /etc/resolv.conf
          ; custom entries
          search localdomain
          nameserver 8.8.8.8
          nameserver 4.2.2.2
          [root@KKcentOSVM karunakar]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
          HWADDR=00:0C:29:E7:72:60
          TYPE=Ethernet
          BOOTPROTO=none
          IPADDR=192.168.186.131
          NETMASK=255.255.255.0
          GATEWAY=192.168.186.2
          NAME=eth1
          NM_CONTROLLED=no
          ONBOOT=yes
          DNS1=8.8.4.4
          DNS2=4.2.2.2
          PEERDNS=no
          [root@KKcentOSVM karunakar]# dig www.google.com

          ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.68.rc1.el6_10.1 <<>> www.google.com
          ;; global options: +cmd
          ;; Got answer:
          ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38527
          ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

          ;; QUESTION SECTION:
          ;www.google.com. IN A

          ;; ANSWER SECTION:
          www.google.com. 69 IN A 216.58.200.132

          ;; Query time: 196 msec
          ;; SERVER: 8.8.8.8#53(8.8.8.8)
          ;; WHEN: Mon Jan 7 20:50:00 2019
          ;; MSG SIZE rcvd: 48


          You can verify from the third last line from the output of



          dig www.google.com


          which is



          ;; SERVER: 8.8.8.8#53(8.8.8.8)


          that the url was resolved by the nameserver 8.8.8.8 set in /etc/resolv.conf rather than 8.8.4.4 set in /etc/sysconfig/network-scripts/ifcfg-eth1






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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%2fsuperuser.com%2fquestions%2f1391162%2fnameserver-in-etc-resolv-conf-vs-etc-sysconfig-ifcfg-eth0-on-centos-6-rhel-6%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The system uses the info in the /etc/resolv.conf file. However, that file is created from the entry in the sysconfig folder (e.g., at reboot).






            share|improve this answer
























            • Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

              – Karunkar Borah
              Jan 6 at 14:39
















            0














            The system uses the info in the /etc/resolv.conf file. However, that file is created from the entry in the sysconfig folder (e.g., at reboot).






            share|improve this answer
























            • Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

              – Karunkar Borah
              Jan 6 at 14:39














            0












            0








            0







            The system uses the info in the /etc/resolv.conf file. However, that file is created from the entry in the sysconfig folder (e.g., at reboot).






            share|improve this answer













            The system uses the info in the /etc/resolv.conf file. However, that file is created from the entry in the sysconfig folder (e.g., at reboot).







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 6 at 14:00









            joatjoat

            45629




            45629













            • Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

              – Karunkar Borah
              Jan 6 at 14:39



















            • Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

              – Karunkar Borah
              Jan 6 at 14:39

















            Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

            – Karunkar Borah
            Jan 6 at 14:39





            Thanks but if I set PEERDNS=no in /etc/sysconfig/ifcfg-eth0 it should not update /etc/resolv.conf. Which DNS server will ultimately be used by the system??

            – Karunkar Borah
            Jan 6 at 14:39













            0














            Well i tried it out and found out that /etc/resolv.conf takes presedence over /etc/sysconfig/network-scripts/ifcfg-eth file. You can go through my configuration and a dig output below. I rebooted the system after initially saving this configuration.



            [root@KKcentOSVM karunakar]# cat /etc/resolv.conf
            ; custom entries
            search localdomain
            nameserver 8.8.8.8
            nameserver 4.2.2.2
            [root@KKcentOSVM karunakar]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
            HWADDR=00:0C:29:E7:72:60
            TYPE=Ethernet
            BOOTPROTO=none
            IPADDR=192.168.186.131
            NETMASK=255.255.255.0
            GATEWAY=192.168.186.2
            NAME=eth1
            NM_CONTROLLED=no
            ONBOOT=yes
            DNS1=8.8.4.4
            DNS2=4.2.2.2
            PEERDNS=no
            [root@KKcentOSVM karunakar]# dig www.google.com

            ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.68.rc1.el6_10.1 <<>> www.google.com
            ;; global options: +cmd
            ;; Got answer:
            ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38527
            ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

            ;; QUESTION SECTION:
            ;www.google.com. IN A

            ;; ANSWER SECTION:
            www.google.com. 69 IN A 216.58.200.132

            ;; Query time: 196 msec
            ;; SERVER: 8.8.8.8#53(8.8.8.8)
            ;; WHEN: Mon Jan 7 20:50:00 2019
            ;; MSG SIZE rcvd: 48


            You can verify from the third last line from the output of



            dig www.google.com


            which is



            ;; SERVER: 8.8.8.8#53(8.8.8.8)


            that the url was resolved by the nameserver 8.8.8.8 set in /etc/resolv.conf rather than 8.8.4.4 set in /etc/sysconfig/network-scripts/ifcfg-eth1






            share|improve this answer




























              0














              Well i tried it out and found out that /etc/resolv.conf takes presedence over /etc/sysconfig/network-scripts/ifcfg-eth file. You can go through my configuration and a dig output below. I rebooted the system after initially saving this configuration.



              [root@KKcentOSVM karunakar]# cat /etc/resolv.conf
              ; custom entries
              search localdomain
              nameserver 8.8.8.8
              nameserver 4.2.2.2
              [root@KKcentOSVM karunakar]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
              HWADDR=00:0C:29:E7:72:60
              TYPE=Ethernet
              BOOTPROTO=none
              IPADDR=192.168.186.131
              NETMASK=255.255.255.0
              GATEWAY=192.168.186.2
              NAME=eth1
              NM_CONTROLLED=no
              ONBOOT=yes
              DNS1=8.8.4.4
              DNS2=4.2.2.2
              PEERDNS=no
              [root@KKcentOSVM karunakar]# dig www.google.com

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.68.rc1.el6_10.1 <<>> www.google.com
              ;; global options: +cmd
              ;; Got answer:
              ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38527
              ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

              ;; QUESTION SECTION:
              ;www.google.com. IN A

              ;; ANSWER SECTION:
              www.google.com. 69 IN A 216.58.200.132

              ;; Query time: 196 msec
              ;; SERVER: 8.8.8.8#53(8.8.8.8)
              ;; WHEN: Mon Jan 7 20:50:00 2019
              ;; MSG SIZE rcvd: 48


              You can verify from the third last line from the output of



              dig www.google.com


              which is



              ;; SERVER: 8.8.8.8#53(8.8.8.8)


              that the url was resolved by the nameserver 8.8.8.8 set in /etc/resolv.conf rather than 8.8.4.4 set in /etc/sysconfig/network-scripts/ifcfg-eth1






              share|improve this answer


























                0












                0








                0







                Well i tried it out and found out that /etc/resolv.conf takes presedence over /etc/sysconfig/network-scripts/ifcfg-eth file. You can go through my configuration and a dig output below. I rebooted the system after initially saving this configuration.



                [root@KKcentOSVM karunakar]# cat /etc/resolv.conf
                ; custom entries
                search localdomain
                nameserver 8.8.8.8
                nameserver 4.2.2.2
                [root@KKcentOSVM karunakar]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
                HWADDR=00:0C:29:E7:72:60
                TYPE=Ethernet
                BOOTPROTO=none
                IPADDR=192.168.186.131
                NETMASK=255.255.255.0
                GATEWAY=192.168.186.2
                NAME=eth1
                NM_CONTROLLED=no
                ONBOOT=yes
                DNS1=8.8.4.4
                DNS2=4.2.2.2
                PEERDNS=no
                [root@KKcentOSVM karunakar]# dig www.google.com

                ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.68.rc1.el6_10.1 <<>> www.google.com
                ;; global options: +cmd
                ;; Got answer:
                ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38527
                ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

                ;; QUESTION SECTION:
                ;www.google.com. IN A

                ;; ANSWER SECTION:
                www.google.com. 69 IN A 216.58.200.132

                ;; Query time: 196 msec
                ;; SERVER: 8.8.8.8#53(8.8.8.8)
                ;; WHEN: Mon Jan 7 20:50:00 2019
                ;; MSG SIZE rcvd: 48


                You can verify from the third last line from the output of



                dig www.google.com


                which is



                ;; SERVER: 8.8.8.8#53(8.8.8.8)


                that the url was resolved by the nameserver 8.8.8.8 set in /etc/resolv.conf rather than 8.8.4.4 set in /etc/sysconfig/network-scripts/ifcfg-eth1






                share|improve this answer













                Well i tried it out and found out that /etc/resolv.conf takes presedence over /etc/sysconfig/network-scripts/ifcfg-eth file. You can go through my configuration and a dig output below. I rebooted the system after initially saving this configuration.



                [root@KKcentOSVM karunakar]# cat /etc/resolv.conf
                ; custom entries
                search localdomain
                nameserver 8.8.8.8
                nameserver 4.2.2.2
                [root@KKcentOSVM karunakar]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
                HWADDR=00:0C:29:E7:72:60
                TYPE=Ethernet
                BOOTPROTO=none
                IPADDR=192.168.186.131
                NETMASK=255.255.255.0
                GATEWAY=192.168.186.2
                NAME=eth1
                NM_CONTROLLED=no
                ONBOOT=yes
                DNS1=8.8.4.4
                DNS2=4.2.2.2
                PEERDNS=no
                [root@KKcentOSVM karunakar]# dig www.google.com

                ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.68.rc1.el6_10.1 <<>> www.google.com
                ;; global options: +cmd
                ;; Got answer:
                ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38527
                ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

                ;; QUESTION SECTION:
                ;www.google.com. IN A

                ;; ANSWER SECTION:
                www.google.com. 69 IN A 216.58.200.132

                ;; Query time: 196 msec
                ;; SERVER: 8.8.8.8#53(8.8.8.8)
                ;; WHEN: Mon Jan 7 20:50:00 2019
                ;; MSG SIZE rcvd: 48


                You can verify from the third last line from the output of



                dig www.google.com


                which is



                ;; SERVER: 8.8.8.8#53(8.8.8.8)


                that the url was resolved by the nameserver 8.8.8.8 set in /etc/resolv.conf rather than 8.8.4.4 set in /etc/sysconfig/network-scripts/ifcfg-eth1







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 6 at 15:38









                Karunkar BorahKarunkar Borah

                13




                13






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1391162%2fnameserver-in-etc-resolv-conf-vs-etc-sysconfig-ifcfg-eth0-on-centos-6-rhel-6%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

                    Сан-Квентин

                    8-я гвардейская общевойсковая армия

                    Алькесар