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 have an Ubuntu server and I cannot get Internet connection over this. The IP,subnet,gateway and the 2 DNS servers that I have been given is standard addresses that I must put into. I will give details of this:




Network is unreachable


sudo nano /etc/network/interfaces

is set to

#The loopback network interface
auto lo
iface lo inet loopback

#The primary network interface
#auto eth0 <-- this is a comment
iface eth0 inet static
address "My_static_ip_here"
gateway  "My_Gateway_here"


sudo nano /etc/resolve.conf

is set to

nameserver "My_DNS_server_1_here"
nameserver "My_DNS_server_2_here"

Finally, ifconfig

returns address and a subnet ofcourse on lo I cannot give detailed ifconfig here because of the limitations that I got. PS: This is a virtual machine that I am using. PS2: I tried to auto-dhcp it with iface eth0 inet dhcp but during the networking restart it kept loading and loading forever, so that does not work and I want to give this static IP.

share|improve this question
up vote 3 down vote accepted

Try this:

Place the DNS servers in /etc/network/interfaces, not in /etc/resolv.conf

Add this line at the bottom of your static configurations

dns-nameservers #OpenDNS' servers as example

Then run these commands in the terminal to restart the interface.

sudo su

ifdown eth0 && ifup eth0

Hope this works!

share|improve this answer
This works fine! Thanks very much. And I have thought about that and I said "nah, it will not be a difference". Greetings! – George Kourouleas Sep 18 '13 at 11:57

Setting aside the that this is a VM and if hypervisor is setup correctly to forward packets from this VM.

Please uncomment #auto eth0 <-- this is a comment and issue a network service restart: sudo service network restart

This tells the system to bring the interface up automatically at boot.

Else you can issue the command

sudo ifconfig eth0 up at each boot.

share|improve this answer
Ok, I did. I thought it was wrong but I had dhcp instead of static. Now I get in /etc/init.d/networking restart again, but ping returns unknown host. That is my issue. Can you help me out more on this? Thanks for the concern. – George Kourouleas Sep 18 '13 at 11:52
@George: You should restart network service like this: sudo service networking restart – Nullet Sep 18 '13 at 11:54
Does ping work now, if yes then its a DNS issue now. – squarebear Sep 18 '13 at 11:54
Thanks guys. It is solved now. Thanks for your immediate answers. – George Kourouleas Sep 18 '13 at 11:59

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.