diff options
author | David Runge <dvzrv@archlinux.org> | 2023-04-04 20:04:38 +0200 |
---|---|---|
committer | David Runge <dvzrv@archlinux.org> | 2023-04-04 20:04:38 +0200 |
commit | 51bdcb28815a2652f5ba209e2c49ba7efe53e1e6 (patch) | |
tree | c4abc01d1faadda611f56422bab271e83da7e800 | |
parent | b5ca914fa4a169eb0a96df8d1427c5205c405536 (diff) |
Use DHCP for all ethernet interfaces
Change the interface match of systemd-networkd from `eth0` to `eth*` to
match all local ethernet interfaces.
This is particularly useful for Vagrant, as it requires two interfaces
(one solely used for managing the machine, another e.g. for outbound
connections) and for machines in general, as depending on their context
(e.g. plain libvirt) the user may attach more interfaces and having DHCP
available for them out-of-the-box is a quality of life improvement (as
we do not know what the user intends to do with eth0 by default).
-rw-r--r-- | images/basic.sh | 2 | ||||
-rw-r--r-- | images/common.sh | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/images/basic.sh b/images/basic.sh index 48dc8e6..eff90ad 100644 --- a/images/basic.sh +++ b/images/basic.sh @@ -14,7 +14,7 @@ function pre() { cat <<EOF >"${MOUNT}/etc/systemd/network/80-dhcp.network" [Match] -Name=eth0 +Name=eth* [Network] DHCP=ipv4 diff --git a/images/common.sh b/images/common.sh index 5f4d10f..78b9954 100644 --- a/images/common.sh +++ b/images/common.sh @@ -14,9 +14,9 @@ EOF chmod 440 "${MOUNT}/etc/sudoers.d/${NEWUSER}" # setup network - cat <<EOF >"${MOUNT}/etc/systemd/network/eth0.network" + cat <<EOF >"${MOUNT}/etc/systemd/network/80-dhcp.network" [Match] -Name=eth0 +Name=eth* [Network] DHCP=ipv4 |