network restart fail on Ubuntu server 16.04

13,931

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:
13,931

Related videos on Youtube

sheitan
Author by

sheitan

Favorite Languages : Java , Scala , Bash , C/C++ , Python Favorite IDE : IntelliJ IDEA , Netbeans Favorite Editor : VSCode , Vim

Updated on September 18, 2022

Comments

  • sheitan
    sheitan over 1 year

    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?

    • UeliDeSchwert
      UeliDeSchwert almost 8 years
      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.
    • sheitan
      sheitan almost 8 years
      @ManuToMatic I need to set static IP on interface!
    • UeliDeSchwert
      UeliDeSchwert almost 8 years
      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
    • sheitan
      sheitan almost 8 years
      @ManuToMatic I don't have any DHCP server in my network and need set static IP
    • UeliDeSchwert
      UeliDeSchwert almost 8 years
      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.
    • sheitan
      sheitan almost 8 years
      I need to set static IP and change IP work properly in Ubuntu14.04. I need set static IP On Ubuntu Server 16.04. I cant setup DHCP server in my network.
  • Dániel Kis
    Dániel Kis almost 5 years
    It seems to be a bug, but sometimes ubuntu needs to be restarted