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

ktsangop
  • 101

2 Answers2

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.

Zaka Elab
  • 165
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.

ktsangop
  • 101