I have a problem setting the static IP on my Ubuntu Server 14.04 LTS.

When I:

  1. run sudo nano /etc/network/interfaces, then
  2. change dhcp to static, then
  3. I type address,netmask,network,gateway,dns-nameservers, then
  4. I try to ping a reliable website (e.g. yahoo.com)

I get an error in response like unknown host yahoo.com and sometimes destination unreachable.

I also tried to connect through PuTTY, but that's only a local IP. What I actually need is a real IP (like this, so that I can connect through PuTTY (which I have on my laptop) and connect to port 22 on my desktop server which is open, but I am constantly getting an error like "Connection timed out" or "Connection refused".

How can I resolve this problem?

  • Can you post the content of the /etc/network/interfaces file ? Also can you try to ping and post output ?
    – cioby23
    May 21 '14 at 9:06
  • ok, so the output od /etc/network/interfaces file is address netmask gateway dns-nameservers so than i do sudo service networking restart and i get message stop:Job failed while stoping start:Job is already running : networking
    – user283469
    May 21 '14 at 11:21
  • ok if you ping or ping from your machine do you get any reply ?
    – cioby23
    May 21 '14 at 11:26
  • i get the following -> connect: Network is unreachable
    – user283469
    May 21 '14 at 11:40
  • I need more information so I can help. Is a router device in your LAN that connects you to the Internet? What type of connection do you have PPPoE, DSL, direct ? If you machine physical or virtual ?
    – cioby23
    May 21 '14 at 11:43

When I needed to set a static IP address for my ubuntu pc, I did it from the router rather than trying to set it from the pc.

The router then sets the IP address given in the router table for the device on each power up.

  • Your router assigns dynamic IP thru DHCP, but a question is about static IP
    – dyomas
    Jan 28 '17 at 20:35
  • 1
    @dyomas That is exactly so but it is usually possible to reserve a static IP address for a specifically identified device in the DHCP table which correctly answers the op's question.
    – 24601
    Jan 29 '17 at 7:18

You didn't give an instance of what you actually have in your interfaces file to make it easy for us to see where you're going wrong. But if you're going to use a manual configuration you'll have to specify other important components which would normally be provided by your dhcp server.

This is an example of a working /etc/network/interfaces configuration:

auto eth0
iface eth0 inet static
  dns-search apollo3.com # ths is the doman sufix that you want added to a one word hostname

There are other configurations that you can set. However, these are the most needed that are provided by your dhcp server

You can probably get these items by running ifconfig when using the dhcp server, or from your isp/network provider

  • do i need to do service networking restart command or can i try /etc/init.d/networking restart ? I set my static ip like you described but with other parameters...
    – user283469
    May 21 '14 at 10:52

I am sure you are going through the right process. but go through some settings more to make your network interface working.

Setting up Ip address in /etc/network/interfaces restart your network interface services.

If you are getting the same problem then

Open terminal and run mii-tool it will show your network card duplex mode. change your duplex mode to 100baseTx-FD to 10Mbit by running this command in terminal.

sudo mii-tool -F 10baseT-HD

should be fixed you problem.

  • ok .. so when i do service networking restart i got this stop:Job failed while stoping start:Job is already running : networking Am i doing the right thing?
    – user283469
    May 21 '14 at 10:51
  • Reboot your system and remove all entry from /etc/network/interfaces and Set manual ip address from terminal. sudo ifconfig eth0 netmask sudo route add default gw eth0 sudo vim /etc/resolve.conf nameserver nameserver try it. May 21 '14 at 11:25
  • i have done like you told me and now i get error trying to ping -> connect : Network is unreachable.
    – user283469
    May 21 '14 at 11:41
  • Now go through this [link]help.ubuntu.com/14.04/serverguide/network-configuration.html this is the official site of Ubuntu May 21 '14 at 11:50

Force the interface down and up works.

  sudo ip link set eth0 down
  sudo ip link set eth0 up
$ ls /sys/class/net

the above steps and most of the recommendations online will work if you first determine the right nic name for your Ethernet port with the above command

I was using eth0 as recommended above but looking at the directory /sys/class/net told me the name of my adapter device was em0 instead of eth0 once I put the em0 instead of eth0 in the above /etc/network/interfaces file I had no slow boot and I could ping out.


You do not need to change /etc/network/interfaces or any part of your config beyond your dns servers!

The issue is different flags being set for dnsmasq for static ips vs dynamic ip addresses. For static ip address, dnsmasq sets --proxy-dnssec by default. Most IPS do not provide dnssec capable dns servers and therefore dnsmaq timesout. If you set the ip addresses for the dns servers in network manager to a publicly offered dns server with dnssec (google is a good one:, everything goes back to working. You do not need to override resolve in any other way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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