0

I am sorry to ask about this again, but i cannot figure out, even after reading a lot of articles, how to change my network configuration from command line, without having to restart the machine.

I am using a copy of Lubuntu 14.04.2 LTS, which runs in a VirtualBox VM, and boots up without a GUI interface.

When i want to change my network connection settings using terminal, i usually edit

/etc/network/interfaces

and then

/etc/init.d/networking restart

or

service networking restart

But the above steps that used to work in most of the *ubuntu versions, now seem to do nothing.

I also tried ifdown/ifup and ifconfig, but nothing seems to be able to restart the connection and apply the new settings.

The settings are applied only if i restart the machine completely.

Is there something i might be missing, or am i stuck with the restart option? Thanks in advance..

EDIT : Extra info This is how my interfaces file looks like

Pastebin link : /etc/network/interfaces

  • Are you trying: sudo ifdown eth0 && sudo ifup -v eth0 substituting for eth0 if it is not your relevant interface? – chili555 Mar 10 '15 at 16:47
  • The truth is that i tried so many commands, that i don't remember all the arguments i have used. I did try sudo ifdown --exclude=lo -a && sudo ifup --exclude=lo -a which works in ubuntu server 14.04 but it didn't work. – ktsangop Mar 11 '15 at 10:25
  • Please tell us what you are trying to accomplish with eth0:1. It has no reachable gateway. Thanks. – chili555 Mar 11 '15 at 12:43
  • I am running a server-client application. My backend requires internet but my clients are not allowed to access it. So as a simple solution the clients communicate with the server using the eth0:1 virtual adapter. I have been using this setup many years successfully with older versions of ubuntu. – ktsangop Mar 11 '15 at 13:29
0

What parameters are you trying to change?

If you are changing your IP to a fixed one maybe the problem is with the router.

Also, when running the restart command, root privileges are needed:

sudo service networking restart

You can also try to do:

sudo service networking stop
sudo service networking start

Some links with possible solutions: link1, link2, link3, link4.

  • I am runnig the commands as root so that is not the problem. – ktsangop Mar 11 '15 at 10:26
  • What about the parameters you are trying to change? – Zaka Elab Mar 11 '15 at 16:37
  • I updated my question it's all up there :) – ktsangop Mar 12 '15 at 12:16
  • I added some links that might be useful. – Zaka Elab Mar 12 '15 at 14:23
  • Although your answer is 100% correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... :-( Therefore, please edit your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! ;-) You can always leave the link in at the bottom of your answer as a source for your material... – Fabby Mar 18 '15 at 11:49
0

After many attempts and system re-installation i managed to do it this way :

ip addr flush dev eth0
ifdown --exclude=lo -a && ifup --exclude=lo -a

Thanks for all the suggestions.

EDIT :

To help novice users like myself i would like to add that if you want to do this remotely using ssh, you would have to execute the above commands in one statement like this :

ip addr flush dev eth0 && ifdown --exclude=lo -a && ifup --exclude=lo -a

You will be disconnected of course but then you can re-connect on your new ip.

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.