Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Earlier today I was ssh'ing into my box and discovered that the internal IP had changed from what it was, I decided I wanted to make this static and found a tutorial (kind of) how to:

nano /etc/network/interfaces

And then changed the contents to this:

auto lo eth0
iface lo inet loopback
iface eth0 inet static
   address 192.168.0.11
   netmask 255.255.255.0
   gateway 192.168.0.200

(I wanted my IP to be static at this). Now whenever I try to update, or install "git" using:

sudo apt-get update

I keep getting the error like so:

Err http://archive.raspberrypi.org wheezy InRelease                                   

Err http://mirrordirector.raspbian.org wheezy InRelease                               

Err http://archive.raspberrypi.org wheezy Release.gpg                                 
Temporary failure resolving 'archive.raspberrypi.org'
Err http://mirrordirector.raspbian.org wheezy Release.gpg                             
Temporary failure resolving 'mirrordirector.raspbian.org'
Reading package lists... Done                 
W: Failed to fetch      
http://mirrordirector.raspbian.org/raspbian/dists/wheezy/InRelease  
W: Failed to fetch 
http://archive.raspberrypi.org/debian/dists/wheezy/InRelease  

W: Failed to fetch   
http://archive.raspberrypi.org/debian/dists/wheezy/Release.gpg  Temporary 
failure resolving 'archive.raspberrypi.org'

W: Failed to fetch 
http://mirrordirector.raspbian.org/raspbian/dists/wheezy/Release.gpg  
Temporary failure resolving 'mirrordirector.raspbian.org'

I am connected to the internet, and this only seems to be happening since I updated the particular file.

Hope someone can help

UPDATE:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.200   0.0.0.0         UG        0 0          0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0


eth0      Link encap:Ethernet  HWaddr b8:27:eb:87:59:47  
          inet addr:192.168.0.11  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4707 errors:0 dropped:50 overruns:0 frame:0
          TX packets:3488 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:334663 (326.8 KiB)  TX bytes:390376 (381.2 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:708 errors:0 dropped:0 overruns:0 frame:0
          TX packets:708 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:67655 (66.0 KiB)  TX bytes:67655 (66.0 KiB)
share|improve this question
    
Can you post output of netstat -rn and ifconfig -a? –  Karlson Jan 18 '13 at 18:57
    
@Karlson Thank you for the reply. I have updated my o/p to what you asked for –  Phorce Jan 18 '13 at 19:01
    
You'd be better off just configuring your router to always allocate the same IP to this machine. –  ire_and_curses Jan 18 '13 at 19:02
add comment

1 Answer

Assuming that your IP and gateway are properly configured, your DNS nameservers are not. They can be configured in /etc/resolv.conf, in the following format:

nameserver 8.8.8.8

Another option is to install the resolvconf package and add the following to /etc/network/interfaces.

dns-nameserver 8.8.8.8

Then restart the interface for the changes to take affect:

ifdown eth0
ifup eth0
share|improve this answer
    
Thanks :) In /etc/resolv.conf I have "nameserver 194.168.4.100" repeated, so shall I replace these with: nameserver 8.8.8.8? –  Phorce Jan 18 '13 at 19:05
    
@phorce that's not the problem if 194.168.4.100 is a valid nameserver. Can you ping it? You can definitely try 8.8.8.8, which is google's resolver. –  jordanm Jan 18 '13 at 19:06
    
I can ping it, yes. Is there any way that I could go back to how it was before? I.e. replace the lines in "/etc/network/interfaces" and then have my router static the IP for this device? Thanks –  Phorce Jan 18 '13 at 19:09
    
Are you sure that 194.168.4.100 is a DNS server? When I did lookup for NS records for this IP I got 4 completely different servers. –  Karlson Jan 18 '13 at 21:22
    
the address 194.168.4.100 you wrote as DNS is probably mean to be 192.168.4.100 instead. It's a private subnet (192.168.4.x) and .100 can be your local router / DNS (as is in some ADSL gateways-router setup). If it's the case, check your router IP. –  DavAlPi May 20 '13 at 13:52
add comment

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.