0

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

Julien Vincent
  • 103
  • 1
  • 1
  • 5

4 Answers4

1

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
kyodake
  • 17,808
0

Try sudo ifdown eth0 && sudo ifup eth0

If that fails sudo service network-manager restart

Tom Nash
  • 1
  • 2
0

Looks like your problem is, the line you have inserted in /etc/network/interfaces file auto eth0 Basically you are saying the "eth0" interface will be automatically configured ( via dhcp pool).

Try this

auto lo
iface lo inet loopback

Primary Network

iface eth0 inet static address 192.168.2.13 #this ip might be different according to your router netmask 255.255.255.0 gateway 192.168.2.1
network 192.168.2.0

Now restart the networking services using

sudo /etc/init.d/networking restart

or you may have to reboot the ubuntu Machine as well in order for changes to take affect.

Thanks. Good Luck

0

First of all you must check your adapter name with help of sudo ip link command,

# sudo ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
   link/ether 78:2b:cc:5e:02:fc brd ff:ff:ff:ff:ff:ff

Now we come to know that our adapter is em1

so changes your adapter name in file configuration :

# cat /et/network/interfaces

auto lo
iface lo inet loopback

# Primary Network

auto em1
iface em1 inet static
address 192.168.2.13   #this ip might be different according to your router
netmask 255.255.255.0
gateway 192.168.2.1    
network 192.168.2.0

## sudo ifdown em1
## sudo ifup em1

You will be good to go

Byte Commander
  • 110,243