Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Ubuntu Server and trying to set my connection to have a static IP, instead of a dynamic one. However, whenever I enter this into /etc/network/interface

auto wlan0
iface wlan0 inet static

My server can't connect to the internet. Running something like sudo apt-get upgrade, gives errors because I'm not connected to the internet. What's wrong with this?

share|improve this question
You have no DNS addresses (nameservers). I don't know how to do this for servers, but it used to be done in resolv.conf. Not sure if it still is – Marty Fried Jul 1 '12 at 20:12
Well, for starters let us figure out whatever this is about being able to connect to the Interenet, or about being able to resolve DNS lookups. Please try pinging (or some other good known ip address) and update the question with the result. – andol Jul 1 '12 at 20:59
up vote 0 down vote accepted

As far as from 12.04LTS one should not use /etc/resolv.conf. If a network adapter is working with IP addresses, but doesn't resolve domain names, add


after gateway clause in /etc/network/interface

share|improve this answer

You need to specify DNS servers. When DHCP is enabled, your server gets this information automatically, which won't work with a static IP.

share|improve this answer
I just tried doing that, but it still doesn't work. – Isaiah Bugarin Jul 1 '12 at 20:53
See if you can ping your default gateway and the DNS servers. That should help identify whether the problem is on your network or with the DNS. Use the dig command to test your DNS configuration. If this is the problem, you might want to try different servers, such as Google public DNS at and – Kalle Elmér Jul 1 '12 at 21:01

Per the Ubuntu Server Guide, you do indeed modify /etc/network/interfaces as follows.

auto eth0
iface eth0 inet static

Then shutdown and restart the interface:

~$ sudo ifdown eth0 && sudo ifup eth0

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.