我曾经历过由于 ipv6 导致的连接缓慢甚至中断。但是,我想知道为什么这个问题在 linux 中仍然存在,因为 ipv6。
它挂在 ipv6 上
ping -4 google.com
PING (142.250.187.110) 56(84) bytes of data.
64 bytes from sof02s44-in-f14.1e100.net (142.250.187.110): icmp_seq=1 ttl=57 time=22.4 ms
64 bytes from sof02s44-in-f14.1e100.net (142.250.187.110): icmp_seq=2 ttl=57 time=22.7 ms
64 bytes from sof02s44-in-f14.1e100.net (142.250.187.110): icmp_seq=3 ttl=57 time=33.4 ms
64 bytes from sof02s44-in-f14.1e100.net (142.250.187.110): icmp_seq=4 ttl=57 time=21.9 ms
64 bytes from sof02s44-in-f14.1e100.net (142.250.187.110): icmp_seq=5 ttl=57 time=22.2 ms
^C
--- ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 21.923/24.508/33.404/4.454 ms
(base) elias@eliasc:~$ ping -6 google.com
PING google.com(sof02s44-in-x0e.1e100.net (2a00:1450:4017:80d::200e)) 56 data bytes
(forever hung)
和这里:
ip -6 addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2a02:85f:f09f:b868:1d08:5c1e:5523:a55f/64 scope global temporary dynamic
valid_lft 577994sec preferred_lft 59400sec
inet6 2a02:85f:f09f:b868:68ca:478f:135b:6471/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2565048sec preferred_lft 577848sec
inet6 2a02:85f:f02e:2f85:7e6:adb5:7359:d44e/64 scope global temporary dynamic
valid_lft 577994sec preferred_lft 59400sec
inet6 2a02:85f:f02e:2f85:8e42:6d7d:b971:dc85/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2591965sec preferred_lft 604765sec
inet6 2a02:85f:f09f:b868:4414:4d8c:717:dd12/64 scope global temporary dynamic
valid_lft 576307sec preferred_lft 57713sec
inet6 fe80::e7ad:7295:e675:4ecc/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UNKNOWN qlen 1000
inet6 fe80::250:56ff:fec0:1/64 scope link
valid_lft forever preferred_lft forever
5: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UNKNOWN qlen 1000
inet6 fe80::250:56ff:fec0:8/64 scope link
valid_lft forever preferred_lft forever
(base) elias@eliasc:~$ ip -6 neigh show
fe80::1 dev enp3s0 lladdr 74:9d:79:65:28:38 router REACHABLE
(base) elias@eliasc:~$ ip -6 route list
2a02:85f:f02e:2f85::/64 dev enp3s0 proto ra metric 100 pref medium
2a02:85f:f09f:b868::/64 dev enp3s0 proto ra metric 100 pref medium
fe80::/64 dev vmnet1 proto kernel metric 256 pref medium
fe80::/64 dev vmnet8 proto kernel metric 256 pref medium
fe80::/64 dev enp3s0 proto kernel metric 1024 pref medium
default via fe80::1 dev enp3s0 proto ra metric 20100 pref high
和这里:
traceroute6 google.com
traceroute to google.com (2a00:1450:4017:80d::200e), 30 hops max, 80 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 *^C
(base) elias@eliasc:~$ traceroute google.com
traceroute to google.com (142.250.187.110), 30 hops max, 60 byte packets
1 vodafone.station (192.168.2.1) 0.306 ms 0.364 ms 0.411 ms
2 loopback2004.med01.dsl.hol.gr (62.38.0.170) 13.958 ms 13.974 ms 13.935 ms
3 * * *
4 ae3-100-ucr1.atm.cw.net (195.89.103.89) 15.000 ms 15.126 ms 16.210 ms
5 ae24-xcr1.sof.cw.net (195.2.16.5) 32.984 ms 32.357 ms 32.937 ms
6 72.14.218.54 (72.14.218.54) 29.679 ms 72.14.208.246 (72.14.208.246) 27.225 ms 209.85.149.140 (209.85.149.140) 27.844 ms
7 * * *
8 209.85.243.244 (209.85.243.244) 28.219 ms^C
猫/等/主机
127.0.0.1 localhost.localdomain localhost (USER)
127.0.1.1 USER
127.0.1.2 test.com
127.0.1.3 www.test.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
cat /etc/host.conf
multi on
sysctl.conf 上没有取消注释(运行)的内容
sudo tcpdump -i enp3s0 -l ip6
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on enp3s0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
17:13:08.145234 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:13:08.458055 IP6 eliasc.55242 > _gateway.5355: Flags [S], seq 4257863812, win 64440, options [mss 1432,sackOK,TS val 4114399771 ecr 0,nop,wscale 7,tfo cookiereq,nop,nop], length 0
17:13:08.458369 IP6 _gateway.5355 > eliasc.55242: Flags [R.], seq 0, ack 4257863813, win 0, length 0
17:13:10.092653 IP6 _gateway > eliasc: ICMP6, neighbor solicitation, who has eliasc, length 32
17:13:10.092682 IP6 eliasc > _gateway: ICMP6, neighbor advertisement, tgt is eliasc, length 24
17:13:13.265418 IP6 _gateway > ip6-allnodes: ICMP6, router advertisement, length 56
17:13:13.274832 IP6 eliasc > ff02::16: HBH ICMP6, multicast listener report v2, 8 group record(s), length 168
17:13:13.344671 IP6 eliasc.38984 > 2606:4700:e6::ac40:cb02.http: Flags [S], seq 3695938649, win 64440, options [mss 1432,sackOK,TS val 168040687 ecr 0,nop,wscale 7], length 0
17:13:13.492016 IP6 eliasc.36950 > 2606:4700:e6::ac40:cb02.5355: Flags [S], seq 372145597, win 64440, options [mss 1432,sackOK,TS val 168040835 ecr 0,nop,wscale 7,tfo cookiereq,nop,nop], length 0
17:13:13.492030 IP6 eliasc.36952 > 2606:4700:e6::ac40:cb02.5355: Flags [S], seq 4007085850, win 64440, options [mss 1432,sackOK,TS val 168040835 ecr 0,nop,wscale 7,tfo cookiereq,nop,nop], length 0
17:13:13.558853 IP6 eliasc > ff02::16: HBH ICMP6, multicast listener report v2, 8 group record(s), length 168
17:13:13.707454 IP6 eliasc.36956 > 2606:4700:e6::ac40:cb02.5355: Flags [S], seq 2244580855, win 64440, options [mss 1432,sackOK,TS val 168041050 ecr 0,nop,wscale 7,tfo cookiereq,nop,nop], length 0
17:13:14.518857 IP6 eliasc.36952 > 2606:4700:e6::ac40:cb02.5355: Flags [S], seq 4007085850, win 64440, options [mss 1432,sackOK,TS val 168041861 ecr 0,nop,wscale 7], length 0
17:13:14.518874 IP6 eliasc.36950 > 2606:4700:e6::ac40:cb02.5355: Flags [S], seq 372145597, win 64440, options [mss 1432,sackOK,TS val 168041861 ecr 0,nop,wscale 7], length 0
17:13:15.365689 IP6 eliasc.39002 > 2606:4700:e6::ac40:cb02.http: Flags [S], seq 3071295745, win 64440, options [mss 1432,sackOK,TS val 168042708 ecr 0,nop,wscale 7], length 0
17:13:16.175326 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:13:18.486829 IP6 eliasc > _gateway: ICMP6, neighbor solicitation, who has _gateway, length 32
17:13:18.487081 IP6 _gateway > eliasc: ICMP6, neighbor advertisement, tgt is _gateway, length 24
17:13:24.205373 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:13:32.235457 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:13:38.972915 IP6 _gateway > eliasc: ICMP6, neighbor solicitation, who has eliasc, length 32
17:13:38.972944 IP6 eliasc > _gateway: ICMP6, neighbor advertisement, tgt is eliasc, length 24
17:13:40.265529 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:13:48.295627 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:13:56.325678 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:14:04.355729 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:14:07.853186 IP6 _gateway > eliasc: ICMP6, neighbor solicitation, who has eliasc, length 32
17:14:07.853219 IP6 eliasc > _gateway: ICMP6, neighbor advertisement, tgt is eliasc, length 24
17:14:10.135972 IP6 _gateway > ip6-allnodes: ICMP6, router advertisement, length 56
17:14:10.146865 IP6 eliasc > ff02::16: HBH ICMP6, multicast listener report v2, 8 group record(s), length 168
17:14:10.806855 IP6 eliasc > ff02::16: HBH ICMP6, multicast listener report v2, 8 group record(s), length 168
17:14:12.385798 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
17:14:13.014825 IP6 eliasc > _gateway: ICMP6, neighbor solicitation, who has _gateway, length 32
17:14:13.015120 IP6 _gateway > eliasc: ICMP6, neighbor advertisement, tgt is _gateway, length 24
17:14:20.415846 IP6 _gateway > ip6-allnodes: ICMP6, neighbor advertisement, tgt is _gateway, length 32
这里使用 strace (充斥着此类消息:
recvmsg(3, {msg_namelen=128}, 0) = -1 EAGAIN (the resource is temporarily unavailable)
sendto(3, "\200\0\0\0h\243\0$?\301}e\0\0\0\0\345$\16\0\0\0\0\0\20\21\22\23\24\25\26\27"..., 64, 0, {sa_family=AF_INET6, sin6_port=htons(58), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "2a00:1450:4017:80d::200e", &sin6_addr), sin6_scope_id=0}, 28) = 64
recvmsg(3, {msg_namelen=128}, 0) = -1 EAGAIN (the resource is temporarily unavailable)
根据这篇文章我改变了我的网络接口这里并重新启动了网络服务,但仍无法通过 ipv6 连接,
# interfaces(5) file used by ifup(8) and ifdown(8)
iface enp3s0 inet static
address 10.0.0.1
network 10.0.0.0
netmask 255.255.255.0
broadcast 10.0.0.255
iface enp3s0 inet6 static
address 2001:db8:1:2::2
netmask 64
# Add additional IPv6 addresses when $IFACE goes up
up ip -6 addr add 2001:db8:1:2::3/64 dev $IFACE
up ip -6 addr add 2001:db8:1:2::4/64 dev $IFACE
# Remove them when $IFACE goes down
down ip -6 addr del 2001:db8:1:2::3/64 dev $IFACE
down ip -6 addr del 2001:db8:1:2::4/64 dev $IFACE
ip -brief -6 address
enp3s0 UP 2a02:85f:f09f:b868:1d08:5c1e:5523:a55f/64 2a02:85f:f09f:b868:68ca:478f:135b:6471/64 2a02:85f:f02e:2f85:7e6:adb5:7359:d44e/64 2a02:85f:f02e:2f85:8e42:6d7d:b971:dc85/64 2a02:85f:f09f:b868:4414:4d8c:717:dd12/64 fe80::e7ad:7295:e675:4ecc/64
更新
- 在某处找到了这个地址 2001:db8:1:2::2。不知道这对我的电脑是否有效。
奇怪的事情:
- 通过在界面中取消注释的 inet6 附加行重新启动网络服务,完全失去了互联网连接。
- 通过注释界面中所有额外的 inet6 行,无需重新启动并重启所有互联网服务,仍然无法上网。
- 通过在界面中注释掉所有额外的 inet6 行,并重新启动,仍然无法上网。但是通过重新启动所有互联网服务,互联网又回来了!
- 奇怪的事实?现在 ipv6 正在运行!这到底是怎么回事?
- 我可以假设一些配置文件/变量在内核中或其他地方通过这些更改被悄悄地更改了?不知道。
- 因为我尝试过多次重新启动服务,所以我认为起最大作用的那一行是,我不知道为什么:
pre-up echo 0 > /proc/sys/net/ipv6/conf/enp3s0/accept_dad
当互联网再次工作时,它又改回了 1(仅在重新引导、重新启动服务之后,而不是之前)。 - 我的结论是 Linux 中的 ipv6 支持仍然非常成问题。用户必须进行大量的调试和反复试验才能正常工作。有些网站支持它,有些网站不支持它。有些网站通过 ipv6 连接时速度很慢,而其他网站则更快。所以,这还是有点混乱的。
- 我还不知道当我重新启动时是否可以上网或者 IPv6 是否可以工作。
# Restart network services
sudo /etc/init.d/networking restart;
sudo /etc/init.d/networking stop;
sudo /etc/init.d/networking start;
sudo systemctl restart networking;
sudo systemctl restart NetworkManager;
sudo systemctl restart systemd-hostnamed.service;
sudo systemctl restart fwupd.service ifplugd.service ifupdown-pre.service ifupdown-wait-online.service iio-sensor-proxy.service irqbalance.service ModemManager.service networkd-dispatcher.service networking.service NetworkManager-dispatcher.service NetworkManager.service network-online.target nftables.service sshd.service ssh.service ssh.socket systemd-networkd.service systemd-networkd.socket systemd-network-generator.service;