Last active
October 25, 2023 17:16
-
-
Save zewebdev1337/69585063420f2f6d8d4bd6aed776e269 to your computer and use it in GitHub Desktop.
Static IP address for arch linux KVM running systemd-networkd. Place at: /etc/systemd/network/20-ethernet.network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Match] | |
| # Matching with "Type=ether" causes issues with containers because it also matches virtual Ethernet interfaces (veth*). | |
| # See https://bugs.archlinux.org/task/70892 | |
| # Instead match by globbing the network interface name. | |
| Name=en* | |
| Name=eth* | |
| [Network] | |
| DHCP=no | |
| IPv6PrivacyExtensions=yes | |
| Address=192.168.X.X/24 | |
| Gateway=192.168.X.1 | |
| DNS=127.0.0.53 | |
| # systemd-networkd does not set per-interface-type default route metrics | |
| # https://github.com/systemd/systemd/issues/17698 | |
| # Explicitly set route metric, so that Ethernet is preferred over Wi-Fi and Wi-Fi is preferred over mobile broadband. | |
| # Use values from NetworkManager. From nm_device_get_route_metric_default in | |
| # https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/src/core/devices/nm-device.c | |
| [DHCPv4] | |
| RouteMetric=100 | |
| [IPv6AcceptRA] | |
| RouteMetric=100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment