AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 542821
Accepted
Zoredache
Zoredache
Asked: 2013-10-01 16:25:54 +0800 CST2013-10-01 16:25:54 +0800 CST 2013-10-01 16:25:54 +0800 CST

OpenSSH 不连接到 IPv6 主机,除非“AddressFamily inet6”

  • 772

我有一个 OpenSSH 客户端和服务器。两者都在带有 OpenSSH 6.0 的 Debian 7 上运行。我在两台机器之间建立了 VPN,并且 VPN 具有功能性 IPv6。它没有任何 IPv4。

AddressFamily inet6令人沮丧的问题是,如果我在 ssh_config 中设置了选项,我只能使用 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)

挖掘测试服务器的输出。

# 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放在我的Host *部分中ssh_config,然后建立我的连接。我不想在我的 SSH 配置中明确列出我的所有 IPv6 主机。不会有一致的命名模式,所以我不能做类似Host *.ipv6. 我不想输入-6通过 IPv6 连接。我错过了一些明显的东西吗?我必须做什么才能让 OpenSSH 连接使用 IPv6 地址,因为它可用?

ssh
  • 1 1 个回答
  • 4669 Views

1 个回答

  • Voted
  1. Best Answer
    Sander Steffann
    2013-10-03T12:09:50+08:002013-10-03T12:09:50+08:00

    我看到 SERVFAIL 响应和 DNS 查询不一致地给出 NXDOMAIN 答案。我建议你修复你的DNS。这可能与 SSH 无关。

    • 2

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve