和之前的版本不太一样, Ubuntu 18.04 的 ip地址设置是用netplan管理的 配置文件在: /etc/netplan/50-cloud-init.yaml 示例文件如下: # This file is generated from information provided by # the datasource. Changes to it will not persist across an instance. # To disable cloud-init's network
首先要创建一个脚本 vi 1.sh 脚本语言开始: # !/bin/bash touch /ip.txt echo "Please put in the ip ranges: " cat>ip.txt read -p "Please put in the network name: " WW CC=-1 while read ips; do a1=`echo $ips|awk -F'/'+ '{ print $2 }'` a2=`echo $ips|awk