Skip to content

Instantly share code, notes, and snippets.

@louchenyao
Created January 10, 2020 12:28
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 louchenyao/04225aae2ca881f14e46c511c997a5c0 to your computer and use it in GitHub Desktop.
Save louchenyao/04225aae2ca881f14e46c511c997a5c0 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python3
import sys
# if the dns server of the wireguard are showed in the resolve.conf, then we skim off other servers to make sure the wireguard has the highest priority.
with open("/etc/resolv.conf") as f:
old_resolv = f.read()
if "10.56.100.1" in old_resolv:
with open("/etc/resolv.conf", "w") as f:
f.write("# generated by /etc/NetworkManager/dispatcher.d/refresh_dns.py\nnameserver 10.56.100.1\n")
#! /bin/bash
python3 /etc/NetworkManager/dispatcher.d/refresh_dns.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment