How to query a nameserver running on a non-standard port number? #877
Replies: 6 comments
-
You can use the "port" attribute of the resolver to set the port for all nameservers, or the nameserver_ports dictionary to specify a port for a particular nameserver. See https://dnspython.readthedocs.io/en/latest/resolver-class.html for more |
Beta Was this translation helpful? Give feedback.
-
Excellent, this resolve my issue, thanks @rthalley ! A code example, for my reference:
|
Beta Was this translation helpful? Give feedback.
-
A non-default What if anything am I doing wrong here? (Script + session at gist below.) Am I possibly running https://gist.githubusercontent.com/johnnyutahh/b9b651bce677a3769fe1583efccefa11/raw |
Beta Was this translation helpful? Give feedback.
-
This seems to be a dnsmasq thing. Dnspython is doing the right thing. I tried to do what you are doing, both with dnspython and dig, and it did not work with dnsmasq when run as you run it. However, if I ran dnsmasq in debugging mode ("-d") or I told it to switch to user root instead of nobody with "-u root" then it worked. My config file was in /root. My guess is that in daemon mode dnsmasq is chrooting to the specified user's home directory, and thus unable to find the hosts file when run as you were running it. |
Beta Was this translation helpful? Give feedback.
-
Big thanks (again) @rthalley -- your note enabled me to focus on dnsmasq debugging and provided helpful tips on how to do so. I have my script working now, and it was indeed a dnsmasq-configuration correction that solved it. dnspython worked perfectly. For reference: the things (I think) I discovered needed changing/adding to make dnsmasq work beyond the config I shared in the gist above:
Thanks again for your super-timely and helpful support! |
Beta Was this translation helpful? Give feedback.
-
fyi. Here's an updated script + session showing all the fixes, details, etc: https://gist.githubusercontent.com/johnnyutahh/4d64d2d5927a6f0569c64a345a3f3e78/raw/ |
Beta Was this translation helpful? Give feedback.
-
Does
dnspython
support something like the 4th line in the code snippet below? (To be clear: I doubt anameservers_port
member/field exists inResolver()
... and I did a tiny bit of searching in the docs, gave up quickly/lazily, and am posting my follow-on question here.)Beta Was this translation helpful? Give feedback.
All reactions