我在 Windows 10 中執行 WSL2、Ubuntu 22 nslookup
。
daniel@DESKTOP-6M0RKK1:~
⤷ nslookup google.com
Server: 172.23.144.1
Address: 172.23.144.1#53
Non-authoritative answer:
Name: google.com
Address: 142.251.116.139
Name: google.com
Address: 142.251.116.102
Name: google.com
Address: 142.251.116.100
Name: google.com
Address: 142.251.116.113
Name: google.com
Address: 142.251.116.101
Name: google.com
Address: 142.251.116.138
但是,當我連接到 VPN 時,答案會發生變化,也顯示某些 DNS 伺服器的 IP 位址的答案。
daniel@DESKTOP-6M0RKK1:~
⤷ nslookup google.com
Server: 172.23.144.1
Address: 172.23.144.1#53
Non-authoritative answer:
Name: google.com
Address: 142.251.135.110
Name: ns1.google.com
Address: 216.239.32.10
Name: ns2.google.com
Address: 216.239.34.10
Name: ns3.google.com
Address: 216.239.36.10
Name: ns4.google.com
Address: 216.239.38.10
我顯示的範例是google.com
,但我嘗試尋找的任何 URL 都會發生這種情況。這就是症狀,真正的問題是其他命令(例如curl
)在請求時使用解析清單中的隨機(?)IP,有時請求會轉到第一個IP,成功運行,但有時請求結束是對DNS 伺服器而不是正確的IP 進行的。
現在我不知道在哪裡檢查問題。我不知道問題是否是 WSL、Windows 網路或 VPN 的 DNS 伺服器上的設定錯誤。因此,非常感謝任何形式的幫助。
Ps.:Windows直接解析,連接VPN就可以正常運作。問題僅出現在 WSL 內部。
編輯:新增調試輸出。當尋找使用 WSL 介面閘道作為名稱伺服器時,看起來Authority
記錄Additional
正在合併。Answers
nslookup -debug google.com
WSL2 系統的輸出。
此命令應使用 WSL 閘道作為名稱伺服器,並將請求傳送至 VPN 名稱伺服器。
daniel@DESKTOP-6M0RKK1:~
⤷ nslookup -debug google.com
Server: 172.23.144.1
Address: 172.23.144.1#53
------------
QUESTIONS:
google.com, type = A, class = IN
ANSWERS:
-> google.com
internet address = 142.251.133.174
ttl = 0
-> ns1.google.com
internet address = 216.239.32.10
ttl = 0
-> ns2.google.com
internet address = 216.239.34.10
ttl = 0
-> ns3.google.com
internet address = 216.239.36.10
ttl = 0
-> ns4.google.com
internet address = 216.239.38.10
ttl = 0
AUTHORITY RECORDS:
ADDITIONAL RECORDS:
------------
Non-authoritative answer:
Name: google.com
Address: 142.251.133.174
Name: ns1.google.com
Address: 216.239.32.10
Name: ns2.google.com
Address: 216.239.34.10
Name: ns3.google.com
Address: 216.239.36.10
Name: ns4.google.com
Address: 216.239.38.10
nslookup -debug google.com 10.0.24.151
WSL2 系統的輸出。
此命令應直接使用 VPN 名稱伺服器。
daniel@DESKTOP-6M0RKK1:~
⤷ nslookup -debug google.com 10.0.24.151
Server: 10.0.24.151
Address: 10.0.24.151#53
------------
QUESTIONS:
google.com, type = A, class = IN
ANSWERS:
-> google.com
internet address = 142.251.133.174
ttl = 227
AUTHORITY RECORDS:
-> google.com
nameserver = ns1.google.com.
ttl = 5636
-> google.com
nameserver = ns2.google.com.
ttl = 5636
-> google.com
nameserver = ns4.google.com.
ttl = 5636
-> google.com
nameserver = ns3.google.com.
ttl = 5636
ADDITIONAL RECORDS:
-> ns1.google.com
internet address = 216.239.32.10
ttl = 92272
-> ns2.google.com
internet address = 216.239.34.10
ttl = 92272
-> ns3.google.com
internet address = 216.239.36.10
ttl = 18575
-> ns4.google.com
internet address = 216.239.38.10
ttl = 18575
------------
Non-authoritative answer:
Name: google.com
Address: 142.251.133.174
nslookup -d google.com
從 Windows輸出。
此命令應直接使用 VPN 名稱伺服器。輸出經過編輯,不顯示與我工作的公司相關的名稱。
PS C:\Users\danie> nslookup -d google.com
------------
Got answer:
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: response, auth. answer, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 7, additional = 7
QUESTIONS:
151.24.0.10.in-addr.arpa, type = PTR, class = IN
ANSWERS:
-> 151.24.0.10.in-addr.arpa
name = s2-<redacted>
ttl = 900 (15 mins)
AUTHORITY RECORDS:
-> 10.in-addr.arpa
nameserver = s17-<redacted>
ttl = 900 (15 mins)
-> 10.in-addr.arpa
nameserver = s343-<redacted>
ttl = 900 (15 mins)
-> 10.in-addr.arpa
nameserver = s2-<redacted>
ttl = 900 (15 mins)
-> 10.in-addr.arpa
nameserver = s344-<redacted>
ttl = 900 (15 mins)
-> 10.in-addr.arpa
nameserver = s1-<redacted>
ttl = 900 (15 mins)
-> 10.in-addr.arpa
nameserver = <redacted>
ttl = 900 (15 mins)
-> 10.in-addr.arpa
nameserver = <redacted>
ttl = 900 (15 mins)
ADDITIONAL RECORDS:
-> s1-<redacted>
internet address = 10.0.16.253
ttl = 900 (15 mins)
-> <redacted>
internet address = 10.17.0.4
ttl = 900 (15 mins)
-> s17-<redacted>
internet address = 10.8.74.34
ttl = 900 (15 mins)
-> <redacted>
internet address = 10.58.0.240
ttl = 900 (15 mins)
-> s2-<redacted>
internet address = 10.0.24.151
ttl = 900 (15 mins)
-> s343-<redacted>
internet address = 10.0.29.143
ttl = 900 (15 mins)
-> s344-<redacted>
internet address = 10.0.29.144
ttl = 900 (15 mins)
------------
Server: s2-<redacted>
Address: 10.0.24.151
------------
Got answer:
HEADER:
opcode = QUERY, id = 2, rcode = NXDOMAIN
header flags: response, auth. answer, want recursion, recursion avail.
questions = 1, answers = 0, authority records = 1, additional = 0
QUESTIONS:
google.com.<redated_internal_suffix>, type = A, class = IN
AUTHORITY RECORDS:
-> <redated_internal_suffix>
ttl = 900 (15 mins)
primary name server = s2-<redacted>.<redated_internal_suffix>
responsible mail addr = root.s2-<redacted>
serial = 2023071101
refresh = 86400 (1 day)
retry = 7200 (2 hours)
expire = 2592000 (30 days)
default TTL = 345600 (4 days)
------------
------------
Got answer:
HEADER:
opcode = QUERY, id = 3, rcode = NXDOMAIN
header flags: response, auth. answer, want recursion, recursion avail.
questions = 1, answers = 0, authority records = 1, additional = 0
QUESTIONS:
google.com.<redated_internal_suffix>, type = AAAA, class = IN
AUTHORITY RECORDS:
-> <redated_internal_suffix>
ttl = 900 (15 mins)
primary name server = s2-<redacted>
responsible mail addr = root.s2-<redacted>
serial = 2023071101
refresh = 86400 (1 day)
retry = 7200 (2 hours)
expire = 2592000 (30 days)
default TTL = 345600 (4 days)
------------
------------
Got answer:
HEADER:
opcode = QUERY, id = 4, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 4, additional = 8
QUESTIONS:
google.com, type = A, class = IN
ANSWERS:
-> google.com
internet address = 142.250.79.14
ttl = 23 (23 secs)
AUTHORITY RECORDS:
-> google.com
nameserver = ns2.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
-> google.com
nameserver = ns4.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
-> google.com
nameserver = ns3.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
-> google.com
nameserver = ns1.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
ADDITIONAL RECORDS:
-> ns1.google.com
internet address = 216.239.32.10
ttl = 92711 (1 day 1 hour 45 mins 11 secs)
-> ns2.google.com
internet address = 216.239.34.10
ttl = 92711 (1 day 1 hour 45 mins 11 secs)
-> ns3.google.com
internet address = 216.239.36.10
ttl = 19014 (5 hours 16 mins 54 secs)
-> ns4.google.com
internet address = 216.239.38.10
ttl = 19014 (5 hours 16 mins 54 secs)
-> ns1.google.com
AAAA IPv6 address = 2001:4860:4802:32::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
-> ns2.google.com
AAAA IPv6 address = 2001:4860:4802:34::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
-> ns3.google.com
AAAA IPv6 address = 2001:4860:4802:36::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
-> ns4.google.com
AAAA IPv6 address = 2001:4860:4802:38::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
------------
Non-authoritative answer:
------------
Got answer:
HEADER:
opcode = QUERY, id = 5, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 4, additional = 8
QUESTIONS:
google.com, type = AAAA, class = IN
ANSWERS:
-> google.com
AAAA IPv6 address = 2800:3f0:4004:808::200e
ttl = 41 (41 secs)
AUTHORITY RECORDS:
-> google.com
nameserver = ns1.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
-> google.com
nameserver = ns3.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
-> google.com
nameserver = ns4.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
-> google.com
nameserver = ns2.google.com
ttl = 6075 (1 hour 41 mins 15 secs)
ADDITIONAL RECORDS:
-> ns1.google.com
internet address = 216.239.32.10
ttl = 92711 (1 day 1 hour 45 mins 11 secs)
-> ns2.google.com
internet address = 216.239.34.10
ttl = 92711 (1 day 1 hour 45 mins 11 secs)
-> ns3.google.com
internet address = 216.239.36.10
ttl = 19014 (5 hours 16 mins 54 secs)
-> ns4.google.com
internet address = 216.239.38.10
ttl = 19014 (5 hours 16 mins 54 secs)
-> ns1.google.com
AAAA IPv6 address = 2001:4860:4802:32::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
-> ns2.google.com
AAAA IPv6 address = 2001:4860:4802:34::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
-> ns3.google.com
AAAA IPv6 address = 2001:4860:4802:36::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
-> ns4.google.com
AAAA IPv6 address = 2001:4860:4802:38::a
ttl = 160225 (1 day 20 hours 30 mins 25 secs)
------------
Name: google.com
Addresses: 2800:3f0:4004:808::200e
142.250.79.14
編輯 2:看起來這與為 WSL 建立的內部 DNS 伺服器的問題有關,該伺服器是內部 Hyper-V DNS 伺服器,也是 Windows Internet 連線共用 (ICS)。
我在 WSL 的 GitHub 上發現了一個未解決的問題,很多人都在抱怨這個問題。