add custom DNS support and avoid overwriting

This commit is contained in:
Shuwei Hao
2019-05-29 19:52:07 +08:00
parent 0b61a09d71
commit 7cec1ff8b8
2 changed files with 12 additions and 1 deletions

10
scripts/updateDNS.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
# unlock DNS file in case it was locked
# chattr -i /etc/resolv.conf
# Using your custom nameserver to replace xxx.xxx.xxx.xxx
# echo "nameserver xxx.xxx.xxx.xxx\nnameserver xxx.xxx.xxx.xxx" > /etc/resolv.conf
# Keep resolv locked to prevent overwriting by cloudinit/NetworkManager
# chattr +i /etc/resolv.conf