From c11e312724fcab52276ebd1ae8083ea52dcd1f6b Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Thu, 8 Jun 2023 14:03:13 +0900 Subject: [PATCH] Create ipv4_dhcp_ipv6_static_interfaces.cfg --- .../ipv4_dhcp_ipv6_static_interfaces.cfg | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Linux_reinstall/Ubuntu/CloudInit/ipv4_dhcp_ipv6_static_interfaces.cfg diff --git a/Linux_reinstall/Ubuntu/CloudInit/ipv4_dhcp_ipv6_static_interfaces.cfg b/Linux_reinstall/Ubuntu/CloudInit/ipv4_dhcp_ipv6_static_interfaces.cfg new file mode 100644 index 0000000..ca77e0e --- /dev/null +++ b/Linux_reinstall/Ubuntu/CloudInit/ipv4_dhcp_ipv6_static_interfaces.cfg @@ -0,0 +1,60 @@ +# CLOUD_IMG: This file was created/modified by the Cloud Image build process + +# configure repository +system_info: + package_mirrors: + - arches: [i386, amd64] + failsafe: + primary: http://targetLinuxMirror/ubuntu + security: http://security.ubuntu.com/ubuntu + - arches: [armhf, armel, default] + failsafe: + primary: http://targetLinuxMirror/ubuntu-ports + security: http://targetLinuxMirror/ubuntu-ports + +# configure hostname +hostname: HostName + +# timezone +timezone: TimeZone + +# configure root user +users: + - name: root + lock_passwd: false + shell: /bin/bash + +chpasswd: + expire: false + list: | + root:tmpWORD + users: + - name: root + password: tmpWORD + type: text + +# configure network +network: + version: 2 + ethernets: + eth0: + dhcp4: true + dhcp6: false + addresses: [ip6Addr/ip6Mask] + gateway6: ip6Gate + nameservers: + addresses: [ip6DNS1, ip6DNS2] + +# later commands +runcmd: + - sed -ri 's/^#?Port.*/Port sshPORT/g' /etc/ssh/sshd_config + - sed -ri 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config + - sed -ri 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config + - update-rc.d ssh enable + - /etc/init.d/ssh restart + - apt update + - apt install curl dnsutils efibootmgr fail2ban figlet file lrzsz jq lsof lsb-release net-tools python3 subnetcalc telnet traceroute unzip vim wget xz-utils -y + - rm -rf /etc/cloud/cloud.cfg.d/99-fake_cloud.cfg + +# configure cloud-init for NoCloud +datasource_list: [ NoCloud, None ]