Ubuntu – Unable to set static ip on ubuntu 14.10

14.10networkingstatic-ip

I have a fresh install of ubuntu 14.10 and have been trying to set a static IP but it does not connect when I try.

My interfaces file looks like this:

auto eth0
iface eth0 inet static

address 192.168.0.146
netmask 255.255.255.0
gateway 192.168.0.1

And when I try to sudo service networking restart is gives error that it is unable to stop networking.

 ➜  ~  sudo service networking restart
   stop: Job failed while stopping
   start: Job is already running: networking
 ➜  ~  
 ➜  ~  

I have also tried using the program wicd-curses and on setting a static IP I lose connection.

my connection info is correct (I have other systems running with the same connection info)

Any help is appreciated

Edit as a clarification – I am able to connect to my local network using this config ^^ however not the internet

Edit Version 14.10, not 14.04

Best Answer

First You must check if Network Manager is managing your network interface.

Open a terminal,

Press Ctrl+Alt+T

Run it:

sudo -i
nmcli dev status 

The above command will list all existing network interfaces along with their state. If state is shown as unmanaged, this means Network Manager is not controlling a corresponding interface. If state displays any other values:

DEVICE     TYPE              STATE
eth0      802-3-ethernet   connected

It implies that a given interface is managed by Network Manager.

To disable Network Manager for your eth0, you can do the following.

Edit the Network Manager configuration file in /etc/NetworkManager, and set:

managed=false

In the terminal continue running:

nano /etc/NetworkManager/NetworkManager.conf

And write the following lines:

[ifupdown]
managed=false

Ctrl + O, save file. Ctrl + X, close nano.

Then in /etc/network/interfaces, add information about the interface you want to disable Network Manager for.

In the terminal continue running:

nano /etc/network/interfaces

And write the following lines:

# The loopback network interface
auto lo
iface lo inet loopback

# eth0 not managed by Network Manager
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.146
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 208.67.222.222 #DNS OpenDns

Now Network Manager automatically ignore any interfaces specified in file:

/etc/network/interfaces

And stop managing them.

After rebooting, verify that Network Manager is successfully disabled for eth0:

sudo -i
nmcli dev status


DEVICE     TYPE              STATE
eth0      802-3-ethernet   unmanaged
Related Question