小更新..现在无法下载/更新

小更新..现在无法下载/更新

今天早些时候,我通过 ssh 进入我的盒子,发现内部 IP 已经发生了变化,我决定将其设为静态,并找到了一个教程(有点)如何:

nano /etc/network/interfaces

然后将内容改为这样:

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

(我希望我的 IP 在此是静态的)。现在,每当我尝试使用以下命令更新或安装“git”时:

sudo apt-get update

我不断收到这样的错误:

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'

我已连接到互联网,自从我更新了特定文件后,这似乎才发生。

更新:

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)

答案1

假设您的 IP 和网关已正确配置,但您的 DNS 名称服务器未正确配置。它们可以在 中配置/etc/resolv.conf,格式如下:

nameserver 8.8.8.8

另一种选择是安装 resolvconf 包并将以下内容添加到/etc/network/interfaces.

dns-nameserver 8.8.8.8

然后重新启动界面以使更改生效:

ifdown eth0
ifup eth0

相关内容