Add setup ip file

This commit is contained in:
HaiMD 2021-08-20 15:23:16 +07:00
parent a3053c7870
commit 0439744be7

35
monitor/setup/setip.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
echo 'auto lo
iface lo inet interface
auto eth0' > /etc/network/interfaces
echo "Enter the type IPaddress"
read type
echo "iface eth0 inet $type" >> /etc/network/interfaces
if [ "$type" = static ]
then
echo "Enter the IP: "
read ipaddr
echo " address $ipaddr" >> /etc/network/interfaces
echo "Enter the netmask: "
read netmask
echo " netmask $netmask" >> /etc/network/interfaces
echo "Enter the gateway: "
read gateway
echo " gateway $gateway" >> /etc/network/interfaces
echo "Enter the dns-nameservers: "
read dns
echo " dns-nameservers $dns" >> /etc/network/interfaces
else echo "Setup IP success!!!"
fi
while true; do
read -p "Do you wish to reboot device?(y/n)" yn
case $yn in
[Yy]* ) reboot; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
exit 0