我的本地网络很简单。
sudo ifconfig
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.31.52 netmask 255.255.255.0 broadcast 192.168.31.255
inet6 fe80::e23f:49ff:fe57:4bd1 prefixlen 64 scopeid 0x20<link>
ether txqueuelen 1000 (Ethernet)
RX packets 934205 bytes 918638128 (876.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 557104 bytes 69517532 (66.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 2773 bytes 4761793 (4.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2773 bytes 4761793 (4.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ssh -vv -6 2001:19f0:5401:1cda:5400:02ff:fe8c:056f%enp3s0
OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u 20 Dec 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "2001:19f0:5401:1cda:5400:02ff:fe8c:056f%enp3s0" port 22
ssh: Could not resolve hostname 2001:19f0:5401:1cda:5400:02ff:fe8c:056f%enp3s0: Name or service not known
sudo ip -6 addr add 2001:19f0:5401:1cda:5400:02ff:fe8c:056f/128 dev enp3s0
ssh -vv -6 2001:19f0:5401:1cda:5400:02ff:fe8c:056f%enp3s0
OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u 20 Dec 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "2001:19f0:5401:1cda:5400:02ff:fe8c:056f%enp3s0" port 22
ssh: Could not resolve hostname 2001:19f0:5401:1cda:5400:02ff:fe8c:056f%enp3s0: Name or service not known
答案1
简短回答:
您必须定义公共 IPV6。
长答案:
我假设你的 ISP 给你一个 IP,假设你有2001:0db8:0001:0001::0/64
公共 IP(实际上是公共 IPV6 网络)。
现在,尝试
sudo ip -6 addr add 2001:0db8:0001:0001::0022/128 dev enp3s0
在本地主机上。 (替换值和网络接口)
请注意,您将无法从“内部”测试它。 (当我有两个互联网提供商时,我无法保存)。您可以使用互联网上的在线测试 ipv6 工具。
您可以使用以下命令验证您的 ipv6 连接
ping -I enp3s0 ipv6.google.com