Last active
May 11, 2021 00:09
-
-
Save AlexMunoz905/3188f4e9383fec682297f6c3e8eaee55 to your computer and use it in GitHub Desktop.
Bash IP Changer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Changes the IP to what you specify. | |
# I made this for my ESXi VM templates. | |
echo -n "Set IP to: "; | |
read IP | |
sudo rm -rf /etc/netplan/00-installer-config.yaml | |
sudo echo " | |
# IP changed by ip_changer.sh script! | |
network: | |
ethernets: | |
ens160: | |
dhcp4: false | |
addresses: [$IP/24] | |
gateway4: 192.168.50.1 | |
nameservers: | |
addresses: [192.168.50.17,192.168.50.25] | |
version: 2 | |
" >> IP_temp | |
sudo cp IP_temp /etc/netplan/00-installer-config.yaml | |
rm -rf IP_temp | |
sudo netplan apply | |
echo "Finished!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment