Score:0

DNS fails for IPv6 (macos)

lb flag

I am trying to assign IPv6 addresses to loopback lo0 and access them through curl / browser with custom domain.

I've created ULA on lo0:

ifconfig lo0 inet6 fd56:dd46:5a5d:f2b5:3a51:916d:40ee:1b4a/128

and I have a tcp6 server listening on that IP.

I've created an AAAA RR that points echo to fd56:dd46:5a5d:f2b5:3a51:916d:40ee:1b4a.

It works properly with dig:

~: dig AAAA @127.100.0.16 echo

; <<>> DiG 9.10.6 <<>> AAAA @127.100.0.16 echo
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23372
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;echo.              IN  AAAA

;; ANSWER SECTION:
echo.           0   IN  AAAA    fd56:dd46:5a5d:f2b5:6065:7375:9039:7092

;; Query time: 0 msec
;; SERVER: 127.100.0.16#53(127.100.0.16)
;; WHEN: Thu Feb 09 18:40:03 CET 2023
;; MSG SIZE  rcvd: 54

~: dig A @127.100.0.16 echo

; <<>> DiG 9.10.6 <<>> A @127.100.0.16 echo
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42356
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;echo.              IN  A

;; Query time: 0 msec
;; SERVER: 127.100.0.16#53(127.100.0.16)
;; WHEN: Thu Feb 09 18:40:10 CET 2023
;; MSG SIZE  rcvd: 22

The service works, when I directly call it:

~: curl http://\[fd56:dd46:5a5d:f2b5:6065:7375:9039:7092\]:8080
{
  "path": "/",
  "headers": {
    "host": "[fd56:dd46:5a5d:f2b5:6065:7375:9039:7092]:8080",
    "user-agent": "curl/7.77.0",
    "accept": "*/*"
  },
  "method": "GET",
  "body": "",
  "fresh": false,
  "hostname": "[fd56:dd46:5a5d:f2b5:6065:7375:9039:7092]",
  "ip": "::ffff:172.18.0.3",
  "ips": [],
  "protocol": "http",
  "query": {},
  "subdomains": [],
  "xhr": false,
  "os": {
    "hostname": "e7362b9fe2a9"
  },
  "connection": {}
}

So I set my DNS preference to 127.100.0.16 (IP on which I run https://github.com/miekg/dns):

~: scutil --dns
DNS configuration

resolver #1
  search domain[0] : home
  nameserver[0] : 127.100.0.16
  flags    : Request A records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)
...

DNS configuration (for scoped queries)

resolver #1
  search domain[0] : home
  nameserver[0] : 127.100.0.16
  if_index : 18 (en5)
  flags    : Scoped, Request A records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

Although, resolving echo domain does not work:

~: curl http://echo:8080
curl: (6) Could not resolve host: echo

From server's perspective I see that only request for A records is sent. There are no requests for AAAA record.


If I set /etc/hosts with:

fd56:dd46:5a5d:f2b5:3a51:916d:40ee:1b4a echo

then echo domain works.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.