0

I just installed an Ubuntu 14.04 server, and I've discovered that there is no way to make any changes to the network configuration except by rebooting the server. This is on a stock install of Ubuntu 14.04 server, installed last week, with no changes made to it, and no new packages installed (since I can't reach apt-get).

ifconfig up/down seems to read from some kind of cache; at least, it ignores any changes I make to /etc/network/interfaces. I tried using it to change from DCHP to static for eth1, and nothing happened; eth1 continued to get its address from DHCP.

/etc/init.d/networking stop/restart/force-reload all fail with no error message.

How is this supposed to work on Ubuntu Server? Right now, it seems like network changes only take effect with a reboot.

(and please don't give me answers which involve network-manager; this is a headless server with no GUI. Thanks).

ADDING INFORMATION REQUESTED BELOW:

/etc/network/interfaces originally was:

# The primary network interface
auto eth1
iface eth1 inet dhcp

... this wasn't picking up gateway information from DHCP, even though my Ubuntu laptop picks it up just fine.

So I changed it to:

# The primary network interface
auto eth1
iface eth1 inet static
address 172.47.23.106
netmask 255.255.255.0
gateway 172.47.23.1

However, after doing ifconfig down/up, the IP address of eth1 did not change and the gateway did not get added to the route table. On a full restart of the system, the eth1 configuration was picked up just fine.

So it seems that ifconfig up ignores changes to /etc/network/interfaces.

  • Have you looked in /var/log/*? There should be error messages in /var/log/syslog or /var/log/udev. Hint: Cause the (mis)behavior, do ls -rlt /var/log, then inspect the last many lines of the last few files listed. – waltinator Aug 11 '14 at 22:30
  • There are no relevant error messages in syslog or udev that I can find. Running ifconfig up/down generates only the message that ipv6 isn't configured (which it's not, I'm using ipv4). – FuzzyChef Aug 11 '14 at 22:59
  • Are you running ifconfig up/down as root, or via sudo? If not, networking will be unaffected. What is in your /etc/network/interfaces file? – waltinator Aug 11 '14 at 23:20
  • /etc/network/interfaces: # The primary network interface auto eth1 iface eth1 inet static address 172.47.23.106 netmask 255.255.255.0 gateway 172.47.23.1 Note that the above took effect just fine on a reboot of the system. – FuzzyChef Aug 12 '14 at 19:04
  • "Reboot" should be a last resort, I would think. @chili555 has a better answer. – waltinator Aug 13 '14 at 1:47
4

The correct way to get the system to re-read and use the changed /etc/network/interfaces file is:

sudo ifdown eth1 && sudo ifup -v eth1

The '-v' for verbose should produce output to judge if the changes were made successfully. Check:

ifconfig
ping -c3 www.google.com
  • This helped me diagnose the issue, but was not the actual answer. Hence, vote up but not accepted. – FuzzyChef Aug 14 '14 at 17:37
1

Based on follow-ups elsewhere, I found that it is indeed the case that Ubuntu will completely ignore changes in /etc/network/interfaces for a device which was previously defined and then changed. In order to get it to take a new configuration, you need to run the following:

ifdown {device}
ip addr flush dev {device}
ifup {device}

This is run between ifdown and ifup. Ideally, Ubuntu should add the flush to ifup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.