Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to make some changes to my networking configuration by editing my /etc/network/interfaces file. What's the cleanest way to make changes to this file and have them take effect, without having to reboot)? Typically, I've been doing:

  1. Edit the file
  2. service networking restart

But I have the impression that this isn't the "right" way to make these kinds of changes.

share|improve this question
    
service networking restart almost= /etc/init.d/networking restart. –  shantanu Feb 10 '12 at 21:00

4 Answers 4

Shut the network interface down using

sudo ifdown eth0

(replace eth0 with the interface you want to change) and bring it up again using

sudo ifup eth0
share|improve this answer
    
This didn't work for me. It just gave me an error "eth0 not configured". I had to reboot the system for change to take effect on 12.04. –  JohnMerlino Jul 11 at 18:34

Stop all interfaces using

sudo /etc/init.d/networking stop

Configure (edit) your interfaces as you wish, then

Start them again

sudo /etc/init.d/networking start

There is no need to reboot.

share|improve this answer
    
This didn't work either in Ubuntu 12.04. Only rebooting system worked. –  JohnMerlino Jul 11 at 18:37

Why don't you think it is the right way. Think, what can ubuntu do extra during booting? Ubuntu has a list of services that need to run during booting, each service has a list of consecutive command to start itself. Ubuntu just run networking service through /etc/init.d/networking script which contains some command that need to run network service. So if any change need to apply to your network then you have to restart your service and the way is recall your service's consecutive commands.

share|improve this answer
    
Because rebooting is guaranteed to clear all of the interfaces that I have set up, and I'm concerned that if I remove an interface from my interfaces file, then restarting the networking script won't get rid of it. –  Lorin Hochstein Feb 10 '12 at 21:11
    
are you sure? any change in network is worked for me with sudo /etc/init.d/networking restart. –  shantanu Feb 11 '12 at 19:41
    
For example, if I create a tagged vlan (e.g., eth0.123) it doesn't seem to be automatically destroyed when I restart networking –  Lorin Hochstein Feb 13 '12 at 17:56
    
sudo eth0 down --- sudo eth0 up –  shantanu Feb 16 '12 at 17:38
    
/etc/init.d/networking re-read all network configuration file and update all settings, why should it destroy created interface? if you change your ip or dns or these kind of information then /etc/... is enough, if you create a virtual lan then you have to restart your ethernet interface(sudo eth0 down then sudo eth0 up). –  shantanu Feb 16 '12 at 17:41

/etc/network/interfaces controls the ifupdown tools.

So after making changes, you can just say eg sudo ifup eth0.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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