Debian 8.2 中失去互联网连接

Debian 8.2 中失去互联网连接

我读过很多阿库本图以及其他有关互联网连接丢失的论坛帖子。我在笔记本电脑上安装了 Debian 8.2 Jessy,并使用静态 IPv4 配置:

  • IP 地址10.0.0.5
  • 面罩 255.255.255.0
  • 网关10.0.0.138
  • Dns 8.8.8.8(Google 的 DNS)+ ISP 的 DNS

有效。然后,经过一番处理后,连接不知从哪里丢失了。我尝试 ping 路由器:

root@debian82:/home/user# ping 10.0.0.138
PING 10.0.0.138 (10.0.0.138) 56(84) bytes of data.
64 bytes from 10.0.0.138: icmp_seq=1 ttl=255 time=1.37 ms
64 bytes from 10.0.0.138: icmp_seq=2 ttl=255 time=1.60 ms
64 bytes from 10.0.0.138: icmp_seq=3 ttl=255 time=0.740 ms
64 bytes from 10.0.0.138: icmp_seq=4 ttl=255 time=0.734 ms
64 bytes from 10.0.0.138: icmp_seq=5 ttl=255 time=0.668 ms
64 bytes from 10.0.0.138: icmp_seq=6 ttl=255 time=0.707 ms
^C
--- 10.0.0.138 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5003ms
rtt min/avg/max/mdev = 0.668/0.971/1.601/0.372 ms

我尝试过 ping Google:

root@debian82:/home/user# ping google.com ping: unknown host
google.com

我尝试切换到 dhcp 并刷新其配置:

root@debian82:/home/user# dhclient -r -v eth0 && rm
/var/lib/dhcp/dhclient.*; dhclient -v eth0 Internet Systems Consortium
DHCP Client 4.3.1 Copyright 2004-2014 Internet Systems Consortium. All
rights reserved. For info, please visit
https://www.isc.org/software/dhcp/
 
Listening on LPF/eth0/00:02:a5:b5:e1:eb Sending on  
LPF/eth0/00:02:a5:b5:e1:eb Sending on   Socket/fallback DHCPRELEASE on
eth0 to 10.0.0.138 port 67 Internet Systems Consortium DHCP Client
4.3.1 Copyright 2004-2014 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/
 
Listening on LPF/eth0/00:02:a5:b5:e1:eb Sending on  
LPF/eth0/00:02:a5:b5:e1:eb Sending on   Socket/fallback DHCPDISCOVER
on eth0 to 255.255.255.255 port 67 interval 5 DHCPREQUEST on eth0 to
255.255.255.255 port 67 DHCPOFFER from 10.0.0.138 DHCPACK from 10.0.0.138 bound to 10.0.0.11 -- renewal in 110048 seconds.

这是我得到的:

等/网络/接口

allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
#       address 10.0.0.11
#       netmask 255.255.255.0
#       gateway 10.0.0.138
        nameserver 8.8.8.8
        nameserver 194.90.0.1
        dns-nameservers 8.8.8.8 194.90.0.1 8.8.4.4

我尝试了所有可能找到的东西,并在每次尝试之间重新启动。我哪里错了?内容为/etc/resolv.conf是:

user@debian82:~$ nano /etc/resolv.conf
nameserver 10.0.0.138

编辑:我已将其他名称服务器(Google 和 ISP)添加到/etc/resolv.conf.我是在没有互联网的计算机上写这篇编辑的。

答案1

添加其他名称服务器来/etc/resolv.conf解决该问题。之前看起来像:

user@debian82:~$ nano /etc/resolv.conf
nameserver 10.0.0.138

现在看起来像:

user@debian82:~$ nano /etc/resolv.conf
nameserver 10.0.0.138
nameserver <ISP's dns name server>
nameserver 8.8.8.8 <(Google's)>

并且连接已恢复:

PING google.com (194.90.196.110) 56(84) bytes of data.
64 bytes from 194.90.196.110: icmp_seq=1 ttl=59 time=14.5 ms
64 bytes from 194.90.196.110: icmp_seq=2 ttl=59 time=15.9 ms
64 bytes from 194.90.196.110: icmp_seq=3 ttl=59 time=15.3 ms
64 bytes from 194.90.196.110: icmp_seq=4 ttl=59 time=14.0 ms
64 bytes from 194.90.196.110: icmp_seq=5 ttl=59 time=15.3 ms
^C
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 5882ms
rtt min/avg/max/mdev = 14.030/15.048/15.930/0.669 ms

相关内容