如何將 wget 與 IPV6 結合使用

如何將 wget 與 IPV6 結合使用

我使用以下命令(和輸出)收到了 IPv6 位址:

$ dig +short +answer aaaa deb.debian.org
debian.map.fastlydns.net.
2a04:4e42:65::644

現在,當我嘗試執行以下命令時:

wget -6 https://2a04:4e42:65::644

我收到以下錯誤:

https://2a04:4e42:65::644: Bad port number.

我的 wget 版本資訊:

GNU Wget 1.21 built on linux-gnu.

這個版本的 wget (debian 11) 與 IPv6 不相容嗎?

答案1

您應該“轉義”地址,例如wget -6 https://[2a04:4e42:65::644]

您可能還需要添加,--no-check-certificate因為 SSL 憑證是針對網域名稱而不是 IP 位址頒發的。

最後,您可能仍然會收到錯誤或預設 Web 伺服器頁面,因為大多數網站都設定為僅在Host:正確指定欄位時才提供資料。

相關內容