diff options
author | Maxim Devaev <[email protected]> | 2022-12-04 03:04:21 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-12-04 03:04:21 +0300 |
commit | 52fdc94eb8f9582084dc39df15e6d614a9a651f2 (patch) | |
tree | 445870f58fa33d5d1cf9560f6d871f54ee0284f1 /scripts/kvmd-bootconfig | |
parent | 248d9cf33f0bb51e498dacc169efcc5ad7d25996 (diff) |
Fixed pikvm/pikvm#882: Ethernet settings in pikvm.txt
Diffstat (limited to 'scripts/kvmd-bootconfig')
-rwxr-xr-x | scripts/kvmd-bootconfig | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/kvmd-bootconfig b/scripts/kvmd-bootconfig index 5b968dee..8f0c7370 100755 --- a/scripts/kvmd-bootconfig +++ b/scripts/kvmd-bootconfig @@ -118,6 +118,45 @@ if [ -n "$SSH_PORT" ]; then fi +# ========== Ethernet ========== + +# If the ETH_DHCP is defined, configure eth0 for DHCP +if [ -n "$ETH_DHCP" ]; then + ETH_IFACE="${ETH_IFACE:-eth0}" + cat <<end_of_file > "/etc/systemd/network/$ETH_IFACE.network" +[Match] +Name=$ETH_IFACE + +[Network] +DHCP=yes +DNSSEC=no + +[DHCP] +# Use same IP by forcing to use MAC address for clientID +ClientIdentifier=mac +# https://github.com/pikvm/pikvm/issues/583 +RouteMetric=10 +end_of_file +fi + +# If the ETH_ADDR is defined, configure a static address on eth0 +if [ -n "$ETH_ADDR" ]; then + ETH_IFACE="${ETH_IFACE:-eth0}" + cat <<end_of_file > "/etc/systemd/network/$ETH_IFACE.network" +[Match] +Name=$ETH_IFACE + +[Network] +Address=$ETH_ADDR +DNS=$ETH_DNS +DNSSEC=no + +[Route] +Gateway=$ETH_GW +end_of_file +fi + + # ========== Wi-Fi ========== # Set the regulatory domain for wifi, if defined. |