Raspberry Pi,无法更新[镜像/ DNS]

时间:2017-09-01 16:23:51

标签: dns raspberry-pi raspbian ethernet apt-get

昨天我买了一个Raspberry Pi,我面临着一个很大的问题。我不能sudo apt-get update。我认为这个错误来自我的dns,因为我通过以太网连接(物理上)。所以当我执行命令时它打印的消息是:

pi@raspberrypi:~ $ sudo apt-get update
Err:1 http://goddess-gate.com/archive.raspbian.org/raspbian jessie InRelease
  Temporary failure resolving 'goddess-gate.com'
Err:2 http://archive.raspberrypi.org/debian stretch InRelease              
  Temporary failure resolving 'archive.raspberrypi.org'
Reading package lists... Done             
W: Failed to fetch http://goddess-gate.com/archive.raspbian.org/raspbian/dists/jessie/InRelease  Temporary failure resolving 'goddess-gate.com'
W: Failed to fetch http://archive.raspberrypi.org/debian/dists/stretch/InRelease  Temporary failure resolving 'archive.raspberrypi.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

所以为了解决这个问题,我尝试了一些事情:

- Changing the etc/apt/sources.list to a valid mirror of my country (france)
- Reinstalling Raspbian (1st try was with NOOBS) and now I installed Raspbian with the .img file
- Changing my /ect/resolv.conf and /etc/network/interfaces nameservers to   these ip 8.8.8.8 8.8.4.4

没有任何效果......我真的被困了,有一些东西,我无法使用Chromium浏览任何网站,但我有互联网连接,因为我可以pip安装python模块......这里是Chromium消息: '无法访问此网站' ERR_NAME_RESOLUTION_FAILED

其他的事情,我的inet ip无效,通常它应该从192.168开始,但这里是168.254.241.6 ...这是我的if配置:

pi@raspberrypi:~ $ ifconfig
enxb827ebaf69fc: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.241.6  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::5d8b:1a8c:c520:c339  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:af:69:fc  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 995  bytes 61042 (59.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 806  bytes 77318 (75.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 806  bytes 77318 (75.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:fa:3c:a9  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3 个答案:

答案 0 :(得分:1)

在命令行中键入以下命令,以编辑resolv.conf,这是Linux配置文件,其中存储了 IP到IP映射的域名,用于 DNS解析< / strong>。

sudo nano /etc/resolv.conf

然后添加以下两行:

nameserver 8.8.8.8 
nameserver 8.8.4.4

希望这会有所帮助...

答案 1 :(得分:0)

zeroconf使用ip-adress范围169.254.0.0到169.254.255.255。 可能LAN中没有活动的DHCP服务器。大多数情况下,路由器也是DHCP服务器。 您也没有公共IPv6地址。但这也可能来自仅IPv4的互联网连接。 尝试使用更正的ip-address配置完全手动的接口。如果应该有一个活动的DHCP服务器,请尝试修复它。有时重启会有所帮助。 您可以使用“ip r”显示网关。它应该是路由器的地址。

重要的是,Pi的ip-address与网关位于同一子网中。

答案 2 :(得分:0)

sudo nano /etc/resolv.conf

nameserver 8.8.8.8 
nameserver 8.8.4.4

我用以太网电缆直接连接了Raspberry Pi。

可以。