From 7cec1ff8b89cdb80e9a4ac1bd0ebfca0e9da01ac Mon Sep 17 00:00:00 2001 From: Shuwei Hao Date: Wed, 29 May 2019 19:52:07 +0800 Subject: [PATCH] add custom DNS support and avoid overwriting --- ack-centos.json | 3 ++- scripts/updateDNS.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 scripts/updateDNS.sh diff --git a/ack-centos.json b/ack-centos.json index 49823e7..e1e9eb3 100644 --- a/ack-centos.json +++ b/ack-centos.json @@ -28,9 +28,10 @@ "scripts/reboot.sh", "scripts/cleanUpKerneles.sh", "config/default.sh", + "scripts/updateDNS.sh", "scripts/verify.sh" ], "expect_disconnect": true } ] -} \ No newline at end of file +} diff --git a/scripts/updateDNS.sh b/scripts/updateDNS.sh new file mode 100755 index 0000000..4d17825 --- /dev/null +++ b/scripts/updateDNS.sh @@ -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