mr-karan / doggo

:dog: Command-line DNS Client for Humans. Written in Golang
https://doggo.mrkaran.dev/
GNU General Public License v3.0
2.83k stars 100 forks source link

IPv6 server queried when using -4 #130

Open wsw70 opened 2 months ago

wsw70 commented 2 months ago

I was under the impression that doggo -4 mrkaran.dev would query A records and also use a IPv4 server.

PS C:\Users\a> doggo -4 mrkaran.dev
time="2024-07-02T12:00:43+02:00" level=error msg="error looking up DNS records" error="dial udp4: address ::1: no suitable address found"
NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
mrkaran.dev.    A       IN      300s    172.67.187.239  10.24.130.10:53
mrkaran.dev.    A       IN      300s    104.21.7.168    10.24.130.10:53
mrkaran.dev.    A       IN      300s    172.67.187.239  10.24.131.10:53
mrkaran.dev.    A       IN      300s    104.21.7.168    10.24.131.10:53

What does the error message mean? It looks like doggo is expecting an IPv6 server (?)

mr-karan commented 2 months ago

doggo is expecting an IPv6 server

It's reading the nameserver specified in /etc/resolv.conf and that seems to be advertising on IPv6 going by the logs udp4: address ::1: no suitable address found.

So you'll either need to specify an IPv4 nameserver address or change your system default.

For eg, on my Adguard DNS server on IPv4 this works as expected:

doggo -4 mrkaran.dev
NAME            TYPE    CLASS   TTL ADDRESS         NAMESERVER    
mrkaran.dev.    A       IN      42s 104.21.7.168    127.0.0.53:53   
mrkaran.dev.    A       IN      42s 172.67.187.239  127.0.0.53:53   
daenney commented 2 months ago

Would it be feasible for it to ignore v6 servers when -4 is passed? And do the same for v4 servers when -6 is passed?

A resolv.conf might have multiple nameserver lines (up to 3 typically), and they don't all have to be v4 or v6.

wsw70 commented 2 months ago

It's reading the nameserver specified in /etc/resolv.conf

I should have mentioned that this is Windows 11. There are no IPv6 nameservers:

   DNS Servers . . . . . . . . . . . : 10.24.130.10
                                       10.24.131.10