@@ -76,7 +76,7 @@ append_gce_repo() {
7676cp /etc/pacman.conf " $work_dir "
7777append_gce_repo " $work_dir /pacman.conf"
7878pacstrap -G -M -C " $work_dir /pacman.conf" -- " $mount_dir " \
79- base linux dosfstools e2fsprogs dhclient openssh sudo google-compute-engine
79+ base linux dosfstools e2fsprogs openssh sudo google-compute-engine
8080append_gce_repo " $mount_dir /etc/pacman.conf"
8181
8282echo ' - Configuring fstab.'
@@ -113,6 +113,22 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
113113 locale-gen
114114 echo 'LANG=en_US.UTF-8' > /etc/locale.conf
115115
116+ echo '-- Configuring network.'
117+ cat <<-'EOF' > /etc/systemd/network/05-eth0.network
118+ [Match]
119+ Name=eth0
120+
121+ [Network]
122+ DHCP=yes
123+
124+ [DHCPv4]
125+ UseDomains=yes
126+
127+ [DHCPv6]
128+ UseDomains=yes
129+ EOF
130+ systemctl --quiet enable systemd-networkd.service systemd-resolved.service
131+
116132 echo '-- Configuring journald.'
117133 gawk -i assert -i inplace '
118134 /^#ForwardToConsole=/ { $0 = "ForwardToConsole=yes"; ++f }
@@ -159,9 +175,6 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
159175 Before=systemd-growfs@-.service
160176 EOF
161177
162- echo '-- Enabling other services.'
163- systemctl --quiet enable dhclient@eth0.service
164-
165178 echo '-- Configuring initcpio.'
166179 gawk -i assert -i inplace '
167180 /^MODULES=/ { $0 = "MODULES=(virtio_pci virtio_scsi sd_mod ext4)"; ++f1 }
0 commit comments