network restart fail on Ubuntu server 16.04











up vote
0
down vote

favorite












In Ubuntu 16.04 server I want to change IP from /etc/network/interfaces and run sudo service networking restart and there is no error given but the IP didn't change.



I also ran sudo systemctl networking restart and sudo ifdown eth0 && sudo ifup eth0 but the IP doesn't change.
How do I restart the network interface in Ubuntu 16.04 so it saves the changes?










share|improve this question
























  • I think you're on a normal home-network. Those use usually the Dynamic Host Configuration Protocol (DHCP). If the DHCP-Server doesn't assign that IP to you, you won't get that IP (no matter what you configure on /etc/networking/interfaces). Worse, you could even get no net at all, if you misconfigured.
    – Bobby
    Jul 19 '16 at 8:56










  • @ManuToMatic I need to set static IP on interface!
    – Sajad Bahmani
    Jul 19 '16 at 8:58










  • Yes, and in the DHCP-Server too. If your server says "Yo, I'm configured to use 192.0.0.42 so give it to me!" but your DHCP (Router/Modem) answers "Yeah, nice. But I only distribute 192.168.0.2 to 192.168.0.50 so you get that nice 192.168.0.31", then your server gets 192.168.0.31 and not the IP he wants. If you want more information about how DHCP works: en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
    – Bobby
    Jul 19 '16 at 9:03












  • @ManuToMatic I don't have any DHCP server in my network and need set static IP
    – Sajad Bahmani
    Jul 19 '16 at 9:04










  • What? So how is your network configured? Believe me, if you didn't do anything special, your router IS a DHCP-Server. Alternatively you could explain exactly how your network is set up so we'd know more specific what we're on.
    – Bobby
    Jul 19 '16 at 9:06















up vote
0
down vote

favorite












In Ubuntu 16.04 server I want to change IP from /etc/network/interfaces and run sudo service networking restart and there is no error given but the IP didn't change.



I also ran sudo systemctl networking restart and sudo ifdown eth0 && sudo ifup eth0 but the IP doesn't change.
How do I restart the network interface in Ubuntu 16.04 so it saves the changes?










share|improve this question
























  • I think you're on a normal home-network. Those use usually the Dynamic Host Configuration Protocol (DHCP). If the DHCP-Server doesn't assign that IP to you, you won't get that IP (no matter what you configure on /etc/networking/interfaces). Worse, you could even get no net at all, if you misconfigured.
    – Bobby
    Jul 19 '16 at 8:56










  • @ManuToMatic I need to set static IP on interface!
    – Sajad Bahmani
    Jul 19 '16 at 8:58










  • Yes, and in the DHCP-Server too. If your server says "Yo, I'm configured to use 192.0.0.42 so give it to me!" but your DHCP (Router/Modem) answers "Yeah, nice. But I only distribute 192.168.0.2 to 192.168.0.50 so you get that nice 192.168.0.31", then your server gets 192.168.0.31 and not the IP he wants. If you want more information about how DHCP works: en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
    – Bobby
    Jul 19 '16 at 9:03












  • @ManuToMatic I don't have any DHCP server in my network and need set static IP
    – Sajad Bahmani
    Jul 19 '16 at 9:04










  • What? So how is your network configured? Believe me, if you didn't do anything special, your router IS a DHCP-Server. Alternatively you could explain exactly how your network is set up so we'd know more specific what we're on.
    – Bobby
    Jul 19 '16 at 9:06













up vote
0
down vote

favorite









up vote
0
down vote

favorite











In Ubuntu 16.04 server I want to change IP from /etc/network/interfaces and run sudo service networking restart and there is no error given but the IP didn't change.



I also ran sudo systemctl networking restart and sudo ifdown eth0 && sudo ifup eth0 but the IP doesn't change.
How do I restart the network interface in Ubuntu 16.04 so it saves the changes?










share|improve this question















In Ubuntu 16.04 server I want to change IP from /etc/network/interfaces and run sudo service networking restart and there is no error given but the IP didn't change.



I also ran sudo systemctl networking restart and sudo ifdown eth0 && sudo ifup eth0 but the IP doesn't change.
How do I restart the network interface in Ubuntu 16.04 so it saves the changes?







networking server 16.04 systemd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 19 '16 at 8:51

























asked Jul 19 '16 at 8:39









Sajad Bahmani

814922




814922












  • I think you're on a normal home-network. Those use usually the Dynamic Host Configuration Protocol (DHCP). If the DHCP-Server doesn't assign that IP to you, you won't get that IP (no matter what you configure on /etc/networking/interfaces). Worse, you could even get no net at all, if you misconfigured.
    – Bobby
    Jul 19 '16 at 8:56










  • @ManuToMatic I need to set static IP on interface!
    – Sajad Bahmani
    Jul 19 '16 at 8:58










  • Yes, and in the DHCP-Server too. If your server says "Yo, I'm configured to use 192.0.0.42 so give it to me!" but your DHCP (Router/Modem) answers "Yeah, nice. But I only distribute 192.168.0.2 to 192.168.0.50 so you get that nice 192.168.0.31", then your server gets 192.168.0.31 and not the IP he wants. If you want more information about how DHCP works: en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
    – Bobby
    Jul 19 '16 at 9:03












  • @ManuToMatic I don't have any DHCP server in my network and need set static IP
    – Sajad Bahmani
    Jul 19 '16 at 9:04










  • What? So how is your network configured? Believe me, if you didn't do anything special, your router IS a DHCP-Server. Alternatively you could explain exactly how your network is set up so we'd know more specific what we're on.
    – Bobby
    Jul 19 '16 at 9:06


















  • I think you're on a normal home-network. Those use usually the Dynamic Host Configuration Protocol (DHCP). If the DHCP-Server doesn't assign that IP to you, you won't get that IP (no matter what you configure on /etc/networking/interfaces). Worse, you could even get no net at all, if you misconfigured.
    – Bobby
    Jul 19 '16 at 8:56










  • @ManuToMatic I need to set static IP on interface!
    – Sajad Bahmani
    Jul 19 '16 at 8:58










  • Yes, and in the DHCP-Server too. If your server says "Yo, I'm configured to use 192.0.0.42 so give it to me!" but your DHCP (Router/Modem) answers "Yeah, nice. But I only distribute 192.168.0.2 to 192.168.0.50 so you get that nice 192.168.0.31", then your server gets 192.168.0.31 and not the IP he wants. If you want more information about how DHCP works: en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
    – Bobby
    Jul 19 '16 at 9:03












  • @ManuToMatic I don't have any DHCP server in my network and need set static IP
    – Sajad Bahmani
    Jul 19 '16 at 9:04










  • What? So how is your network configured? Believe me, if you didn't do anything special, your router IS a DHCP-Server. Alternatively you could explain exactly how your network is set up so we'd know more specific what we're on.
    – Bobby
    Jul 19 '16 at 9:06
















I think you're on a normal home-network. Those use usually the Dynamic Host Configuration Protocol (DHCP). If the DHCP-Server doesn't assign that IP to you, you won't get that IP (no matter what you configure on /etc/networking/interfaces). Worse, you could even get no net at all, if you misconfigured.
– Bobby
Jul 19 '16 at 8:56




I think you're on a normal home-network. Those use usually the Dynamic Host Configuration Protocol (DHCP). If the DHCP-Server doesn't assign that IP to you, you won't get that IP (no matter what you configure on /etc/networking/interfaces). Worse, you could even get no net at all, if you misconfigured.
– Bobby
Jul 19 '16 at 8:56












@ManuToMatic I need to set static IP on interface!
– Sajad Bahmani
Jul 19 '16 at 8:58




@ManuToMatic I need to set static IP on interface!
– Sajad Bahmani
Jul 19 '16 at 8:58












Yes, and in the DHCP-Server too. If your server says "Yo, I'm configured to use 192.0.0.42 so give it to me!" but your DHCP (Router/Modem) answers "Yeah, nice. But I only distribute 192.168.0.2 to 192.168.0.50 so you get that nice 192.168.0.31", then your server gets 192.168.0.31 and not the IP he wants. If you want more information about how DHCP works: en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
– Bobby
Jul 19 '16 at 9:03






Yes, and in the DHCP-Server too. If your server says "Yo, I'm configured to use 192.0.0.42 so give it to me!" but your DHCP (Router/Modem) answers "Yeah, nice. But I only distribute 192.168.0.2 to 192.168.0.50 so you get that nice 192.168.0.31", then your server gets 192.168.0.31 and not the IP he wants. If you want more information about how DHCP works: en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
– Bobby
Jul 19 '16 at 9:03














@ManuToMatic I don't have any DHCP server in my network and need set static IP
– Sajad Bahmani
Jul 19 '16 at 9:04




@ManuToMatic I don't have any DHCP server in my network and need set static IP
– Sajad Bahmani
Jul 19 '16 at 9:04












What? So how is your network configured? Believe me, if you didn't do anything special, your router IS a DHCP-Server. Alternatively you could explain exactly how your network is set up so we'd know more specific what we're on.
– Bobby
Jul 19 '16 at 9:06




What? So how is your network configured? Believe me, if you didn't do anything special, your router IS a DHCP-Server. Alternatively you could explain exactly how your network is set up so we'd know more specific what we're on.
– Bobby
Jul 19 '16 at 9:06










2 Answers
2






active

oldest

votes

















up vote
0
down vote













I think it is a bug in Ubuntu network scripts.



If you will modify network interface and then do the ifdown it will fail. You must first bring the interface down. Then you can modify the file and then bring the interface up again:



$ ifdown eth0
$ $EDITOR /etc/network/interfaces
$ ifup eth0





share|improve this answer




























    up vote
    0
    down vote













    You don't need to restart anything. Using Network Manager (i.e. click on the network icon), disconnect the interface, and then click on it to reconnect. You should see the new IP on the interface.



    In general, it's good to remember that if Network Manager is running, it expects to be managing interfaces. Attempting to change interfaces with cli commands will usually result in network manager changing them back, or something similar/worse. If you don't want Network Manager to manage an interface, simply delete the interface from Network Manager.






    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',
      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%2f800384%2fnetwork-restart-fail-on-ubuntu-server-16-04%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








      up vote
      0
      down vote













      I think it is a bug in Ubuntu network scripts.



      If you will modify network interface and then do the ifdown it will fail. You must first bring the interface down. Then you can modify the file and then bring the interface up again:



      $ ifdown eth0
      $ $EDITOR /etc/network/interfaces
      $ ifup eth0





      share|improve this answer

























        up vote
        0
        down vote













        I think it is a bug in Ubuntu network scripts.



        If you will modify network interface and then do the ifdown it will fail. You must first bring the interface down. Then you can modify the file and then bring the interface up again:



        $ ifdown eth0
        $ $EDITOR /etc/network/interfaces
        $ ifup eth0





        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          I think it is a bug in Ubuntu network scripts.



          If you will modify network interface and then do the ifdown it will fail. You must first bring the interface down. Then you can modify the file and then bring the interface up again:



          $ ifdown eth0
          $ $EDITOR /etc/network/interfaces
          $ ifup eth0





          share|improve this answer












          I think it is a bug in Ubuntu network scripts.



          If you will modify network interface and then do the ifdown it will fail. You must first bring the interface down. Then you can modify the file and then bring the interface up again:



          $ ifdown eth0
          $ $EDITOR /etc/network/interfaces
          $ ifup eth0






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 20 '17 at 16:03









          Hadrian Węgrzynowski

          1




          1
























              up vote
              0
              down vote













              You don't need to restart anything. Using Network Manager (i.e. click on the network icon), disconnect the interface, and then click on it to reconnect. You should see the new IP on the interface.



              In general, it's good to remember that if Network Manager is running, it expects to be managing interfaces. Attempting to change interfaces with cli commands will usually result in network manager changing them back, or something similar/worse. If you don't want Network Manager to manage an interface, simply delete the interface from Network Manager.






              share|improve this answer

























                up vote
                0
                down vote













                You don't need to restart anything. Using Network Manager (i.e. click on the network icon), disconnect the interface, and then click on it to reconnect. You should see the new IP on the interface.



                In general, it's good to remember that if Network Manager is running, it expects to be managing interfaces. Attempting to change interfaces with cli commands will usually result in network manager changing them back, or something similar/worse. If you don't want Network Manager to manage an interface, simply delete the interface from Network Manager.






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  You don't need to restart anything. Using Network Manager (i.e. click on the network icon), disconnect the interface, and then click on it to reconnect. You should see the new IP on the interface.



                  In general, it's good to remember that if Network Manager is running, it expects to be managing interfaces. Attempting to change interfaces with cli commands will usually result in network manager changing them back, or something similar/worse. If you don't want Network Manager to manage an interface, simply delete the interface from Network Manager.






                  share|improve this answer












                  You don't need to restart anything. Using Network Manager (i.e. click on the network icon), disconnect the interface, and then click on it to reconnect. You should see the new IP on the interface.



                  In general, it's good to remember that if Network Manager is running, it expects to be managing interfaces. Attempting to change interfaces with cli commands will usually result in network manager changing them back, or something similar/worse. If you don't want Network Manager to manage an interface, simply delete the interface from Network Manager.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 30 '17 at 4:49









                  Hugh Buntu

                  324211




                  324211






























                      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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2f800384%2fnetwork-restart-fail-on-ubuntu-server-16-04%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

                      Ellipse (mathématiques)

                      Quarter-circle Tiles

                      Mont Emei