Update update-dns.sh
This commit is contained in:
@@ -23,6 +23,8 @@ else
|
|||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
chmod 0600 ${netfile}
|
||||||
|
|
||||||
read -e -p "Do you wish to continue changing the DNS? (Y/n) " choice
|
read -e -p "Do you wish to continue changing the DNS? (Y/n) " choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
[Nn])
|
[Nn])
|
||||||
@@ -31,17 +33,19 @@ case "$choice" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
* ) if [ -f /etc/netplan/eth0.yaml ] || [ -f /etc/netplan/network.yaml ]; then
|
* ) if [ -f /etc/netplan/eth0.yaml ] || [ -f /etc/netplan/network.yaml ]; then
|
||||||
if [ "${1}" = "offsite" ]; then
|
# if [ "${1}" = "offsite" ]; then
|
||||||
sed -i 's/10.2.1.2,10.10.10.5/10.2.1.6,10.2.1.5/g' ${netfile}
|
sed -i 's/10.2.1.2,10.10.10.5/10.2.1.6,10.2.1.5/g' ${netfile}
|
||||||
else
|
sed -i 's/127.0.0.1,10.10.10.5/127.0.0.1,10.2.1.6g' ${netfile}
|
||||||
|
# else
|
||||||
sed -i 's/10.10.10.5,10.2.1.2/10.10.10.11,10.10.10.10/g' ${netfile}
|
sed -i 's/10.10.10.5,10.2.1.2/10.10.10.11,10.10.10.10/g' ${netfile}
|
||||||
fi
|
sed -i 's/127.0.0.1,10.10.10.10,10.2.1.2/127.0.0.1,10.10.10.10/g' ${netfile}
|
||||||
|
sed -i 's/127.0.0.1,10.10.10.11,10.2.1.2/127.0.0.1,10.10.10.11/g' ${netfile}
|
||||||
|
# fi
|
||||||
|
|
||||||
/usr/sbin/netplan apply
|
/usr/sbin/netplan apply
|
||||||
|
|
||||||
cat ${netfile}
|
|
||||||
else
|
else
|
||||||
if [ "${1}" = "offsite" ]; then
|
# if [ "${1}" = "offsite" ]; then
|
||||||
sed -i 's/10.2.1.2 10.10.10.5/10.2.1.6 10.2.1.5/g' ${netfile}
|
sed -i 's/10.2.1.2 10.10.10.5/10.2.1.6 10.2.1.5/g' ${netfile}
|
||||||
else
|
else
|
||||||
sed -i 's/10.10.10.5 10.2.1.2/10.10.10.11 10.10.10.10/g' ${netfile}
|
sed -i 's/10.10.10.5 10.2.1.2/10.10.10.11 10.10.10.10/g' ${netfile}
|
||||||
@@ -49,8 +53,10 @@ case "$choice" in
|
|||||||
|
|
||||||
/usr/sbin/service networking restart
|
/usr/sbin/service networking restart
|
||||||
|
|
||||||
cat ${netfile}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cat ${netfile}
|
||||||
|
|
||||||
echo -e "${Green}The DNS servers have been updated${Color_Off}"
|
echo -e "${Green}The DNS servers have been updated${Color_Off}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user