NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.22k stars 14.21k forks source link

Attributes missing from module systemd.network #186984

Open peigongdsd opened 2 years ago

peigongdsd commented 2 years ago

Describe the bug

There r attributes provided by systemd-networkd but is missing from module systemd.network.

Steps To Reproduce

For example, the attribute

Group =

is provided by systemd-networkd.

[Link] Section Options
The [Link] section accepts the following keys:

MACAddress=
The hardware address to set for the device.

MTUBytes=
The maximum transmission unit in bytes to set for the device. The usual suffixes K, M, G, are supported and are understood to the base of 1024.

Note that if IPv6 is enabled on the interface, and the MTU is chosen below 1280 (the minimum MTU for IPv6) it will automatically be increased to this value.

ARP=
Takes a boolean. If set to true, the ARP (low-level Address Resolution Protocol) for this interface is enabled. When unset, the kernel's default will be used.

For example, disabling ARP is useful when creating multiple MACVLAN or VLAN virtual interfaces atop a single lower-level physical interface, which will then only serve as a link/"bridge" device aggregating traffic to the same physical link and not participate in the network otherwise. Defaults to unset.

Multicast=
Takes a boolean. If set to true, the multicast flag on the device is enabled. Defaults to unset.

AllMulticast=
Takes a boolean. If set to true, the driver retrieves all multicast packets from the network. This happens when multicast routing is enabled. Defaults to unset.

Promiscuous=
Takes a boolean. If set to true, promiscuous mode of the interface is enabled. Defaults to unset.

If this is set to false for the underlying link of a "passthru" mode MACVLAN/MACVTAP, the virtual interface will be created with the "nopromisc" flag set.

Unmanaged=
Takes a boolean. When "yes", no attempts are made to bring up or configure matching links, equivalent to when there are no matching network files. Defaults to "no".

This is useful for preventing later matching network files from interfering with certain interfaces that are fully controlled by other applications.

Group=
Link groups are similar to port ranges found in managed switches. When network interfaces are added to a numbered group, operations on all the interfaces from that group can be performed at once. Takes an unsigned integer in the range 0…2147483647. Defaults to unset.

RequiredForOnline=[¶](https://systemd.network/systemd.network.html#RequiredForOnline=)

(pasted from freedesktop documents)

However, such a key is absent from https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/system/boot/networkd.nix, in which it should take a place in "sectionLink = "

nrbray commented 10 months ago

I have found that neither of the following have the required effect:

systemd.network.networks.wg0.networkConfig.IPForward = true;
systemd.network.networks.wg0.networkConfig.IPForward = "ip4";

giving

# cat /proc/sys/net/ipv4/ip_forward
0

whereas, using this in the same module instead:

boot.kernel.sysctl."net.ipv4.ip_forward" = 1;

gives

cat /proc/sys/net/ipv4/ip_forward
1