Problem with setting static IP on Ubuntu Server 14.04
Solution 1
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.
Solution 2
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
address 192.168.1.123
gateway 192.168.1.1
netmask 255.255.255.0
dns-search apollo3.com # ths is the doman sufix that you want added to a one word hostname
dns-nameservers 8.8.8.8 8.8.4.4
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
Related videos on Youtube
user283469
Updated on September 18, 2022Comments
-
user283469 almost 2 years
I have a problem setting the static IP on my Ubuntu Server 14.04 LTS.
When I:
- run
sudo nano /etc/network/interfaces
, then - change dhcp to static, then
- I type
address,netmask,network,gateway,dns-nameservers
, then - I try to ping a reliable website (e.g.
yahoo.com
)
I get an error in response like
unknown host yahoo.com
and sometimesdestination 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 109.92.21.200), 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?
-
cioby23 about 10 yearsCan you post the content of the /etc/network/interfaces file ? Also can you try to ping 8.8.8.8 and post output ?
-
user283469 about 10 yearsok, so the output od /etc/network/interfaces file is address 192.168.1.12 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 8.8.4.4 so than i do sudo service networking restart and i get message stop:Job failed while stoping start:Job is already running : networking
-
cioby23 about 10 yearsok if you ping 192.168.1.1 or ping 8.8.8.8 from your machine do you get any reply ?
-
cioby23 about 10 yearsI need more information so I can help. Is 192.168.1.1 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 ?
-
user283469 about 10 yearsi setup server on virtual machine .... 192.168.1.1 is the address of router...just give me your e-mail and we can disscuss futher more and i can give you access to my local so you can help me configure that...Is that ok?
-
cioby23 about 10 yearsI do not know if it's ok to post an email address here.
-
user283469 about 10 yearscan i write on your blog site and ask you question and post my e-mail so we can communicate?
-
cioby23 about 10 yearsIf you are using a VM in VirtualBox for example go to Settings -> Network and make sure in the Attached to box you have selected Bridged adapter and the name of the interface is correct (e.g. eth0) as the one you use for your main PC to get to the Internet
-
cioby23 about 10 yearsyes you can write to me
-
user283469 about 10 yearsi send a e-mail to you on your blog site...please check and inform me ...
-
wruckie about 8 years@user283469 Having the same trouble. Can you post more about how this situation turned out?
- run
-
user283469 about 10 yearsok .. 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 about 10 yearsdo 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...
-
Abdul Kadir about 10 yearsReboot your system and remove all entry from /etc/network/interfaces and Set manual ip address from terminal.
sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0
sudo route add default gw 10.0.0.1 eth0
sudo vim /etc/resolve.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
try it. -
user283469 about 10 yearsi have done like you told me and now i get error trying to ping 192.168.1.1 -> connect : Network is unreachable.
-
Abdul Kadir about 10 yearsNow go through this [link]help.ubuntu.com/14.04/serverguide/network-configuration.html this is the official site of Ubuntu
-
dyomas over 7 yearsYour router assigns dynamic IP thru DHCP, but a question is about static IP
-
24601 over 7 years@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.