Just recently change /etc/network/interfaces to static IP, apt-get not working. How to check for errors?
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
.
Related videos on Youtube
Martyn
Updated on September 18, 2022Comments
-
Martyn almost 2 years
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
andapt-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
ornslookup
too (maybe that's obvious though to a non-beginner unlike myself :)-
Admin about 10 yearswhat does your
interfaces
file look like? -
Martyn about 10 yearsI've updated my post
-
mtak about 10 yearsAre you running /etc/init.d/networking restart as
root
? -
Martyn about 10 yearsAh! 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.
-