浏览代码

update to file
modified: Static.sh
modified: dhcp.sh

chagood 2 年之前
父节点
当前提交
fd02f73646
共有 2 个文件被更改,包括 7 次插入8 次删除
  1. 6 7
      Static.sh
  2. 1 1
      dhcp.sh

+ 6 - 7
Static.sh

@@ -4,8 +4,6 @@ set -e
 
 # Write Netplan
 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
 read -p "Enter the static IP of the server in CIDR notation: " staticip 
 read -p "Enter the IP of your gateway: " gatewayip
@@ -15,19 +13,20 @@ read -p "Enter the name of the seach domain: " domain
 echo
 cat > /etc/netplan/01-netcfg.yaml <<EOF
 network:
-  version: 2
-  renderer: networkd
   ethernets:
-    ens160
+    enp3s0:
       addresses:
-        - $staticip
-      gateway4: $gatewayip
+      - $staticip
+      routes:
+        - to: default
+          via: $gatewayip
       nameservers:
         addresses:
         - $DNS1
         - $DNS2
         search:
         - $domain
+  version: 2
 EOF
 sudo netplan apply
 echo "==========================="

+ 1 - 1
dhcp.sh

@@ -10,7 +10,7 @@ cat > /etc/netplan/01-netcfg.yaml <<EOF
 network:
   version: 2
   ethernets:
-    ens160:
+    enp3s0:
       dhcp4: yes
       dhcp-identifier: mac
 EOF