OpenSSH not connecting to IPv6 host unless 'AddressFamily inet6'
I have an OpenSSH client and server. Both are running on Debian 7 with OpenSSH 6.0. I have a VPN established between the two machines, and the VPN has functional IPv6. It does not have any IPv4.
The frustrating problem is that I can only connect to the server using IPv6 if I have set the AddressFamily inet6
option in my ssh_config. I really don't want to have to set this option. It sure seems like I should be able to set AddressFamily any
and have my connections work.
My Working connection over IPv6 looks like this.
working 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
Working console output
# 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:~#
working tcpdump for port 53
# 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)
When I use AddressFamily any
or AddressFamily inet
I see this.
broken 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?
broken console output
# 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
tcpdump for port 53 on broken connection
# 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)
Dig output for the test server.
# 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
I will have about 70 hosts using this IPv6 VPN. I want to simply put the AddressFamily any
in the Host *
section of my ssh_config
and then have my connections get established. I don't want to have to explicitly list all my IPv6 hosts in my SSH config. There will be no consistent naming pattern so I can't do something like Host *.ipv6
. I don't want to have to type the -6
to connect via IPv6. Am I missing something obvious? What do I have to do to get OpenSSH to connect use the IPv6 address since it is available?
Solution 1:
I see SERVFAIL responses and DNS queries inconsistently giving NXDOMAIN answers. I suggest you fix your DNS. This might have nothing to do with SSH.