Created
January 10, 2020 12:28
-
-
Save louchenyao/04225aae2ca881f14e46c511c997a5c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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