Skip to content

Instantly share code, notes, and snippets.

@AlexMunoz905
Last active May 11, 2021 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexMunoz905/3188f4e9383fec682297f6c3e8eaee55 to your computer and use it in GitHub Desktop.
Save AlexMunoz905/3188f4e9383fec682297f6c3e8eaee55 to your computer and use it in GitHub Desktop.
Bash IP Changer
#!/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