Răsfoiți Sursa

new file: DomainJoin/Static.sh

chagood 1 an în urmă
părinte
comite
ae1b91d504
1 a modificat fișierele cu 34 adăugiri și 0 ștergeri
  1. 34 0
      DomainJoin/Static.sh

+ 34 - 0
DomainJoin/Static.sh

@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -e
+
+# Write Netplan
+sudo touch /etc/netplan/01-netcfg.yaml
+# Ask for input on network configuration
+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 DNS Server 1: " DNS1
+read -p "Enter the IP of DNS Server 2: " DNS2
+read -p "Enter the name of the seach domain: " domain
+echo
+cat > /etc/netplan/01-netcfg.yaml <<EOF
+network:
+  ethernets:
+    enp3s0:
+      addresses:
+      - $staticip
+      routes:
+        - to: default
+          via: $gatewayip
+      nameservers:
+        addresses:
+        - $DNS1
+        - $DNS2
+        search:
+        - $domain
+  version: 2
+EOF
+sudo chmod 600 /etc/netplan/01-netcfg.yaml
+sudo netplan apply
+echo "==========================="
+echo