Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active December 23, 2024 19:58
Show Gist options
  • Save CMCDragonkai/48b0ec28c5325b1d815f to your computer and use it in GitHub Desktop.
Save CMCDragonkai/48b0ec28c5325b1d815f to your computer and use it in GitHub Desktop.
cURL: Selecting a custom DNS server to resolve domain names
#!/usr/bin/env bash
# this can be useful when developing against a custom DNS server, or
# for example, if you made a change to the DNS settings of a domain, and you
# know the authoritative nameserver IP address for a domain, you could use this
# to bypass the intermediate DNS cache, and apply an HTTP request using the new
# DNS settings supplied by your specified (authoritative) nameserver
curl --dns-servers <DNSIP,DNSIP> url.com
# acquire the authoritative nameserver IP using
dig url.com NS
# then ping the NS to get its IP address
# you can also directly resolve
curl \
--resolve www.example.com:443:198.14.3.5 \
https://www.example.com \
--verbose
@jmo-staked
Copy link

jmo-staked commented Dec 23, 2024

@hisashiyamaguchi

I have the same issue - any ideas would be appreciated.

brew install curl-openssl

still no joy

$ brew install curl-openssl 

$ /opt/homebrew/opt/curl/bin/curl --version                                                                                                                       
curl 8.11.1 (aarch64-apple-darwin24.1.0) libcurl/8.11.1 OpenSSL/3.4.0 (SecureTransport) zlib/1.2.12 brotli/1.1.0 zstd/1.5.6 AppleIDN libssh2/1.11.1 nghttp2/1.64.0 librtmp/2.3
Release-Date: 2024-12-11
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

$ /opt/homebrew/opt/curl/bin/curl --dns-servers 8.8.8.8   
curl: option --dns-servers: the installed libcurl version does not support this

maybe curl-openssl is not using it's own libcurl lib it installed to /opt/homebrew/opt/curl/lib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment