Skip to content

Instantly share code, notes, and snippets.

@notsobad
Created April 12, 2022 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notsobad/aa252de8d23cae9f265d743f1d041be0 to your computer and use it in GitHub Desktop.
Save notsobad/aa252de8d23cae9f265d743f1d041be0 to your computer and use it in GitHub Desktop.
Use dns-reverse-proxy to route dns request to different server by domain name.
#!/bin/bash
# Get dns-reverse-proxy from https://github.com/notsobad/dns-reverse-proxy
pushd /xxx/dns-reverse-proxy
LAN_DNS=`systemd-resolve --status | grep 'DNS Servers'|cut -d ':' -f2|xargs`:53
echo "lan dns": $LAN_DNS
sudo ./dns-reverse-proxy\
-address 0.0.0.0:53 \
-default 114.114.114.114:53 \
-route .baidu.com=https://dns.alidns.com \
-route .aliyundrive.com=https://dns.alidns.com \
-route .notsobad.com.=$LAN_DNS\
-route .test.com.=$LAN_DNS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment