我知道这个问题很笼统,但我不知道发布这个问题需要什么问题数据,我发布的帖子风格很笼统。
我的问题是,我的系统显示我已连接到互联网,但我无法访问。我经常断开与互联网的连接。
我的内核是 4.18.0.13,我将该版本更改为 4.4.0.43,并且运行了一段时间。
但问题又仍然存在。
我需要一个解决这个问题的方法,因为我的工作现在因为这个问题而处于危险之中。
如果您需要任何类型的命令输出,我会在这里发布以供进一步查询。
非常感谢
编辑
我得到了错误
dhcp6 (eth1) request timed out
State change unknown
当我尝试使用命令重新启动网络时收到此消息
sudo /etc/init.d/networking restart
错误是:
Restarting networking (via systemctl): networking.serviceJob for networking.service failed because a timeout was exceeded.
See "systemctl status networking.service" and "journalctl -xe" for details.
这里有一些所需的命令及其输出,请帮助我;
IP地址
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 00:0a:eb:68:18:a2 brd ff:ff:ff:ff:ff:ff
3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether e0:69:95:91:55:f5 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.252/24 brd 192.168.0.255 scope global dynamic noprefixroute eno1
valid_lft 85929sec preferred_lft 85929sec
inet6 fe80::e269:95ff:fe91:55f5/64 scope link
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:82:1b:57 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:82:1b:57 brd ff:ff:ff:ff:ff:ff
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:ec:28:29:49 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
路由
default via 192.168.0.229 dev eno1 proto dhcp metric 100
169.254.0.0/16 dev eno1 scope link metric 1000
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.252 metric 100
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
猫/等/网络/接口
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
猫/etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search DLink
猫/etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat systemd
group: compat systemd
shadow: compat
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
nslookup ubuntu.com
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find ubuntu.com: SERVFAIL
访问 ubuntuforums.org
; <<>> DiG 9.11.4-3ubuntu5-Ubuntu <<>> ubuntuforums.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 46952
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;ubuntuforums.org. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Dec 31 11:16:16 IST 2018
;; MSG SIZE rcvd: 45
ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.984 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.36 ms
^C
--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 0.984/1.171/1.358/0.187 ms
systemctl status 网络服务
networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: en
Active: failed (Result: exit-code) since Mon 2018-12-31 12:29:59 IST; 21h ago
Docs: man:interfaces(5)
Main PID: 1332 (code=exited, status=1/FAILURE)
Dec 31 12:29:56 jith dhclient[1847]: If you think you have received this message due
Dec 31 12:29:56 jith dhclient[1847]: than a configuration issue please read the secti
Dec 31 12:29:56 jith dhclient[1847]: bugs on either our web page at www.isc.org or in
Dec 31 12:29:56 jith dhclient[1847]: before submitting a bug. These pages explain th
Dec 31 12:29:56 jith dhclient[1847]: process and the information we find helpful for
Dec 31 12:29:56 jith dhclient[1847]:
Dec 31 12:29:56 jith dhclient[1847]: exiting.
Dec 31 12:29:59 jith systemd[1]: networking.service: Main process exited, code=exited
Dec 31 12:29:59 jith systemd[1]: networking.service: Failed with result 'exit-code'.
Dec 31 12:29:59 jith systemd[1]: Failed to start Raise network interfaces.
lines 1-16/16 (END)...skipping...
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-12-31 12:29:59 IST; 21h ago
Docs: man:interfaces(5)
Main PID: 1332 (code=exited, status=1/FAILURE)
Dec 31 12:29:56 jith dhclient[1847]: If you think you have received this message due to a bug rather
Dec 31 12:29:56 jith dhclient[1847]: than a configuration issue please read the section on submitting
Dec 31 12:29:56 jith dhclient[1847]: bugs on either our web page at www.isc.org or in the README file
Dec 31 12:29:56 jith dhclient[1847]: before submitting a bug. These pages explain the proper
Dec 31 12:29:56 jith dhclient[1847]: process and the information we find helpful for debugging..
Dec 31 12:29:56 jith dhclient[1847]:
Dec 31 12:29:56 jith dhclient[1847]: exiting.
Dec 31 12:29:59 jith systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Dec 31 12:29:59 jith systemd[1]: networking.service: Failed with result 'exit-code'.
Dec 31 12:29:59 jith systemd[1]: Failed to start Raise network interfaces.
journalctl-xe
Jan 01 14:00:37 jith /usr/lib/gdm3/gdm-x-session[5251]: (**) Option "fd" "28"
Jan 01 14:00:37 jith /usr/lib/gdm3/gdm-x-session[5251]: (II) event11 - lircd-uinput: device removed
Jan 01 14:00:37 jith /usr/lib/gdm3/gdm-x-session[5251]: (II) UnloadModule: "libinput"
Jan 01 14:00:37 jith /usr/lib/gdm3/gdm-x-session[5251]: (II) systemd-logind: releasing fd for 13:75
Jan 01 14:00:39 jith systemd[1]: redis-server.service: Start operation timed out. Terminating.
Jan 01 14:00:39 jith systemd[1]: redis-server.service: Failed with result 'timeout'.
Jan 01 14:00:39 jith systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit redis-server.service has failed.
--
-- The result is RESULT.
Jan 01 14:00:40 jith systemd[1]: redis-server.service: Service RestartSec=100ms expired, scheduling restart.
Jan 01 14:00:40 jith systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 147.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit redis-server.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Jan 01 14:00:40 jith systemd[1]: Stopped Advanced key-value store.
-- Subject: Unit redis-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit redis-server.service has finished shutting down.
Jan 01 14:00:40 jith systemd[1]: Starting Advanced key-value store...
-- Subject: Unit redis-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit redis-server.service has begun starting up.
Jan 01 14:00:40 jith systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
Jan 01 14:00:42 jith sudo[8975]: web : TTY=pts/1 ; PWD=/home/web ; USER=root ; COMMAND=/usr/sbin/service lircd.socket stop
Jan 01 14:00:42 jith sudo[8975]: pam_unix(sudo:session): session opened for user root by web(uid=0)
Jan 01 14:00:42 jith sudo[8975]: pam_unix(sudo:session): session closed for user root
journalctl-xe
Jan 01 16:55:34 jith avahi-daemon[1609]: New relevant interface eno1.IPv4 for mDNS.
Jan 01 16:55:34 jith NetworkManager[1618]: <info> [1546341934.8167] device (eno1): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jan 01 16:55:34 jith avahi-daemon[1609]: Registering new address record for 192.168.0.252 on eno1.IPv4.
Jan 01 16:55:34 jith NetworkManager[1618]: <info> [1546341934.8210] device (eno1): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jan 01 16:55:34 jith NetworkManager[1618]: <info> [1546341934.8213] device (eno1): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed'
Jan 01 16:55:34 jith NetworkManager[1618]: <info> [1546341934.8216] manager: NetworkManager state is now CONNECTED_GLOBAL
Jan 01 16:55:34 jith systemd[1]: Started resolvconf-pull-resolved.service.
-- Subject: Unit resolvconf-pull-resolved.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit resolvconf-pull-resolved.service has finished starting up.
--
-- The start-up result is RESULT.
Jan 01 16:55:34 jith systemd-resolved[2075]: Using degraded feature set (UDP) for DNS server 192.168.0.229.
Jan 01 16:55:34 jith dhclient[28822]: bound to 192.168.0.252 -- renewal in 37914 seconds.
Jan 01 16:55:34 jith NetworkManager[1618]: <info> [1546341934.9139] policy: set 'Wired connection 1' (eno1) as default for IPv4 routing and DNS
Jan 01 16:55:34 jith NetworkManager[1618]: <info> [1546341934.9162] device (eno1): Activation: successful, device activated.
Jan 01 16:55:34 jith gsd-sharing[5759]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit rygel.service not loaded.
Jan 01 16:55:34 jith gsd-sharing[5759]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit gnome-remote-desktop.service not loaded.
Jan 01 16:55:34 jith nm-dispatcher[28780]: req:2 'up' [eno1]: new request (1 scripts)
Jan 01 16:55:34 jith nm-dispatcher[28780]: req:2 'up' [eno1]: start running ordered scripts...
Jan 01 16:55:34 jith systemd[1]: Starting resolvconf-pull-resolved.service...
-- Subject: Unit resolvconf-pull-resolved.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit resolvconf-pull-resolved.service has begun starting up.
Jan 01 16:55:34 jith systemd[1]: Started resolvconf-pull-resolved.service.
-- Subject: Unit resolvconf-pull-resolved.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit resolvconf-pull-resolved.service has finished starting up.
--
-- The start-up result is RESULT.
答案1
我发现新安装的 ubuntu 18.10 缺少软件包 libnss-resolve。如果没有它,某些 dns 名称查找(如 ping pop3.comcast.net)就会失败。
sudo apt-get install libnss-resolve
此安装应该改变 /etc/nsswitch.conf 文件以包含如下主机行:
hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
这个附加软件包修复了我 18.10 的所有 DNS 问题,即使使用 dhcp 和我的无线网关提供的默认 DNS 名称服务器也是如此。同样的修复也适用于 18.04。
答案2
这将列出 DNS 服务器,nmcli device show | grep IP4.dns
看起来你的 DNS 服务器尚未配置。
答案3
我暂时解决了这个问题。但我不知道这是否是一个解决方案。
我所做的是在 ubuntu 网络设置中的 ipv4 设置下添加了两个地址。8.8.8.8
并且8.8.4.4
我也禁用了 ipv6 设置。
但有时互联网仍会中断,我需要关闭互联网并重新连接才能连接。
如果有人知道情况并知道如何解决,请添加更多答案。