AWS cloud-config not setting dns-nameservers











up vote
0
down vote

favorite












Here is the cloud.cfg on my instance (I had tampered it manually when provisioning the ami from which I launched the instance)



root@ip-10-17-0-121:~# cat /etc/cloud/cloud.cfg | grep -i resol -C 3

# Network configuration for ami
manage_resolv_conf: true

resolv_conf:
nameservers: ['10.11.4.1']


However this is never taken into account given that:



# cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.17.0.2
search eu-west-1.compute.internal


I have tried with and without creating the following file



# cat /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
network: {config: disabled}









share|improve this question


























    up vote
    0
    down vote

    favorite












    Here is the cloud.cfg on my instance (I had tampered it manually when provisioning the ami from which I launched the instance)



    root@ip-10-17-0-121:~# cat /etc/cloud/cloud.cfg | grep -i resol -C 3

    # Network configuration for ami
    manage_resolv_conf: true

    resolv_conf:
    nameservers: ['10.11.4.1']


    However this is never taken into account given that:



    # cat /etc/resolv.conf 
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 10.17.0.2
    search eu-west-1.compute.internal


    I have tried with and without creating the following file



    # cat /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
    network: {config: disabled}









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Here is the cloud.cfg on my instance (I had tampered it manually when provisioning the ami from which I launched the instance)



      root@ip-10-17-0-121:~# cat /etc/cloud/cloud.cfg | grep -i resol -C 3

      # Network configuration for ami
      manage_resolv_conf: true

      resolv_conf:
      nameservers: ['10.11.4.1']


      However this is never taken into account given that:



      # cat /etc/resolv.conf 
      # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
      # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
      nameserver 10.17.0.2
      search eu-west-1.compute.internal


      I have tried with and without creating the following file



      # cat /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
      network: {config: disabled}









      share|improve this question













      Here is the cloud.cfg on my instance (I had tampered it manually when provisioning the ami from which I launched the instance)



      root@ip-10-17-0-121:~# cat /etc/cloud/cloud.cfg | grep -i resol -C 3

      # Network configuration for ami
      manage_resolv_conf: true

      resolv_conf:
      nameservers: ['10.11.4.1']


      However this is never taken into account given that:



      # cat /etc/resolv.conf 
      # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
      # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
      nameserver 10.17.0.2
      search eu-west-1.compute.internal


      I have tried with and without creating the following file



      # cat /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
      network: {config: disabled}






      amazon-web-services amazon-ec2 cloud cloud-init






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 at 15:01









      pkaramol

      1,80611437




      1,80611437
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I managed to make my instance obtain my custom dns-nameserver as follows



          - name: pre_tasks --> Add my custom dns-nameserver
          lineinfile:
          path: /etc/dhcp/dhclient.conf
          regexp: '^#prepend domain-name-servers'
          line: 'prepend domain-name-servers 10.11.4.1;'
          become: yes


          However now I am getting the following warning:



          pkara@ip-10-17-0-35:~$ sudo -i
          sudo: unable to resolve host ip-10-17-0-35


          not accepting my answer until / unless I address this;



          edit_1: adding this to my cloud-config.yml which I am setting as user data did not help much:



          hostname: localhost
          manage_etc_hosts: true


          edit_2: adding this to my cloud-config.cfg helped me to address the above unable to resolve host problemn



          bootcmd:
          - echo "127.0.0.1 $(hostname)" >> /etc/hosts





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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',
            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%2fstackoverflow.com%2fquestions%2f53377346%2faws-cloud-config-not-setting-dns-nameservers%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I managed to make my instance obtain my custom dns-nameserver as follows



            - name: pre_tasks --> Add my custom dns-nameserver
            lineinfile:
            path: /etc/dhcp/dhclient.conf
            regexp: '^#prepend domain-name-servers'
            line: 'prepend domain-name-servers 10.11.4.1;'
            become: yes


            However now I am getting the following warning:



            pkara@ip-10-17-0-35:~$ sudo -i
            sudo: unable to resolve host ip-10-17-0-35


            not accepting my answer until / unless I address this;



            edit_1: adding this to my cloud-config.yml which I am setting as user data did not help much:



            hostname: localhost
            manage_etc_hosts: true


            edit_2: adding this to my cloud-config.cfg helped me to address the above unable to resolve host problemn



            bootcmd:
            - echo "127.0.0.1 $(hostname)" >> /etc/hosts





            share|improve this answer



























              up vote
              0
              down vote













              I managed to make my instance obtain my custom dns-nameserver as follows



              - name: pre_tasks --> Add my custom dns-nameserver
              lineinfile:
              path: /etc/dhcp/dhclient.conf
              regexp: '^#prepend domain-name-servers'
              line: 'prepend domain-name-servers 10.11.4.1;'
              become: yes


              However now I am getting the following warning:



              pkara@ip-10-17-0-35:~$ sudo -i
              sudo: unable to resolve host ip-10-17-0-35


              not accepting my answer until / unless I address this;



              edit_1: adding this to my cloud-config.yml which I am setting as user data did not help much:



              hostname: localhost
              manage_etc_hosts: true


              edit_2: adding this to my cloud-config.cfg helped me to address the above unable to resolve host problemn



              bootcmd:
              - echo "127.0.0.1 $(hostname)" >> /etc/hosts





              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                I managed to make my instance obtain my custom dns-nameserver as follows



                - name: pre_tasks --> Add my custom dns-nameserver
                lineinfile:
                path: /etc/dhcp/dhclient.conf
                regexp: '^#prepend domain-name-servers'
                line: 'prepend domain-name-servers 10.11.4.1;'
                become: yes


                However now I am getting the following warning:



                pkara@ip-10-17-0-35:~$ sudo -i
                sudo: unable to resolve host ip-10-17-0-35


                not accepting my answer until / unless I address this;



                edit_1: adding this to my cloud-config.yml which I am setting as user data did not help much:



                hostname: localhost
                manage_etc_hosts: true


                edit_2: adding this to my cloud-config.cfg helped me to address the above unable to resolve host problemn



                bootcmd:
                - echo "127.0.0.1 $(hostname)" >> /etc/hosts





                share|improve this answer














                I managed to make my instance obtain my custom dns-nameserver as follows



                - name: pre_tasks --> Add my custom dns-nameserver
                lineinfile:
                path: /etc/dhcp/dhclient.conf
                regexp: '^#prepend domain-name-servers'
                line: 'prepend domain-name-servers 10.11.4.1;'
                become: yes


                However now I am getting the following warning:



                pkara@ip-10-17-0-35:~$ sudo -i
                sudo: unable to resolve host ip-10-17-0-35


                not accepting my answer until / unless I address this;



                edit_1: adding this to my cloud-config.yml which I am setting as user data did not help much:



                hostname: localhost
                manage_etc_hosts: true


                edit_2: adding this to my cloud-config.cfg helped me to address the above unable to resolve host problemn



                bootcmd:
                - echo "127.0.0.1 $(hostname)" >> /etc/hosts






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 20 at 8:02

























                answered Nov 19 at 17:19









                pkaramol

                1,80611437




                1,80611437






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377346%2faws-cloud-config-not-setting-dns-nameservers%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

                    Wiesbaden

                    Marschland

                    Dieringhausen