Closed wd closed 4 years ago
fastest_v4 = false
It's working after I set this option to false
. I think maybe the author could consider to avoid this problem even the options is set to true
. When the results is just a CNAME
, simply give it to the client, and the client will request A
record for the CNAME
again. Or maybe just return the fasted ipv4
address along with the CNAME
record, it could be more faster.
Add more informations about why I report this issue. If dns server didn't answer CNAME
record like it does in my first post, client will report errors, so it's very import to return CNAME
.
$ curl http://www.baidu.com
curl: (6) Could not resolve host: www.baidu.com
[groups]
[groups.baidu]
dns = ["114.114.114.114"]
fastest_v4 = true
rules = ["baidu.com"]
$ dig baidu.com
...
;; ANSWER SECTION:
baidu.com. 501 IN A 220.181.38.148
;; Query time: 142 msec
...
$
$ curl http://www.baidu.com -I
HTTP/1.1 200 OK
Accept-Ranges: bytes
...
time="2020-05-18T15:24:19+08:00" level=info msg="match by rules" domain=baidu.com. group=baidu src=127.0.0.1 type=A
typically, upstream dns servers (like 114.114.114.114
) will recursive resolve CNAME
record automatically, local client (include ts-dns
) not need CNAME
record(at least in my use cases).
You use baidu.com
in your example, would you mind to check dig www.baidu.com
? As I understand, local dns should return a CNAME
record for www.baidu.com
, which is www.a.shifen.com
, and a A
record for www.a.shifen.com
, which is 220.181.38.149
, that's should be the correct results, not only return A
record for www.a.shifen.com
.
This is the result when I use your configs.
$ dig www.baidu.com
; <<>> DiG 9.10.6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24854
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.a.shifen.com. 60 IN A 220.181.38.149
;; Query time: 141 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon May 18 17:03:30 CST 2020
;; MSG SIZE rcvd: 74
$ curl http://www.baidu.com -I
curl: (6) Could not resolve host: www.baidu.com
➜ ~ dig www.baidu.com
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36387
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.a.shifen.com. 242 IN A 220.181.38.149
;; Query time: 128 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon May 18 17:49:41 CST 2020
;; MSG SIZE rcvd: 74
➜ ~ curl http://www.baidu.com -v 2>&1 | grep Connected
* Connected to www.baidu.com (220.181.38.149) port 80 (#0)
time="2020-05-18T17:49:40+08:00" level=info msg="match by rules" domain=www.baidu.com. group=baidu src=127.0.0.1 type=A
time="2020-05-18T17:49:43+08:00" level=info msg="hit cache" domain=www.baidu.com. src=127.0.0.1 type=A
Oh, that's weird, I use MacOS, not only the curl
command is not working, chrome and safari are not working also. Do you have some suggest about how I can debug this issue?
I have tried on an ubuntu virtual machine run on my laptop, and set the dns to the same dns, the curl works perfectly. I think this is a OSX related issue only.
v0.14.1 released: keep Non-A
records (like CNAME
) after enable fastest_v4
Confirmed, the issue has gone. Thanks.
$ dig www.baidu.com
; <<>> DiG 9.10.6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54348
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 133 IN CNAME www.a.shifen.com.
www.a.shifen.com. 133 IN A 220.181.38.150
;; Query time: 54 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue May 19 12:55:11 CST 2020
;; MSG SIZE rcvd: 117
wd @ ~ ❯❯❯ curl www.baidu.com
<!DOCTYPE html>
...
ubuntu user, got same issue after upgrade chrome version to v83, also fixed use ts-dns v0.14.1.
I'm a new user for
ts-dns
, it's really a useful tool, but I meet a problem.Request results from
114.114.114.114
, you can see there is anCNAME
record.Results from
ts-dns
, the CNAME record lost.Here is my config, are there something wrong with my config? version 0.14.0 on MACOS.