问题描述:
reboot重启会导致网络连接错误;
shutdown再开启电脑网络正常。
系统:
openSUSE 15.0
问题描述:
reboot重启会导致网络连接错误;
shutdown再开启电脑网络正常。
系统:
openSUSE 15.0
什么样的错误?有截图吗?
你至少给点截图或者 log 啊…
难道是网卡没有重启
手动解决可以试试
sudo systemctl restart NetworkManager
你看一下 systemctl status -l network.service 把结果贴出来
不起作用。
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
└─NetworkManager-ovs.conf
Active: active (running) since Mon 2018-06-11 19:41:45 CST; 1min 42s ago
Docs: man:NetworkManager(8)
Main PID: 1341 (NetworkManager)
Tasks: 5 (limit: 4915)
CGroup: /system.slice/NetworkManager.service
├─1341 /usr/sbin/NetworkManager --no-daemon
└─2186 /sbin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-badb0db2-0c57-3723-a750-71cce2748287-eth0.lease -cf /var/lib/NetworkManager/dhclient-eth0.conf eth0
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <warn> [1528717399.1529] device (eth0): Activation: failed for connection 'Wired connection 1'
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1533] device (eth0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1552] policy: auto-activating connection 'Wired connection 1'
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1563] device (eth0): Activation: starting connection 'Wired connection 1' (badb0db2-0c57-3723-a750-71cce2748287)
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1565] device (eth0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1566] manager: NetworkManager state is now CONNECTING
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1569] device (eth0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1742] device (eth0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1746] dhcp4 (eth0): activation: beginning transaction (timeout in 45 seconds)
Jun 11 19:43:19 linux-zpc0 NetworkManager[1341]: <info> [1528717399.1762] dhcp4 (eth0): dhclient started with pid 2186
我就想看下是 NetworkManager 还是 Wickedd。在 NM 确定不好用的情况下,运行下 sudo journalctl -U NetworkManager,拉到最下面把最新的那次连接的消息发出来看看。
输入:
sudo journalctl -u NetworkManager
输出:
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1310] dhcp4 (eth0): request timed out
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1310] dhcp4 (eth0): state changed unknown -> timeout
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1631] dhcp4 (eth0): canceled DHCP transaction, DHCP client pid 2139
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1632] dhcp4 (eth0): state changed timeout -> done
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1634] device (eth0): state change: ip-config -> failed (reason ‘ip-config-unavailable’, sys-iface-state: ‘managed’)
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1635] manager: NetworkManager state is now DISCONNECTED
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1638] device (eth0): Activation: failed for connection ‘Wired connection 1’
Jun 12 20:15:05 linux-zpc0 NetworkManager[1340]: [1528805705.1641] device (eth0): state change: failed -> disconnected (reason ‘none’, sys-iface-state: ‘managed’)
Jun 12 20:17:47 linux-zpc0 NetworkManager[1340]: [1528805867.1722] device (wlan0): set-hw-addr: set MAC address to 96:25:96:1D:1B:1E (scanning)
Jun 12 20:17:47 linux-zpc0 NetworkManager[1340]: [1528805867.2112] device (wlan0): supplicant interface state: ready -> disconnected
Jun 12 20:17:47 linux-zpc0 NetworkManager[1340]: [1528805867.2811] device (wlan0): supplicant interface state: disconnected -> inactive
dhcpd 的问题,取不到 IP
请问有办法修复吗
能啊,重启完上不了网的时候、运行下:
dhclient -v eth0
看看日志
Internet Systems Consortium DHCP Client 4.3.6-P1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/ac:9e:17:1f:31:04
Sending on LPF/eth0/ac:9e:17:1f:31:04
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4 (xid=0x2fff6145)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x2fff6145)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14 (xid=0x2fff6145)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 19 (xid=0x2fff6145)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x2fff6145)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x2fff6145)
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
先把 NM 关了,systemctl stop NetworkManager,然后再 dhclient -v eth0 看看。同时看下 lsmod,也有可能是出于某种原因重启后网卡驱动认成别的了。
关闭 NM(systemctl stop NetworkManager)后,运行dhclient -v eth0 得到:
Listening on LPF/eth0/ac:9e:17:1f:31:04
Sending on LPF/eth0/ac:9e:17:1f:31:04
Sending on Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x1e009165)
DHCPACK from 192.168.1.1 (xid=0x1e009165)
bound to 192.168.1.213 -- renewal in 40844 seconds.
运行lsmod,得到:
Module Size Used By
r8169 94208 0
现在看起来是 NM 自己的问题。你在 /etc/NetworkManager/NetworkManager.conf 里加上:
[logging]
level=DEBUG
看看 systemd 的日志还跟以前一样不?
添加后reboot,网络依然连接不了。
运行dhclient -v eth0,得到
Listening on LPF/eth0/ac:9e:17:1f:31:04
Sending on LPF/eth0/ac:9e:17:1f:31:04
Sending on Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x5d20e9e3)
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x5d20e9e3)
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x5d20e9e3)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 2 (xid=0x7213babd)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4 (xid=0x7213babd)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6 (xid=0x7213babd)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x7213babd)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 19 (xid=0x7213babd)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13 (xid=0x7213babd)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9 (xid=0x7213babd)
No DHCPOFFERS received.
Trying recorded lease 192.168.1.213
No working leases in persistent database - sleeping.
运行systemctl status -l network.service后,得到
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
└─NetworkManager-ovs.conf
Active: active (running) since Thu 2018-06-14 22:32:23 CST; 36s ago
Docs: man:NetworkManager(8)
Main PID: 1306 (NetworkManager)
Tasks: 5 (limit: 4915)
CGroup: /system.slice/NetworkManager.service
├─1306 /usr/sbin/NetworkManager --no-daemon
└─1956 /sbin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-badb0db2-0c57-3723-a750-71cce2748287-eth0.lease -cf /var/lib/NetworkManager/dhclient-eth0.conf eth0
Jun 14 22:32:50 linux-zpc0 NetworkManager[1306]: <debug> [1528986770.9130] device[0x555becbf99e0] (wlan0): wifi-scan: scanning-state: idle
Jun 14 22:32:50 linux-zpc0 NetworkManager[1306]: <debug> [1528986770.9222] device[0x555becbf99e0] (wlan0): wifi-scan: scan-done callback: successful
Jun 14 22:32:50 linux-zpc0 NetworkManager[1306]: <debug> [1528986770.9223] device[0x555becbf99e0] (wlan0): add_pending_action (2): 'autoactivate'
Jun 14 22:32:50 linux-zpc0 NetworkManager[1306]: <debug> [1528986770.9223] device[0x555becbf99e0] (wlan0): remove_pending_action (1): 'wifi-scan'
Jun 14 22:32:50 linux-zpc0 NetworkManager[1306]: <debug> [1528986770.9228] device[0x555becbf99e0] (wlan0): remove_pending_action (0): 'autoactivate'
Jun 14 22:32:50 linux-zpc0 NetworkManager[1306]: <debug> [1528986770.9228] manager: check_if_startup_complete returns FALSE because of eth0
Jun 14 22:32:58 linux-zpc0 NetworkManager[1306]: <debug> [1528986778.1263] device[0x555becbd74e0] (eth0): timed out waiting for IPv6 router advertisement
Jun 14 22:32:58 linux-zpc0 NetworkManager[1306]: <debug> [1528986778.1263] device[0x555becbd74e0] (eth0): activation-stage: schedule activate_stage4_ip6_config_timeout,v6 (id 841)
Jun 14 22:32:58 linux-zpc0 NetworkManager[1306]: <debug> [1528986778.1263] device[0x555becbd74e0] (eth0): activation-stage: invoke activate_stage4_ip6_config_timeout,v6 (id 841)
Jun 14 22:32:58 linux-zpc0 NetworkManager[1306]: <debug> [1528986778.1263] device[0x555becbd74e0] (eth0): activation-stage: complete activate_stage4_ip6_config_timeout,v6 (id 841)
是用 journalctl -U NetworkManager 看,status -l 看到的只有一小部分
不好意思啊,我是小白:sweat_smile:
journalctl -u NetworkManager
这个命令的结果太多了,是需要grep哪个关键词呢?