Just recently change /etc/network/interfaces to static IP, apt-get not working. How to check for errors?

1

I recently just updated my /etc/network/interfaces file to set a static IP address. Seems other computers can access the computer using the network IP address but I may have broken something - now apt-get update and apt-get install ... give me the following:

Err ...//jp.archive.ubuntu.com precise Release.gpg
  Temporary failure resolving 'jp.archive.ubuntu.com'
Err http://security.ubuntu.com precise-security Release.gpg
  Temporary failure resolving 'security.ubuntu.com'
Err ...//jp.archive.ubuntu.com precise-updates Release.gpg
  Temporary failure resolving 'jp.archive.ubuntu.com'
Err ...//jp.archive.ubuntu.com precise-backports Release.gpg
  Temporary failure resolving 'jp.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch ...//jp.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg  Temporary failure resolving 'jp.archive.ubuntu.com'

W: Failed to fetch ...//jp.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg  Temporary failure resolving 'jp.archive.ubuntu.com'

W: Failed to fetch ...//jp.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg  Temporary failure resolving 'jp.archive.ubuntu.com'

W: Failed to fetch ...//security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.

As another simple test I tried `ping www.yahoo.com` and it told me host not found (but works fine on another computer on the same router).

Does anyone know what I may have entered wrongly in /etc/network/interfaces? (I'm assuming it's there, not sure how to check though)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
 address ...
 netmask ...
 network ...
 broadcast ...
 gateway ...

# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto

(... I've set addresses)

Or another way to check what I may have set wrongly (as mentioned, I set to static IP for eth0 - setting address, gateway, subnet etc). Thanks

UPDATE:

I've added the following to my /etc/networking/interfaces file:

auto eth0
iface eth0 inet auto static
 .
 .
 .
 dns-nameservers 192.168.24.1

Btw, this is DNS I get when I do nm-tool. It seems like an internal IP address, is this the right IP address for my DNS settings here?

..anyway when I then try to /etc/init.d/networking restart I get the following errors:

/etc/init.d/networking restart
 * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
 * Reconfiguring network interfaces...                                                                                   ifdown: failed to open lockfile /run/network/.ifstate.lock: Permission denied
ifup: failed to open lockfile /run/network/.ifstate.lock: Permission denied

Also I'm unable to do ping or nslookup too (maybe that's obvious though to a non-beginner unlike myself :)

Martyn

Posted 2014-04-15T12:59:30.237

Reputation: 135

what does your interfaces file look like? – None – 2014-04-15T13:00:58.487

I've updated my post – Martyn – 2014-04-15T13:02:55.293

Are you running /etc/init.d/networking restart as root? – mtak – 2014-04-16T08:56:31.380

Ah! Thank you. Sorry, I'm very new to stuff like this (although I should have noticed that). That's it all working now, I was able to run apt-get update no problem. – Martyn – 2014-04-16T09:04:25.807

Answers

2

Did you set up DNS addresses? If you run DHCP, DNS is configured automatically, but when you run with static IP's, it's not.

You can configure DNS by adding the following below the iface eth0 inet static portion of the /etc/network/interfaces file:

dns-nameservers 10.100.0.11 10.100.2.11
dns-search int.mtak.nl

Replace the IP addresses with your network's DNS servers and the search domain with your search domain (or just remove it if you don't need it). Restart networking with sudo /etc/init.d/networking restart (or just reboot) and verify if it works by checking /etc/resolv.conf.

mtak

Posted 2014-04-15T12:59:30.237

Reputation: 11 805

0

You need to add DNS servers to your system. Easiest way would be to add this line to your interfaces file.

dns-nameservers 8.8.8.8 4.2.2.2

You can also add them by following the instructions here: https://wiki.debian.org/NetworkConfiguration#Defining_the_.28DNS.29_Nameservers

CoryL

Posted 2014-04-15T12:59:30.237

Reputation: 46