How do I reload network configuration with cloud-init?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I've installed Ubuntu Server 18.04, and instead of the old /etc/network/interfaces, it seems that my network configuration now lives in a series of YAML files in /etc/netplan, of which the only one I actually have is /etc/netplan/50-cloud-init.yaml:



# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
ens3:
addresses:
dhcp4: true
dhcp6: true
nameservers: {}
optional: true
ens4:
addresses:
dhcp4: true
dhcp6: true
nameservers: {}
optional: true
version: 2


That seems to have been generated by cloud-init, from /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg:



network:
ethernets:
ens3:
addresses:
dhcp4: true
dhcp6: true
nameservers: {}
optional: true
ens4:
addresses:
dhcp4: true
dhcp6: true
nameservers: {}
optional: true
version: 2


What's the right way to edit this configuration and apply the changes to the running machine? The comment in the Netplan file suggested to me that it's ephemeral and generated on reboot by cloud-init, so I should edit cloud-init's config. But even after editing it and rebooting, I don't see any changes to the Netplan file, and I definitely don't know how to apply the cloud-init config changes manually. And upon reading the comment again, now it seems to me that it's talking about changes not persisting across destruction and recreation of the machine, which would seem to go without saying. So clearly I'm misunderstanding something.



So my question is:




  1. Where in the new cloud-init/netplan system am I supposed to be putting manual network configuration?


  2. How do I apply changes I make in /etc/netplan?


  3. How do I apply changes I make in /etc/cloud/cloud.cfg.d?











share|improve this question





























    1















    I've installed Ubuntu Server 18.04, and instead of the old /etc/network/interfaces, it seems that my network configuration now lives in a series of YAML files in /etc/netplan, of which the only one I actually have is /etc/netplan/50-cloud-init.yaml:



    # This file is generated from information provided by
    # the datasource. Changes to it will not persist across an instance.
    # To disable cloud-init's network configuration capabilities, write a file
    # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
    # network: {config: disabled}
    network:
    ethernets:
    ens3:
    addresses:
    dhcp4: true
    dhcp6: true
    nameservers: {}
    optional: true
    ens4:
    addresses:
    dhcp4: true
    dhcp6: true
    nameservers: {}
    optional: true
    version: 2


    That seems to have been generated by cloud-init, from /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg:



    network:
    ethernets:
    ens3:
    addresses:
    dhcp4: true
    dhcp6: true
    nameservers: {}
    optional: true
    ens4:
    addresses:
    dhcp4: true
    dhcp6: true
    nameservers: {}
    optional: true
    version: 2


    What's the right way to edit this configuration and apply the changes to the running machine? The comment in the Netplan file suggested to me that it's ephemeral and generated on reboot by cloud-init, so I should edit cloud-init's config. But even after editing it and rebooting, I don't see any changes to the Netplan file, and I definitely don't know how to apply the cloud-init config changes manually. And upon reading the comment again, now it seems to me that it's talking about changes not persisting across destruction and recreation of the machine, which would seem to go without saying. So clearly I'm misunderstanding something.



    So my question is:




    1. Where in the new cloud-init/netplan system am I supposed to be putting manual network configuration?


    2. How do I apply changes I make in /etc/netplan?


    3. How do I apply changes I make in /etc/cloud/cloud.cfg.d?











    share|improve this question

























      1












      1








      1








      I've installed Ubuntu Server 18.04, and instead of the old /etc/network/interfaces, it seems that my network configuration now lives in a series of YAML files in /etc/netplan, of which the only one I actually have is /etc/netplan/50-cloud-init.yaml:



      # This file is generated from information provided by
      # the datasource. Changes to it will not persist across an instance.
      # To disable cloud-init's network configuration capabilities, write a file
      # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
      # network: {config: disabled}
      network:
      ethernets:
      ens3:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      ens4:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      version: 2


      That seems to have been generated by cloud-init, from /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg:



      network:
      ethernets:
      ens3:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      ens4:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      version: 2


      What's the right way to edit this configuration and apply the changes to the running machine? The comment in the Netplan file suggested to me that it's ephemeral and generated on reboot by cloud-init, so I should edit cloud-init's config. But even after editing it and rebooting, I don't see any changes to the Netplan file, and I definitely don't know how to apply the cloud-init config changes manually. And upon reading the comment again, now it seems to me that it's talking about changes not persisting across destruction and recreation of the machine, which would seem to go without saying. So clearly I'm misunderstanding something.



      So my question is:




      1. Where in the new cloud-init/netplan system am I supposed to be putting manual network configuration?


      2. How do I apply changes I make in /etc/netplan?


      3. How do I apply changes I make in /etc/cloud/cloud.cfg.d?











      share|improve this question














      I've installed Ubuntu Server 18.04, and instead of the old /etc/network/interfaces, it seems that my network configuration now lives in a series of YAML files in /etc/netplan, of which the only one I actually have is /etc/netplan/50-cloud-init.yaml:



      # This file is generated from information provided by
      # the datasource. Changes to it will not persist across an instance.
      # To disable cloud-init's network configuration capabilities, write a file
      # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
      # network: {config: disabled}
      network:
      ethernets:
      ens3:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      ens4:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      version: 2


      That seems to have been generated by cloud-init, from /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg:



      network:
      ethernets:
      ens3:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      ens4:
      addresses:
      dhcp4: true
      dhcp6: true
      nameservers: {}
      optional: true
      version: 2


      What's the right way to edit this configuration and apply the changes to the running machine? The comment in the Netplan file suggested to me that it's ephemeral and generated on reboot by cloud-init, so I should edit cloud-init's config. But even after editing it and rebooting, I don't see any changes to the Netplan file, and I definitely don't know how to apply the cloud-init config changes manually. And upon reading the comment again, now it seems to me that it's talking about changes not persisting across destruction and recreation of the machine, which would seem to go without saying. So clearly I'm misunderstanding something.



      So my question is:




      1. Where in the new cloud-init/netplan system am I supposed to be putting manual network configuration?


      2. How do I apply changes I make in /etc/netplan?


      3. How do I apply changes I make in /etc/cloud/cloud.cfg.d?








      networking 18.04 cloud netplan cloud-init






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 24 '18 at 16:59









      interfectinterfect

      22717




      22717






















          1 Answer
          1






          active

          oldest

          votes


















          1














          First, you backup the current /etc/netplan/*.yaml file to something like /etc/netplan/*.yaml.BAK.



          Then you make any changes you desire to /etc/netplan/*.yaml. Indentation and spacing and no tabs, are VERY important when creating/editing a .yaml file.



          FYI: your existing .yaml files should start with:



          network:
          version: 2
          renderer: networkd


          Then:



          sudo netplan --debug generate # generate config files



          sudo netplan apply # apply to the current system



          reboot # to confirm proper operation



          For further examples and configuration guidelines see https://netplan.io/examples






          share|improve this answer


























            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%2f1104285%2fhow-do-i-reload-network-configuration-with-cloud-init%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









            1














            First, you backup the current /etc/netplan/*.yaml file to something like /etc/netplan/*.yaml.BAK.



            Then you make any changes you desire to /etc/netplan/*.yaml. Indentation and spacing and no tabs, are VERY important when creating/editing a .yaml file.



            FYI: your existing .yaml files should start with:



            network:
            version: 2
            renderer: networkd


            Then:



            sudo netplan --debug generate # generate config files



            sudo netplan apply # apply to the current system



            reboot # to confirm proper operation



            For further examples and configuration guidelines see https://netplan.io/examples






            share|improve this answer






























              1














              First, you backup the current /etc/netplan/*.yaml file to something like /etc/netplan/*.yaml.BAK.



              Then you make any changes you desire to /etc/netplan/*.yaml. Indentation and spacing and no tabs, are VERY important when creating/editing a .yaml file.



              FYI: your existing .yaml files should start with:



              network:
              version: 2
              renderer: networkd


              Then:



              sudo netplan --debug generate # generate config files



              sudo netplan apply # apply to the current system



              reboot # to confirm proper operation



              For further examples and configuration guidelines see https://netplan.io/examples






              share|improve this answer




























                1












                1








                1







                First, you backup the current /etc/netplan/*.yaml file to something like /etc/netplan/*.yaml.BAK.



                Then you make any changes you desire to /etc/netplan/*.yaml. Indentation and spacing and no tabs, are VERY important when creating/editing a .yaml file.



                FYI: your existing .yaml files should start with:



                network:
                version: 2
                renderer: networkd


                Then:



                sudo netplan --debug generate # generate config files



                sudo netplan apply # apply to the current system



                reboot # to confirm proper operation



                For further examples and configuration guidelines see https://netplan.io/examples






                share|improve this answer















                First, you backup the current /etc/netplan/*.yaml file to something like /etc/netplan/*.yaml.BAK.



                Then you make any changes you desire to /etc/netplan/*.yaml. Indentation and spacing and no tabs, are VERY important when creating/editing a .yaml file.



                FYI: your existing .yaml files should start with:



                network:
                version: 2
                renderer: networkd


                Then:



                sudo netplan --debug generate # generate config files



                sudo netplan apply # apply to the current system



                reboot # to confirm proper operation



                For further examples and configuration guidelines see https://netplan.io/examples







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 16 hours ago

























                answered Dec 24 '18 at 17:13









                heynnemaheynnema

                21.3k22360




                21.3k22360






























                    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%2f1104285%2fhow-do-i-reload-network-configuration-with-cloud-init%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

                    GameSpot

                    connect to host localhost port 22: Connection refused

                    Getting a Wifi WPA2 wifi connection