mirror of
https://github.com/terem42/zfs-hetzner-vm.git
synced 2025-12-23 07:18:37 +00:00
Merge pull request #2 from digineo/networkd
Use net.ifnames=0 and networkd
This commit is contained in:
@@ -602,20 +602,17 @@ CONF
|
|||||||
|
|
||||||
ip6addr_prefix=$(ip -6 a s | grep -E "inet6.+global" | sed -nE 's/.+inet6\s(([0-9a-z]{1,4}:){4,4}).+/\1/p')
|
ip6addr_prefix=$(ip -6 a s | grep -E "inet6.+global" | sed -nE 's/.+inet6\s(([0-9a-z]{1,4}:){4,4}).+/\1/p')
|
||||||
|
|
||||||
mkdir -p /mnt/etc/network/
|
cat <<CONF > /mnt/etc/systemd/network/10-eth0.network
|
||||||
|
[Match]
|
||||||
|
Name=eth0
|
||||||
|
|
||||||
cat > "/mnt/etc/network/interfaces" <<CONF
|
[Network]
|
||||||
auto lo
|
DHCP=ipv4
|
||||||
iface lo inet loopback
|
Address=${ip6addr_prefix}:1/64
|
||||||
iface lo inet6 loopback
|
Gateway=fe80::1
|
||||||
|
|
||||||
auto ens3
|
|
||||||
iface ens3 inet dhcp
|
|
||||||
|
|
||||||
iface ens3 inet6 static
|
|
||||||
address ${ip6addr_prefix}:1/64
|
|
||||||
gateway fe80::1
|
|
||||||
CONF
|
CONF
|
||||||
|
chroot_execute "systemctl enable systemd-networkd.service"
|
||||||
|
|
||||||
|
|
||||||
cp /etc/resolv.conf $c_zfs_mount_dir/etc/resolv.conf
|
cp /etc/resolv.conf $c_zfs_mount_dir/etc/resolv.conf
|
||||||
|
|
||||||
@@ -749,7 +746,8 @@ chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
|||||||
chroot_execute "grub-install ${v_selected_disks[0]}"
|
chroot_execute "grub-install ${v_selected_disks[0]}"
|
||||||
|
|
||||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||||
|
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||||
|
|
||||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||||
|
|||||||
@@ -567,19 +567,19 @@ CONF
|
|||||||
|
|
||||||
ip6addr_prefix=$(ip -6 a s | grep -E "inet6.+global" | sed -nE 's/.+inet6\s(([0-9a-z]{1,4}:){4,4}).+/\1/p')
|
ip6addr_prefix=$(ip -6 a s | grep -E "inet6.+global" | sed -nE 's/.+inet6\s(([0-9a-z]{1,4}:){4,4}).+/\1/p')
|
||||||
|
|
||||||
cat > "$c_zfs_mount_dir/etc/netplan/01-netcfg.yaml" <<CONF
|
cat <<CONF > /mnt/etc/systemd/network/10-eth0.network
|
||||||
network:
|
[Match]
|
||||||
version: 2
|
Name=eth0
|
||||||
renderer: networkd
|
|
||||||
ethernets:
|
[Network]
|
||||||
ens3:
|
DHCP=ipv4
|
||||||
dhcp4: yes
|
Address=${ip6addr_prefix}:1/64
|
||||||
dhcp6: no
|
Gateway=fe80::1
|
||||||
addresses:
|
|
||||||
- ${ip6addr_prefix}:1/64
|
|
||||||
gateway6: fe80::1
|
|
||||||
CONF
|
CONF
|
||||||
|
|
||||||
|
chroot_execute "systemctl enable systemd-networkd.service"
|
||||||
|
|
||||||
|
|
||||||
mkdir -p "$c_zfs_mount_dir/etc/cloud/cloud.cfg.d/"
|
mkdir -p "$c_zfs_mount_dir/etc/cloud/cloud.cfg.d/"
|
||||||
cat > "$c_zfs_mount_dir/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg" <<CONF
|
cat > "$c_zfs_mount_dir/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg" <<CONF
|
||||||
network:
|
network:
|
||||||
@@ -722,7 +722,8 @@ chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
|||||||
chroot_execute "grub-install ${v_selected_disks[0]}"
|
chroot_execute "grub-install ${v_selected_disks[0]}"
|
||||||
|
|
||||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||||
|
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||||
|
|
||||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||||
|
|||||||
Reference in New Issue
Block a user