Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
     address 192.168.1.68
     netmask 255.255.255.0
     gateway 192.168.1.64

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
1  
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 8.8.8.8 (or some other good known ip address) and update the question with the result. –  andol Jul 1 '12 at 20:59

3 Answers 3

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

dns-nameservers 1.2.3.4  5.6.7.8

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 8.8.8.8 and 8.8.4.4. –  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
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1
dns-nameservers 8.8.8.8 8.8.8.4
dns-search mydomain.com

Then shutdown and restart the interface:

~$ sudo ifdown eth0 && sudo ifup eth0

https://help.ubuntu.com/14.04/serverguide/network-configuration.html#ip-addressing

share|improve this answer

Your Answer

 
discard

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.