Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active April 30, 2025 00:46
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
@sergeevabc
Copy link

sergeevabc commented Apr 30, 2025

Curl compiled with C-ares is here.

$ ver && echo; && curl --version
Microsoft Windows [Version 6.1.7601]

curl 8.13.0 (x86_64-w64-mingw32) libcurl/8.13.0 OpenSSL/3.4.1 brotli/1.1.0 zstd/1.5.7 c-ares/1.34.4 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.65.0 nghttp3/1.8.0
Release-Date: 2025-04-02
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Largefile NTLM PSL SSL SSLS-EXPORT threadsafe TLS-SRP TrackMemory UnixSockets zstd

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