Skip to content

Instantly share code, notes, and snippets.

@Hritik14
Created August 26, 2025 19:34
Show Gist options
  • Save Hritik14/9791513b9715e62b12c511ef89632590 to your computer and use it in GitHub Desktop.
Save Hritik14/9791513b9715e62b12c511ef89632590 to your computer and use it in GitHub Desktop.
Scoped resolver for mac in case your corp vpn is unable to set dns correctly (happens on pritunl on mac)
#!/bin/bash
DOMAIN="corp.net"
CORP_DNS="1.2.3.4"
FILE="/etc/resolver/$DOMAIN"
echo "Setting scoped resolver for $DOMAIN"
mkdir -p /etc/resolver
{ echo "search_order 1" ; echo "nameserver $CORP_DNS"; } >"$FILE"
/usr/bin/dscacheutil -flushcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment