|
@@ -4,8 +4,6 @@ set -e
|
|
|
|
|
|
|
|
# Write Netplan
|
|
# Write Netplan
|
|
|
sudo touch /etc/netplan/01-netcfg.yaml
|
|
sudo touch /etc/netplan/01-netcfg.yaml
|
|
|
-# Changes dhcp from 'yes' to 'no'
|
|
|
|
|
-# sed -i "s/dhcp4: yes/dhcp4: no/g" /etc/netplan/01-netcfg.yaml
|
|
|
|
|
# Ask for input on network configuration
|
|
# Ask for input on network configuration
|
|
|
read -p "Enter the static IP of the server in CIDR notation: " staticip
|
|
read -p "Enter the static IP of the server in CIDR notation: " staticip
|
|
|
read -p "Enter the IP of your gateway: " gatewayip
|
|
read -p "Enter the IP of your gateway: " gatewayip
|
|
@@ -15,19 +13,20 @@ read -p "Enter the name of the seach domain: " domain
|
|
|
echo
|
|
echo
|
|
|
cat > /etc/netplan/01-netcfg.yaml <<EOF
|
|
cat > /etc/netplan/01-netcfg.yaml <<EOF
|
|
|
network:
|
|
network:
|
|
|
- version: 2
|
|
|
|
|
- renderer: networkd
|
|
|
|
|
ethernets:
|
|
ethernets:
|
|
|
- ens160
|
|
|
|
|
|
|
+ enp3s0:
|
|
|
addresses:
|
|
addresses:
|
|
|
- - $staticip
|
|
|
|
|
- gateway4: $gatewayip
|
|
|
|
|
|
|
+ - $staticip
|
|
|
|
|
+ routes:
|
|
|
|
|
+ - to: default
|
|
|
|
|
+ via: $gatewayip
|
|
|
nameservers:
|
|
nameservers:
|
|
|
addresses:
|
|
addresses:
|
|
|
- $DNS1
|
|
- $DNS1
|
|
|
- $DNS2
|
|
- $DNS2
|
|
|
search:
|
|
search:
|
|
|
- $domain
|
|
- $domain
|
|
|
|
|
+ version: 2
|
|
|
EOF
|
|
EOF
|
|
|
sudo netplan apply
|
|
sudo netplan apply
|
|
|
echo "==========================="
|
|
echo "==========================="
|