netplan apply does not change the IP address












1















ok, my file is located at /etc/netplan/50-cloud-init.yaml
I changed the IP address as a static IP address as following:



network:
version: 2

renderer: netwokrd

ethernets:

dhcp4: no
dhcp6: no
addresses: [10.0.2.100/24]
gateway4: 10.0.2.1
nameservers:
addresses: [10.0.2.100]


Then, I typed sudo netplan apply, and there was not any error message.
BUT, when I typed ifconfig, it still remail past IP address on enp0s3.
Do you guys know why this happen?










share|improve this question





























    1















    ok, my file is located at /etc/netplan/50-cloud-init.yaml
    I changed the IP address as a static IP address as following:



    network:
    version: 2

    renderer: netwokrd

    ethernets:

    dhcp4: no
    dhcp6: no
    addresses: [10.0.2.100/24]
    gateway4: 10.0.2.1
    nameservers:
    addresses: [10.0.2.100]


    Then, I typed sudo netplan apply, and there was not any error message.
    BUT, when I typed ifconfig, it still remail past IP address on enp0s3.
    Do you guys know why this happen?










    share|improve this question



























      1












      1








      1








      ok, my file is located at /etc/netplan/50-cloud-init.yaml
      I changed the IP address as a static IP address as following:



      network:
      version: 2

      renderer: netwokrd

      ethernets:

      dhcp4: no
      dhcp6: no
      addresses: [10.0.2.100/24]
      gateway4: 10.0.2.1
      nameservers:
      addresses: [10.0.2.100]


      Then, I typed sudo netplan apply, and there was not any error message.
      BUT, when I typed ifconfig, it still remail past IP address on enp0s3.
      Do you guys know why this happen?










      share|improve this question
















      ok, my file is located at /etc/netplan/50-cloud-init.yaml
      I changed the IP address as a static IP address as following:



      network:
      version: 2

      renderer: netwokrd

      ethernets:

      dhcp4: no
      dhcp6: no
      addresses: [10.0.2.100/24]
      gateway4: 10.0.2.1
      nameservers:
      addresses: [10.0.2.100]


      Then, I typed sudo netplan apply, and there was not any error message.
      BUT, when I typed ifconfig, it still remail past IP address on enp0s3.
      Do you guys know why this happen?







      networking server netplan






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 13 '18 at 14:05









      chili555

      39k55280




      39k55280










      asked Oct 13 '18 at 6:04









      강찬희강찬희

      364




      364






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Netplan is fussy about how .yaml files are formatted. Don't try to "pretty-fy" them.



          Is 50-cloud-init.yaml the only .yaml file in /etc/netplan?



          So edit your .yaml file to look like this...



          network:
          version: 2
          renderer: networkd <-- note the correct spelling
          ethernets:
          enp0s3: <-- identify the proper interface
          dhcp4: no
          dhcp6: no
          addresses: [10.0.2.100/24]
          gateway4: 10.0.2.1
          nameservers:
          addresses: [10.0.2.100] <-- this is probably the wrong address
          addresses: [8.8.8.8, 8.8.4.4] <-- use something like this instead


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer


          and recheck your ifconfig output.



          Note: if it was me, I'd let NetworkManager manage this interface, and set the static address information into the "Wired Connection" profile.



          network:
          version: 2
          renderer: NetworkManager


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer





          share|improve this answer


























          • since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

            – slangasek
            Oct 25 '18 at 5:20











          • Why do you must reboot? Is there any other way?

            – Nimitack
            Dec 17 '18 at 9:19











          • @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

            – heynnema
            Dec 17 '18 at 13:29











          • I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

            – Nimitack
            Dec 18 '18 at 12:48











          • @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

            – heynnema
            Dec 18 '18 at 14:30











          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%2f1083390%2fnetplan-apply-does-not-change-the-ip-address%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









          2














          Netplan is fussy about how .yaml files are formatted. Don't try to "pretty-fy" them.



          Is 50-cloud-init.yaml the only .yaml file in /etc/netplan?



          So edit your .yaml file to look like this...



          network:
          version: 2
          renderer: networkd <-- note the correct spelling
          ethernets:
          enp0s3: <-- identify the proper interface
          dhcp4: no
          dhcp6: no
          addresses: [10.0.2.100/24]
          gateway4: 10.0.2.1
          nameservers:
          addresses: [10.0.2.100] <-- this is probably the wrong address
          addresses: [8.8.8.8, 8.8.4.4] <-- use something like this instead


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer


          and recheck your ifconfig output.



          Note: if it was me, I'd let NetworkManager manage this interface, and set the static address information into the "Wired Connection" profile.



          network:
          version: 2
          renderer: NetworkManager


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer





          share|improve this answer


























          • since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

            – slangasek
            Oct 25 '18 at 5:20











          • Why do you must reboot? Is there any other way?

            – Nimitack
            Dec 17 '18 at 9:19











          • @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

            – heynnema
            Dec 17 '18 at 13:29











          • I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

            – Nimitack
            Dec 18 '18 at 12:48











          • @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

            – heynnema
            Dec 18 '18 at 14:30
















          2














          Netplan is fussy about how .yaml files are formatted. Don't try to "pretty-fy" them.



          Is 50-cloud-init.yaml the only .yaml file in /etc/netplan?



          So edit your .yaml file to look like this...



          network:
          version: 2
          renderer: networkd <-- note the correct spelling
          ethernets:
          enp0s3: <-- identify the proper interface
          dhcp4: no
          dhcp6: no
          addresses: [10.0.2.100/24]
          gateway4: 10.0.2.1
          nameservers:
          addresses: [10.0.2.100] <-- this is probably the wrong address
          addresses: [8.8.8.8, 8.8.4.4] <-- use something like this instead


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer


          and recheck your ifconfig output.



          Note: if it was me, I'd let NetworkManager manage this interface, and set the static address information into the "Wired Connection" profile.



          network:
          version: 2
          renderer: NetworkManager


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer





          share|improve this answer


























          • since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

            – slangasek
            Oct 25 '18 at 5:20











          • Why do you must reboot? Is there any other way?

            – Nimitack
            Dec 17 '18 at 9:19











          • @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

            – heynnema
            Dec 17 '18 at 13:29











          • I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

            – Nimitack
            Dec 18 '18 at 12:48











          • @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

            – heynnema
            Dec 18 '18 at 14:30














          2












          2








          2







          Netplan is fussy about how .yaml files are formatted. Don't try to "pretty-fy" them.



          Is 50-cloud-init.yaml the only .yaml file in /etc/netplan?



          So edit your .yaml file to look like this...



          network:
          version: 2
          renderer: networkd <-- note the correct spelling
          ethernets:
          enp0s3: <-- identify the proper interface
          dhcp4: no
          dhcp6: no
          addresses: [10.0.2.100/24]
          gateway4: 10.0.2.1
          nameservers:
          addresses: [10.0.2.100] <-- this is probably the wrong address
          addresses: [8.8.8.8, 8.8.4.4] <-- use something like this instead


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer


          and recheck your ifconfig output.



          Note: if it was me, I'd let NetworkManager manage this interface, and set the static address information into the "Wired Connection" profile.



          network:
          version: 2
          renderer: NetworkManager


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer





          share|improve this answer















          Netplan is fussy about how .yaml files are formatted. Don't try to "pretty-fy" them.



          Is 50-cloud-init.yaml the only .yaml file in /etc/netplan?



          So edit your .yaml file to look like this...



          network:
          version: 2
          renderer: networkd <-- note the correct spelling
          ethernets:
          enp0s3: <-- identify the proper interface
          dhcp4: no
          dhcp6: no
          addresses: [10.0.2.100/24]
          gateway4: 10.0.2.1
          nameservers:
          addresses: [10.0.2.100] <-- this is probably the wrong address
          addresses: [8.8.8.8, 8.8.4.4] <-- use something like this instead


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer


          and recheck your ifconfig output.



          Note: if it was me, I'd let NetworkManager manage this interface, and set the static address information into the "Wired Connection" profile.



          network:
          version: 2
          renderer: NetworkManager


          then do:



          sudo netplan --debug generate  # generate the config files
          sudo netplan apply # apply the new configuration
          reboot # reboot the computer






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 2 at 4:23

























          answered Oct 13 '18 at 15:37









          heynnemaheynnema

          21k22360




          21k22360













          • since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

            – slangasek
            Oct 25 '18 at 5:20











          • Why do you must reboot? Is there any other way?

            – Nimitack
            Dec 17 '18 at 9:19











          • @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

            – heynnema
            Dec 17 '18 at 13:29











          • I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

            – Nimitack
            Dec 18 '18 at 12:48











          • @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

            – heynnema
            Dec 18 '18 at 14:30



















          • since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

            – slangasek
            Oct 25 '18 at 5:20











          • Why do you must reboot? Is there any other way?

            – Nimitack
            Dec 17 '18 at 9:19











          • @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

            – heynnema
            Dec 17 '18 at 13:29











          • I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

            – Nimitack
            Dec 18 '18 at 12:48











          • @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

            – heynnema
            Dec 18 '18 at 14:30

















          since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

          – slangasek
          Oct 25 '18 at 5:20





          since the netplan config is in /etc/netplan/50-cloud-init.yaml it is likely this is a cloud image which has no NetworkManager installed.

          – slangasek
          Oct 25 '18 at 5:20













          Why do you must reboot? Is there any other way?

          – Nimitack
          Dec 17 '18 at 9:19





          Why do you must reboot? Is there any other way?

          – Nimitack
          Dec 17 '18 at 9:19













          @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

          – heynnema
          Dec 17 '18 at 13:29





          @Nimitack technically, the sudo netplan -debug generate and sudo netplan apply commands should do it, but I've seen cases where it didn't, and a reboot will actually start with the netplan configuration you've set, and you can confirm that it's working as expected.

          – heynnema
          Dec 17 '18 at 13:29













          I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

          – Nimitack
          Dec 18 '18 at 12:48





          I see this issue on vmware machine and on virtual box.. when I install ubuntu 18.04... I really need this to NOT reboot.. I couldn't find anything about this on the web.. this is pretty basic stuff, static IP. I don't understand why to reset it.. it's not hardware or so..., Linux is all about NOT rebooting right?

          – Nimitack
          Dec 18 '18 at 12:48













          @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

          – heynnema
          Dec 18 '18 at 14:30





          @Nimitack I'm confused. I indicated that a reboot is not mandatory, however, it MAY be required if the sudo netplan apply doesn't do it.

          – heynnema
          Dec 18 '18 at 14:30


















          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%2f1083390%2fnetplan-apply-does-not-change-the-ip-address%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?