#!/bin/sh


# 删除原有配置文件
rm -rf /etc/netplan/0"$(($1-1))"-installer-config.yaml

# 配置对应的网卡文件
echo """network:
  ethernets:
    enp$1s0:
      dhcp4: false
      dhcp6: false
      addresses:
        - $2/24
      nameservers:
        addresses:
          - 114.114.114.114
          - 8.8.8.8
      routes:
          - to: default
            via: $3
            metric: $(($1-1))
      optional: true
  version: 2
""" > /etc/netplan/0"$(($1-1))"-installer-config.yaml
