openSUSE Tumbleweed 升级到 20190202 后 resolv.conf 变为软链接,能 ping IP 不能 ping 网址

今年以来,TW想从4.20.0-1 DUP,不管更新到4.20.12还是4.20.13之后网络都是不行,就算用netconfig update -f` 强制更新也不行,ping DNS地址都可以通。rollback了N回。唉!

1赞

网络问题确实挺难 debug 的…

出了这种问题:

  1. ip a 看看网卡有没有 IP 地址
  2. ping 路由器 IP(确定是不是连上路由器了)
  3. nslookup baidu.com (确定是不是 DNS 解析挂了)
  4. ping baidu.com 看看是不是外网挂了
  5. route -n 看看本地路由设置的对不对

如果这些简单的步骤都能过,那就要检查下代理比如 ss 是不是 connection reset by remote peer 这些问题了。

要是过不了,再针对问题再分情况继续 debug。一句不能上网对我们的帮助其实是非常非常小的,因为我们不在一个网络下,不能自己去执行那些命令的。

1赞

@marguerite 女王大人

在正常状态下,结果如下:

$ nslookup baidu.com
Server:         61.147.37.1
Address:        61.147.37.1#53
Non-authoritative answer:
Name:   baidu.com
Address: 123.125.115.110
Name:   baidu.com
Address: 220.181.57.216

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags  Metric Ref    Use Iface
0.0.0.0         192.168.21.254  0.0.0.0         UG    100    0        0 ens5
192.168.21.0    0.0.0.0         255.255.255.0   U     100    0        0 ens5

这是DUP后的结果,TW版本为4.20.13:

$ nslookup baidu.com
Server:         61.147.37.1
Address:        61.147.37.1#53
Non-authoritative answer:
Name:   baidu.com
Address: 123.125.115.110
Name:   baidu.com
Address: 220.181.57.216

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.21.254  0.0.0.0         UG    100    0        0 ens5
192.168.21.0    0.0.0.0         255.255.255.0   U     100    0        0 ens5
$ ping baidu.com
ping: baidu.com: 域名解析暂时失败

然而,进入快照【DUP后的】ping baidu.com 域名解析暂时失败,但是浏览器竟然是可以正常上网的,退出快照进入正常桌面便又不行了,很是奇怪呢。

你这是 TW,我拆分了帖子。

你的 ip -a 呢?两边取 IP 地址都正常?是用的 NetworkManager 还是 wickked?

另外你的 TW 4.20.13 是什么意思?TW 没有这种版本号

麻烦您了。没有能够描述准确。
下面来个比较准确的。

操作系统: openSUSE Tumbleweed 20190312
KDE Plasma 版本: 5.15.2
KDE 框架版本: 5.55.0
Qt 版本: 5.12.0
内核版本: 4.20.13-1-default
操作系统类型: 64-位
处理器: 2 × Intel® Core™2 Duo CPU T6570 @ 2.10GHz
内存: 3.8 GiB 内存

网络管理是NetworkManager

$ ip a
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: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:25:b3:62:c5:3f brd ff:ff:ff:ff:ff:ff
    inet 192.168.21.239/24 brd 192.168.21.255 scope global dynamic noprefixroute ens5
       valid_lft 86178sec preferred_lft 86178sec
    inet6 fe80::3639:3082:e00f:311/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
$ ping 192.168.21.254
PING 192.168.21.254 (192.168.21.254) 56(84) bytes of data.
64 bytes from 192.168.21.254: icmp_seq=1 ttl=255 time=1.34 ms
64 bytes from 192.168.21.254: icmp_seq=2 ttl=255 time=1.36 ms
64 bytes from 192.168.21.254: icmp_seq=3 ttl=255 time=1.39 ms
64 bytes from 192.168.21.254: icmp_seq=4 ttl=255 time=1.38 ms
64 bytes from 192.168.21.254: icmp_seq=5 ttl=255 time=1.30 ms
64 bytes from 192.168.21.254: icmp_seq=6 ttl=255 time=1.37 ms
64 bytes from 192.168.21.254: icmp_seq=7 ttl=255 time=1.21 ms
^C
--- 192.168.21.254 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 16ms
rtt min/avg/max/mdev = 1.213/1.335/1.387/0.066 ms
$ ping 192.168.100.254
PING 192.168.100.254 (192.168.100.254) 56(84) bytes of data.
64 bytes from 192.168.100.254: icmp_seq=1 ttl=255 time=1.18 ms
64 bytes from 192.168.100.254: icmp_seq=2 ttl=255 time=1.36 ms
64 bytes from 192.168.100.254: icmp_seq=3 ttl=255 time=1.45 ms
64 bytes from 192.168.100.254: icmp_seq=4 ttl=255 time=1.41 ms
64 bytes from 192.168.100.254: icmp_seq=5 ttl=255 time=1.37 ms
64 bytes from 192.168.100.254: icmp_seq=6 ttl=255 time=1.42 ms
^C
--- 192.168.100.254 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 13ms
rtt min/avg/max/mdev = 1.176/1.364/1.448/0.096 ms
$ nslookup baidu.com
Server:         61.147.37.1
Address:        61.147.37.1#53

Non-authoritative answer:
Name:   baidu.com
Address: 123.125.115.110
Name:   baidu.com
Address: 220.181.57.216

$ ping baidu.com
ping: baidu.com: 未知的名称或服务
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.21.254  0.0.0.0         UG    20100  0        0 ens5
192.168.21.0    0.0.0.0         255.255.255.0   U     100    0        0 ens5

$

快照状态下

操作系统: openSUSE Tumbleweed 20190312
KDE Plasma 版本: 5.15.2
KDE 框架版本: 5.55.0
Qt 版本: 5.12.0
内核版本: 4.20.13-1-default
操作系统类型: 64-位
处理器: 2 × Intel® Core™2 Duo CPU T6570 @ 2.10GHz
内存: 3.8 GiB 内存

网络管理是NetworkManager

$ ip a
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: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:25:b3:62:c5:3f brd ff:ff:ff:ff:ff:ff
    inet 192.168.21.239/24 brd 192.168.21.255 scope global dynamic noprefixroute ens5
       valid_lft 86123sec preferred_lft 86123sec
    inet6 fe80::3639:3082:e00f:311/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
$ ^C
$ ping 192.168.21.254
PING 192.168.21.254 (192.168.21.254) 56(84) bytes of data.
64 bytes from 192.168.21.254: icmp_seq=1 ttl=255 time=1.30 ms
64 bytes from 192.168.21.254: icmp_seq=2 ttl=255 time=1.27 ms
64 bytes from 192.168.21.254: icmp_seq=3 ttl=255 time=1.39 ms
64 bytes from 192.168.21.254: icmp_seq=4 ttl=255 time=1.37 ms
64 bytes from 192.168.21.254: icmp_seq=5 ttl=255 time=1.28 ms
64 bytes from 192.168.21.254: icmp_seq=6 ttl=255 time=1.39 ms
^C
--- 192.168.21.254 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 13ms
rtt min/avg/max/mdev = 1.267/1.330/1.390/0.052 ms
$ ping 192.168.100.254
PING 192.168.100.254 (192.168.100.254) 56(84) bytes of data.
64 bytes from 192.168.100.254: icmp_seq=1 ttl=255 time=1.15 ms
64 bytes from 192.168.100.254: icmp_seq=2 ttl=255 time=1.38 ms
64 bytes from 192.168.100.254: icmp_seq=3 ttl=255 time=1.37 ms
64 bytes from 192.168.100.254: icmp_seq=4 ttl=255 time=1.32 ms
64 bytes from 192.168.100.254: icmp_seq=5 ttl=255 time=1.23 ms
^C
--- 192.168.100.254 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 10ms
rtt min/avg/max/mdev = 1.147/1.289/1.377/0.094 ms
$ nslookup baidu.com
Server:         61.147.37.1
Address:        61.147.37.1#53

Non-authoritative answer:
Name:   baidu.com
Address: 123.125.115.110
Name:   baidu.com
Address: 220.181.57.216

$ ping baidu.com
ping: baidu.com: 域名解析暂时失败
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.21.254  0.0.0.0         UG    100    0        0 ens5
192.168.21.0    0.0.0.0         255.255.255.0   U     100    0        0 ens5

从yast图形界面看好像启用了IPV6


看概览显示的是未配置
后面两个标签主机名和路由都是空的。

nslookup 能解析出 IP 地址,ping 的时候不行?还有你 ping 192.168.100.254 有什么特殊吗?我看你的 gateway 是 192.168.21.254 啊

我的系统无线坏掉了,有线连接在墙插座上。21网段为办公室所在的网段,100是三层交换机所在的网段。 就是ping baidu.com 就不行了。怀疑本机在处理DNS时候出了问题。

你的 /etc/resolv.conf 内容是什么?还有 /etc/hosts?你把百度的 IP 放到 /etc/hosts 里看看能不能 ping 过去?

/etc/resolv.conf 的内容

### /etc/resolv.conf is a symlink to /var/run/netconfig/resolv.conf
### autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
### Call "netconfig update -f" to force adjusting of /etc/resolv.conf.
nameserver 61.147.37.1
nameserver 8.8.8.8

/etc/hosts内容【添加了百度的地址】

#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#    
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1	localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-eta.com
218.93.127.136 uc.pcbeta.com

218.93.127.136 m.pcbeta.com

218.93.127.136 web.pcbeta.com

218.93.127.136 i.pcbeta.com

218.93.127.136 bbs.pcbeta.com

218.93.127.136 www.pcbeta.com

218.93.127.136 cdn.pcbeta.attachment.inimc.com

218.93.127.136 cdn.pcbeta.static.inimc.com

218.93.127.136 cdn.pcbeta.css.inimc.com

218.93.127.136 static.template.pcbeta.com

220.181.27.216 baidu.com

123.125.115.110 baidu.com

ping baidu.com 结果是不通,100%丢包

不知道覆盖安装能不能解决。

@marguerite 我的正常版本也就是网络完全正常的,为20190121版本,曾经注意看了一下,在此版本中 /etc/resolv.conf就是实体文件,而往后的版本中升级了NetWorkManager,DUP后发现/etc/resolv.conf变成了链接(/etc/resolv.conf is a symlink to /var/run/netconfig/resolv.conf),虽然内容是一样的,但是DNS就出问题了。

@cathagelo

不好意思,我刚看到。

你确定网络是 NetworkManager 管理的?

你看一下 /etc/resolv.conf 链接指向的最终文件是出自哪个软件包?(“rpm -qf 文件“)

我猜测是那个文件不是 NM 管理的,兴许这个 netconfig 是 wickedd 的一部分。

这个文件是 sysconfig 管理的。

https://bugzilla.opensuse.org/show_bug.cgi?id=1124152

你 sudo zypper up sysconfig 可能就好了。

或者运行 sudo netconfig update -f,不好使可以把 /etc
/resolv.conf 删除重新做软链接:

sudo rm -rf /etc/resolv.conf
sudo ln -s /var/run/netconfig/resolv.conf /etc/resolv.conf

THX,我来试试。

@marguerite 啊呀,然并卵。

遇到了跟楼主每个细节都一模一样的问题, 滚动版系统,一直保持最新.我的是安装了 YaST 里面的 tftp 服务器以后出现的 :thinking: 不知道楼主最后解决了没有

已经解决了, 问题出在/etc/nsswitch.conf 文件,
hosts: [NOTFOUND=return] files mdns_minimal dns 这一行,有问题的主机 [NOTFOUND=return] 这一项在最前面, 顺序改为 files mdns_minimal [NOTFOUND=return] dns 就好了