mirror of
https://github.com/terem42/zfs-hetzner-vm.git
synced 2025-12-22 14:58:32 +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')
|
||||
|
||||
mkdir -p /mnt/etc/network/
|
||||
cat <<CONF > /mnt/etc/systemd/network/10-eth0.network
|
||||
[Match]
|
||||
Name=eth0
|
||||
|
||||
cat > "/mnt/etc/network/interfaces" <<CONF
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
iface lo inet6 loopback
|
||||
|
||||
auto ens3
|
||||
iface ens3 inet dhcp
|
||||
|
||||
iface ens3 inet6 static
|
||||
address ${ip6addr_prefix}:1/64
|
||||
gateway fe80::1
|
||||
[Network]
|
||||
DHCP=ipv4
|
||||
Address=${ip6addr_prefix}:1/64
|
||||
Gateway=fe80::1
|
||||
CONF
|
||||
chroot_execute "systemctl enable systemd-networkd.service"
|
||||
|
||||
|
||||
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 "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/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')
|
||||
|
||||
cat > "$c_zfs_mount_dir/etc/netplan/01-netcfg.yaml" <<CONF
|
||||
network:
|
||||
version: 2
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
ens3:
|
||||
dhcp4: yes
|
||||
dhcp6: no
|
||||
addresses:
|
||||
- ${ip6addr_prefix}:1/64
|
||||
gateway6: fe80::1
|
||||
cat <<CONF > /mnt/etc/systemd/network/10-eth0.network
|
||||
[Match]
|
||||
Name=eth0
|
||||
|
||||
[Network]
|
||||
DHCP=ipv4
|
||||
Address=${ip6addr_prefix}:1/64
|
||||
Gateway=fe80::1
|
||||
CONF
|
||||
|
||||
chroot_execute "systemctl enable systemd-networkd.service"
|
||||
|
||||
|
||||
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
|
||||
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 "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/splash//g' /etc/default/grub"
|
||||
|
||||
Reference in New Issue
Block a user