Vultr内网设置脚本(适用Ubuntu 18.04)

#!/bin/sh

if [ x"$1" = x"" ]; then
    echo "Usage: $0 private_ip/subnet"
    exit -1
fi

IP="$1"
SUBNET="16"

if [ x"$2" != x"" ]; then
    SUBNET="$2"
fi

sudo cat <<EOF > /etc/netplan/10-ens7.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens7:
      mtu: 1450
      dhcp4: no
      addresses: [$IP/$SUBNET]
EOF

sudo netplan apply

 

Leave a Reply

Your email address will not be published. Required fields are marked *