Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 42535  / 3 Years ago, fri, july 9, 2021, 2:22:23

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.


More From » networking

 Answers
6

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.


[#23695] Saturday, July 10, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aclavadoug

Total Points: 317
Total Questions: 103
Total Answers: 125

Location: Bangladesh
Member since Wed, Mar 24, 2021
3 Years ago
;