This is a little Yad GUI script to do it.
To use:
Add your DNS servers then restart your internet connection.
Requires Yad.
http://www.murga-linux.com/puppy/viewtopic.php?t=58306
Script.
Code: Select all
#!/bin/bash
#stu90
HEAD="/etc/resolv.conf.head"
PDNS="/tmp/pdns"
yad --title="DNS Config" --text=" Add new DNS servers and restart \n your internet connection. " \
--form --field="DNS1" --field="DNS2" > $PDNS
button=$?
case $button in
0)
if [ ! -f "$HEAD" ]; then
touch $HEAD | echo "no $HEAD file created new file"
else
mv $HEAD $HEAD.old | echo "$HEAD already exists backed up to $HEAD.old"
fi
DNS1=$(cut -s -d "|" -f 1 $PDNS)
DNS2=$(cut -s -d "|" -f 2 $PDNS)
echo "# Generated by dhcpcd from wlan0" >> $HEAD
echo "# /etc/resolv.conf.head can replace this line" >> $HEAD
echo "nameserver $DNS1" >> $HEAD
echo "nameserver $DNS2" >> $HEAD
echo "added DNS $DNS1 / $DNS2 to $HEAD restart internet to apply new DNS settings"
;;
1)
exit 0 | echo "cancel"
;;
esac
rm -f $PDNS