Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]ipv6 only重装后网络并没有正确被配置 #231

Open
emptysuns opened this issue Jan 6, 2025 · 12 comments
Open

[bug]ipv6 only重装后网络并没有正确被配置 #231

emptysuns opened this issue Jan 6, 2025 · 12 comments

Comments

@emptysuns
Copy link

emptysuns commented Jan 6, 2025

原来的系统:debian 12
要安装的系统:arch

***** NETWORK INFO *****
IPv4 MAC: 
IPv4 Address: 
IPv4 Gateway: 
---
IPv6 MAC: 00:17:3b:d7:4a:71
IPv6 Address: 2a14:xxxx:8400::2:0:xxxx/120
IPv6 Gateway: 2a14:xxxx:8400::2

28M     .
21M     .
***** MAIN DISK: VDA *****
4B476DA3-A9DF-4327-A2D2-7E14E01CB37E
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.1.0-28-amd64
Found initrd image: /boot/initrd.img-6.1.0-28-amd64
Found linux image: /boot/vmlinuz-6.1.0-9-amd64
Found initrd image: /boot/initrd.img-6.1.0-9-amd64
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done
***** GRUB *****
/boot/grub/custom.cfg
set timeout_style=menu
set timeout=5
menuentry "reinstall (arch)" --unrestricted {
    insmod lvm
    insmod all_video
    search --no-floppy --file --set=root /reinstall-vmlinuz
    linux /reinstall-vmlinuz alpine_repo=http://dl-cdn.alpinelinux.org/alpine/v3.21/main modloop=http://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/netboot/modloop-virt console=ttyS0,115200n8 console=tty0  finalos_distro=arch finalos_mirror='https://geo.mirror.pkgbuild.com'  extra_confhome='https://raw.githubusercontent.com/bin456789/reinstall/main' extra_main_disk=4B476DA3-A9DF-4327-A2D2-7E14E01CB37E extra_allow_ping=1
    initrd /reinstall-initrd
}
***** INFO *****
arch 
Username: root
Password: testtest
Reboot to start the installation.

重装前观察到能正确获得到ipv6地址,但是重装后,该地址并没有被正确的配置到网卡,导致失联
同样的情况也出现在重装成alpine上
只有ipv6入栈,有ipv4出栈的vps却没有这个问题

VNC故障截图

2496181287b3236713727575aa7b807f.png

@bin456789
Copy link
Owner

看下 /etc/systemd/network/10-cloud-init-eth0.network 有没有 ip 信息

@emptysuns
Copy link
Author

看下 /etc/systemd/network/10-cloud-init-eth0.network 有没有 ip 信息

没有,只有mac地址被正确添加了

[Match]
MACAddress=00:17:3b:d7:4a:71

[Network]
DHCP=no
DNS=2606:4700:4700::1111 2001:4860:4860::8888

@emptysuns
Copy link
Author

emptysuns commented Jan 6, 2025

[Match]
MACAddress=00:17:3b:d7:4a:71

[Network]
DHCP=no
DNS=2606:4700:4700::1111 2001:4860:4860::8888

[Address]
Address=2a14:xxxx:8400::2:0:xxxx/120
[Route]
Gateway=2a14:xxxx:8400::2

我尝试着自己添加了ipv6地址,现在恢复了联网,但networkctl status提示网关参数错误,可能我搞错了参数

[root@archlinux ~]# networkctl status
● Interfaces: 1, 2
       State: routable                         
Online state: online                           
     Address: 2a14:xxxx:8400::2:0:xxxx on ens3
              fe80::217:3bff:fed7:4a71 on ens3
     Gateway: fe80::3a0e:4dff:fe4c:3025 on ens3
         DNS: 2606:4700:4700::1111
              2001:4860:4860::8888

Jan 06 14:52:08 archlinux systemd[1]: Starting Network Configuration...
Jan 06 14:52:09 archlinux systemd-networkd[308]: lo: Link UP
Jan 06 14:52:09 archlinux systemd-networkd[308]: lo: Gained carrier
Jan 06 14:52:09 archlinux systemd[1]: Started Network Configuration.
Jan 06 14:52:09 archlinux systemd-networkd[308]: ens3: Configuring with /etc/systemd/network/10-cloud-init-eth0.n
etwork.
Jan 06 14:52:09 archlinux systemd-networkd[308]: ens3: Link UP
Jan 06 14:52:09 archlinux systemd-networkd[308]: ens3: Gained carrier
Jan 06 14:52:10 archlinux systemd-networkd[308]: ens3: Gained IPv6LL
Jan 06 15:23:02 archlinux systemd-networkd[308]: ::::/etc/systemd/network/10-cloud-init-eth0.network:11: Failed to parse 
Gateway=2a14:xxxx:8400::2, ignoring: Invalid argument
Jan 06 15:23:02 archlinux systemd-networkd[308]: ens3: Reconfiguring with /etc/systemd/network/10-cloud-init-eth0
.network.

@bin456789
Copy link
Owner

添加 GatewayOnLink=yes

[Route]
Gateway=2a14:xxxx:8400::2
GatewayOnLink=yes

@emptysuns
Copy link
Author

emptysuns commented Jan 6, 2025

Jan 06 15:47:16 archlinux systemd-networkd[308]: ens3: Reconfiguring with /etc/systemd/network/10-cloud-init-eth0
.network.

它可以正常工作了
不加这个gateway,network-systemd也会自动获取ipv6的网关,所以也可以删掉它

@bin456789
Copy link
Owner

能不能装个 ndisc6
发下 rdisc6 ens5 | sed 's/2.*:://' 的输出

@emptysuns
Copy link
Author

能不能装个 ndisc6 发下 rdisc6 ens5 | sed 's/2.*:://' 的输出

我没有ens5这个网卡

[root@archlinux ~]# rdisc6 ens5 | sed 's/2.*:://'
ens5: No such device

我猜你说的应该是ens3

[root@archlinux ~]# rdisc6 ens3 | sed 's/2.*:://'

Soliciting ff02) on ens3...

Hop limit                 :           64 (      0x40)
Stateful address conf.    :           No
Stateful other conf.      :           No
Mobile home agent         :           No
Router preference         :       medium
Neighbor discovery proxy  :           No
Router lifetime           :         1800 (0x00000708) seconds
Reachable time            :  unspecified (0x00000000)
Retransmit time           :  unspecified (0x00000000)
 Source link-layer address: 38:0E:4D:4C:30:25
 Prefix                   : fe00:1:0:1001::/126
  On-link                 :          Yes
  Autonomous address conf.:          Yes
  Valid time              :      2592000 (0x00278d00) seconds
  Pref. time              :       604800 (0x00093a80) seconds
 MTU                      :         1500 bytes (valid)
 from fe80::3a0e:4dff:fe4c:3025

@bin456789
Copy link
Owner

bin456789 commented Jan 6, 2025

脚本的 ipv6 配置是根据 ipv6 通告产生的,也就是 rdisc6 显示的内容
通告说应该通过 SLAAC 自动生成 IP,因此 10-cloud-init-eth0.network 没有 IP,这是正确的
但是通告给出的前缀是 fe00:1:0:1001::/126 的前缀,这是错误的配置,因此无法自动生成 IP

不加这个gateway,network-systemd也会自动获取ipv6的网关,所以也可以删掉它

帮我看下 ip -6 route show default 是 default via fe80 还是 default via 2a14
我判断下网关是怎么产生的

@emptysuns
Copy link
Author

emptysuns commented Jan 6, 2025

帮我看下 ip -6 route show default 是 default via fe80 还是 default via 2a14 我判断下网关是怎么产生的

[root@archlinux ~]#  ip -6 route show default
default nhid 1716713450 via fe80::3a0e:4dff:fe4c:3025 dev ens3 proto ra metric 1024 expires 1646sec pref medium
default via 2a14:xxxx:8400::2 dev ens3 proto static metric 1024 onlink pref medium

via 2a14看起来是商家镜像问题,没有SLAAC通告,但是route default却指向了2a14:xxxx:8400::2

@bin456789
Copy link
Owner

default nhid 1716713450 via fe80::3a0e:4dff:fe4c:3025 这是自动获取的网关
default via 2a14 后面是 static ,这应该是之前从 10-cloud-init-eth0.network 读取的,如果 10-cloud-init-eth0.network 删除了网关,重启后这条应该会不见

@bin456789
Copy link
Owner

这个脚本会尝试从 slaac/dhcpv6 获取 ip
如果能获取到 ip,则判断系统为动态 ip,生成的配置文件不包含 ip
如果没获取到 ip,则判断系统为静态 ip,生成的配置文件有从旧系统记录的 ip

但是最终生成的 10-cloud-init-eth0.network 没有 ip
有两种可能

  1. 这个机器本身能用 dhcpv6
  2. 脚本没处理这种通告乱配的情况,有时间再改进下

@emptysuns
Copy link
Author

这个脚本会尝试从 slaac/dhcpv6 获取 ip 如果能获取到 ip,则判断系统为动态 ip,生成的配置文件不包含 ip 如果没获取到 ip,则判断系统为静态 ip,生成的配置文件有从旧系统记录的 ip

但是最终生成的 10-cloud-init-eth0.network 没有 ip 有两种可能

1. 这个机器本身能用 dhcpv6

2. 脚本没处理这种通告乱配的情况,有时间再改进下

谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants