oneclickvirt/pve

开设纯IPV6地址的虚拟机,SSH无法登录 - 原因在于 IPV6的 gateway 和 address 的前缀过于相似,导致识别错误

Closed this issue · 9 comments

ainp commented

在 Proxmox 虚拟机的控制台可以进入,但SSH客户端无法登录,connection is closed by foreign host

ainp commented

开出来的虚拟机好像没有网络,在xterm.js控制台里重启可以看到信息如下:

     Starting networking.service - Raise network interfaces...

[FAILED] Failed to start networking…ce - Raise network interfaces.
See 'systemctl status networking.service' for details.
[ OK ] Reached target network.target - Network.
Starting cloud-init.servic job (metadata service crawler)...
[ 10.043597] cloud-init[524]: Cloud-init v. 22.4.2 running 'init' at Wed, 22 Nov 2023 06:21:35 +0000. Up 10.01 seconds.
[ 10.068209] cloud-init[524]: ci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
[ 10.088406] cloud-init[524]: ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
[ 10.108981] cloud-init[524]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
[ 10.132963] cloud-init[524]: ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
[ 10.156779] cloud-init[524]: ci-info: | eth0 | True | 172.16.1.1 | 255.255.255.0 | global | bc:24:11:0a:ec:97 |
[ 10.171008] cloud-init[524]: ci-info: | eth0 | True | fe80::be24:11ff:fe0a:ec97/64 | . | link | bc:24:11:0a:ec:97 |
[ 10.188639] cloud-init[524]: ci-info: | eth1 | True | 2606:a8c0:3::101/128 | . | global | bc:24:11:ea:d7:a7 |
[ 10.203641] cloud-init[524]: ci-info: | eth1 | True | fe80::be24:11ff:feea:d7a7/64 | . | link | bc:24:11:ea:d7:a7 |
[ 10.216686] cloud-init[524]: ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | host | . |
[ 10.232167] cloud-init[524]: ci-info: | lo | True | ::1/128 | . | host | . |
[ 10.252201] cloud-init[524]: ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
[ 10.272160] cloud-init[524]: ci-info: +++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++
[ 10.286567] cloud-init[524]: ci-info: +-------+-------------+---------+---------------+-----------+-------+
[ 10.299286] cloud-init[524]: ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
[ 10.311048] cloud-init[524]: ci-info: +-------+-------------+---------+---------------+-----------+-------+
[ 10.324062] cloud-init[524]: ci-info: | 0 | 172.16.1.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
[ 10.336853] cloud-init[524]: ci-info: +-------+-------------+---------+---------------+-----------+-------+
[ 10.348911] cloud-init[524]: ci-info: +++++++++++++++++++++++++Route IPv6 info+++++++++++++++++++++++++
[ 10.360265] cloud-init[524]: ci-info: +-------+------------------+----------------+-----------+-------+
[ 10.370942] cloud-init[524]: ci-info: | Route | Destination | Gateway | Interface | Flags |
[ 10.381524] cloud-init[524]: ci-info: +-------+------------------+----------------+-----------+-------+
[ 10.396235] cloud-init[524]: ci-info: | 1 | 2606:a8c0:3::101 | :: | eth1 | U |
[ 10.406866] cloud-init[524]: ci-info: | 2 | fe80::/64 | :: | eth0 | U |
[ 10.414326] cloud-init[524]: ci-info: | 3 | fe80::/64 | :: | eth1 | U |
[ 10.423707] cloud-init[524]: ci-info: | 4 | ::/0 | 2606:a8c0:3::1 | eth1 | UG |
[ 10.435561] cloud-init[524]: ci-info: | 6 | local | :: | eth1 | U |
[ 10.447907] cloud-init[524]: ci-info: | 7 | local | :: | eth0 | U |
[ 10.456726] cloud-init[524]: ci-info: | 8 | local | :: | eth1 | U |
[ 10.464705] cloud-init[524]: ci-info: | 9 | multicast | :: | eth0 | U |
[ 10.473092] cloud-init[524]: ci-info: | 10 | multicast | :: | eth1 | U |
[ 10.480947] cloud-init[524]: ci-info: +-------+------------------+----------------+-----------+-------+
[ OK ] Finished cloud-init.servic…it job (metadata service crawler).
[ OK ] Reached target cloud-confi…t - Cloud-config availability.
[ OK ] Reached target network-online.target - Network is Online.
[ OK ] Reached target sysinit.target - System Initialization.
[ OK ] Started acpid.path - ACPI Events Check.
[ OK ] Started apt-daily.timer - Daily apt download activities.
[ OK ] Started apt-daily-upgrade.… apt upgrade and clean activities.
[ OK ] Started dpkg-db-backup.tim… Daily dpkg database backup timer.
[ OK ] Started e2scrub_all.timertadata Check for All Filesystems.
[ OK ] Started fstrim.timer - Discard unused blocks once a week.
[ OK ] Started logrotate.timer - Daily rotation of log files.
[ OK ] Started systemd-tmpfiles-c… Cleanup of Temporary Directories.
[ OK ] Reached target paths.target - Path Units.
[ OK ] Reached target timers.target - Timer Units.
[ OK ] Listening on acpid.socket - ACPID Listen Socket.
[ OK ] Listening on cloud-init-ho - cloud-init hotplug hook socket.
[ OK ] Listening on dbus.socket-Bus System Message Bus Socket.
[ OK ] Reached target sockets.target - Socket Units.
[ OK ] Reached target basic.target - Basic System.
[ OK ] Started acpid.service - ACPI event daemon.
Starting cloud-config.serv…tings specified in cloud-config...
[ OK ] Started cron.service -…kground program processing daemon.
Starting dbus.service - D-Bus System Message Bus...
Starting e2scrub_reap.serve ext4 Metadata Check Snapshots...
[ OK ] Started qemu-guest-agent.service - QEMU Guest Agent.
Starting ssh.service - OpenBSD Secure Shell server...
Starting systemd-logind.se…ice - User Login Management...
Starting systemd-user-sess…vice - Permit User Sessions...
[ OK ] Started dbus.service - D-Bus System Message Bus.
[ OK ] Finished systemd-user-sess…ervice - Permit User Sessions.
[ OK ] Started getty@tty1.service - Getty on tty1.
[ OK ] Started serial-getty@ttyS0…rvice - Serial Getty on ttyS0.
[ OK ] Reached target getty.target - Login Prompts.
[ OK ] Started ssh.service - OpenBSD Secure Shell server.
[ OK ] Started systemd-logind.service - User Login Management.
[ 11.473172] cloud-init[568]: Cloud-init v. 22.4.2 running 'modules:config' at Wed, 22 Nov 2023 06:21:36 +0000. Up 11.43 seconds.
[ OK ] Finished cloud-config.serv…ettings specified in cloud-config.
[ OK ] Finished e2scrub_reap.serv…ine ext4 Metadata Check Snapshots.
[ OK ] Reached target multi-user.target - Multi-User System.
[ OK ] Reached target graphical.target - Graphical Interface.
Starting cloud-final.servixecute cloud user/final scripts...
Starting systemd-update-ut Record Runlevel Change in UTMP...
[ OK ] Finished systemd-update-ut… - Record Runlevel Change in UTMP.
[ 12.019064] cloud-init[577]: Cloud-init v. 22.4.2 running 'modules:final' at Wed, 22 Nov 2023 06:21:37 +0000. Up 11.98 seconds.
[ 12.094720] cloud-init[577]: Cloud-init v. 22.4.2 finished at Wed, 22 Nov 2023 06:21:37 +0000. Datasource DataSourceNoCloud [seed=/dev/sr0][dsmode=net]. Up 12.09 seconds
[ OK ] Finished cloud-final.servi… Execute cloud user/final scripts.
[ OK ] Reached target cloud-init.target - Cloud-init target.

Debian GNU/Linux 12 VM101 ttyS0

VM101 login:

ainp commented

GNU nano 7.2 /etc/network/interfaces.d/50-cloud-init

This file is generated from information provided by the datasource. Changes

to it will not persist across an instance reboot. To disable cloud-init's

network configuration capabilities, write a file

/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:

network: {config: disabled}

auto lo
iface lo inet loopback
dns-nameservers 1.1.1.1
dns-search local

auto eth0
iface eth0 inet static
address 172.16.1.1/24
gateway 172.16.1.1

auto eth1
iface eth1 inet6 static
address 2606:a8c0:3::101/128
gateway 2606:a8c0:3::1

我知道什么问题了,稍后尝试修复
v6子网地址前缀识别错误识别到gateway上去了

难绷,这商家给每个虚拟机还绑定了一个非子网内的一个IPV6地址,这个地址被DD的脚本识别为本机V6,是能通没错,但实际这个子网不是商家给你的v6子网

ainp commented

VPS上的设置如下:
截屏2023-11-22 17 07 22

ainp commented

我立即安装

ainp commented

Locale set to C.utf8
No vmbr2 exists to open a server with a standalone IPV6 address
The status of the ndpresponder service is abnormal and the host may not open a service with a separate IPV6 address.
ndpresponder服务状态异常,宿主机不可开设带独立IPV6地址的服务。

ainp commented

上面是上次的宿主机的网络配置,目前配置如下:
截屏2023-11-22 18 02 59