我有一个OpenSSH客户端和服务器。 两者都在OpenSSH 6.0上运行在Debian 7上。 我在两台机器之间build立了一个VPN,并且VPN具有function性的IPv6。 它没有任何IPv4。
令人沮丧的问题是,如果我在ssh_config中设置了AddressFamily inet6选项,我只能连接到使用IPv6的服务器。 我真的不想要设置这个选项。 它确定似乎我应该能够设置AddressFamily any和我的连接工作。
我通过IPv6的工作连接如下所示。
工作ssh_config
Host test-fw-01 test-fw-01.example.org HostKeyAlias test-fw-01.example.org HostName test-fw-01.example.org AddressFamily inet6
工作控制台输出
# ssh -v test-fw-01.example.org OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 122: Applying options for test-fw-01.example.org debug1: /etc/ssh/ssh_config line 370: Applying options for * debug1: Connecting to test-fw-01.example.org. [2607:fa78:1051:2001::1:26] port 22. ... Linux test-fw-01 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 root@test-fw-01:~#
为端口53工作tcpdump
# tcpdump -n port 53 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode 17:05:27.294506 IP 10.2.4.5.59917 > 10.2.4.51.53: 34233+ AAAA? test-fw-01.example.org. (59) 17:05:27.295398 IP 10.2.4.51.53 > 10.2.4.5.59917: 34233* 1/0/0 AAAA 2607:fa78:1051:2001::1:26 (87) 17:05:27.295762 IP 10.2.4.5.42664 > 10.2.4.51.53: 42285+ AAAA? test-fw-01.example.org. (59) 17:05:27.295970 IP 10.2.4.51.53 > 10.2.4.5.42664: 42285 1/0/0 AAAA 2607:fa78:1051:2001::1:26 (87)
当我使用AddressFamily any或AddressFamily inet我看到这一点。
破碎的ssh_config
Host test-fw-01 test-fw-01.example.org HostKeyAlias test-fw-01.example.org HostName test-fw-01.example.org AddressFamily any #supposed to use any?
打破控制台输出
# ssh -v test-fw-01.example.org OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 122: Applying options for test-fw-01.example.org debug1: /etc/ssh/ssh_config line 370: Applying options for * ssh: Could not resolve hostname test-fw-01.example.org.: Name or service not known
端口53的tcpdump在断开的连接上
# tcpdump -n port 53 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode 17:03:30.814876 IP 10.2.4.5.33824 > 10.2.4.51.53: 23711+ A? test-fw-01.esd189.org. (59) 17:03:30.815276 IP 10.2.4.5.33824 > 10.2.4.51.53: 65399+ AAAA? test-fw-01.esd189.org. (59) 17:03:30.815746 IP 10.2.4.51.53 > 10.2.4.5.33824: 65399* 1/0/0 AAAA 2607:fa78:1051:2001::1:26 (87) 17:03:35.819158 IP 10.2.4.5.33824 > 10.2.4.51.53: 23711+ A? test-fw-01.esd189.org. (59) 17:03:39.481119 IP 10.2.4.51.53 > 10.2.4.5.33824: 23711 ServFail 0/0/0 (59) 17:03:40.819636 IP 10.2.4.5.33824 > 10.2.4.51.53: 23711+ A? test-fw-01.esd189.org. (59) 17:03:45.824898 IP 10.2.4.5.51629 > 10.2.4.51.53: 63582+ A? test-fw-01.esd189.org.esd189.org. (70) 17:03:45.825252 IP 10.2.4.51.53 > 10.2.4.5.51629: 63582 NXDomain* 0/1/0 (137) 17:03:45.825423 IP 10.2.4.5.51629 > 10.2.4.51.53: 12711+ AAAA? test-fw-01.esd189.org.esd189.org. (70) 17:03:45.825669 IP 10.2.4.51.53 > 10.2.4.5.51629: 12711 NXDomain* 0/1/0 (137) 17:03:45.825874 IP 10.2.4.5.56246 > 10.2.4.51.53: 64150+ A? test-fw-01.esd189.org.nwesd.org. (69) 17:03:45.826062 IP 10.2.4.51.53 > 10.2.4.5.56246: 64150 NXDomain* 0/1/0 (139) 17:03:45.826177 IP 10.2.4.5.56246 > 10.2.4.51.53: 21391+ AAAA? test-fw-01.esd189.org.nwesd.org. (69) 17:03:45.826302 IP 10.2.4.51.53 > 10.2.4.5.56246: 21391 NXDomain* 0/1/0 (139) 17:03:49.621048 IP 10.2.4.51.53 > 10.2.4.5.33824: 23711 ServFail 0/0/0 (59)
挖掘testing服务器的输出。
# dig -t aaaa @10.2.4.51 test-fw-01.example.org. ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> -t aaaa @10.2.4.51 test-fw-01.example.org. ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33798 ;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;test-fw-01.example.org. IN AAAA ;; ANSWER SECTION: test-fw-01.example.org. 0 IN AAAA 2607:fa78:1051:2001::1:26 ;; Query time: 1 msec ;; SERVER: 10.2.4.51#53(10.2.4.51) ;; WHEN: Mon Sep 30 17:01:41 2013 ;; MSG SIZE rcvd: 87
我将有大约70个主机使用这个IPv6 VPN。 我只想把AddressFamily any放在我的ssh_config的Host *部分,然后build立连接。 我不想在我的SSHconfiguration中明确列出所有的IPv6主机。 将没有一致的命名模式,所以我不能做一些像Host *.ipv6 。 我不想input-6来通过IPv6连接。 我错过了什么明显的? 有什么办法让OpenSSH连接使用IPv6地址,因为它是可用的?
我看到SERVFAIL响应和DNS查询不一致地给出了NXDOMAIN的答案。 我build议你修复你的DNS。 这可能与SSH无关。