2014-08-29 02:27:20 +04:00
|
|
|
{ config, lib, pkgs, utils, ... }:
|
2009-03-06 15:27:38 +03:00
|
|
|
|
2014-04-14 18:26:48 +04:00
|
|
|
with lib;
|
2014-08-29 02:27:20 +04:00
|
|
|
with utils;
|
2007-02-12 19:00:55 +03:00
|
|
|
|
2009-10-12 21:27:57 +04:00
|
|
|
let
|
2009-05-28 20:03:48 +04:00
|
|
|
|
2009-07-16 21:18:54 +04:00
|
|
|
cfg = config.networking;
|
2012-11-02 20:08:11 +04:00
|
|
|
interfaces = attrValues cfg.interfaces;
|
|
|
|
hasVirtuals = any (i: i.virtual) interfaces;
|
2014-06-26 09:13:21 +04:00
|
|
|
hasSits = cfg.sits != { };
|
2013-12-30 13:14:41 +04:00
|
|
|
hasBonds = cfg.bonds != { };
|
2012-11-02 20:08:11 +04:00
|
|
|
|
2014-11-30 09:34:50 +03:00
|
|
|
slaves = concatMap (i: i.interfaces) (attrValues cfg.bonds)
|
|
|
|
++ concatMap (i: i.interfaces) (attrValues cfg.bridges);
|
|
|
|
|
2014-11-30 16:16:07 +03:00
|
|
|
slaveIfs = map (i: cfg.interfaces.${i}) (filter (i: cfg.interfaces ? ${i}) slaves);
|
2014-11-30 09:34:50 +03:00
|
|
|
|
2015-01-14 03:10:39 +03:00
|
|
|
rstpBridges = flip filterAttrs cfg.bridges (_: { rstp, ... }: rstp);
|
|
|
|
|
|
|
|
needsMstpd = rstpBridges != { };
|
|
|
|
|
|
|
|
bridgeStp = optional needsMstpd (pkgs.writeTextFile {
|
|
|
|
name = "bridge-stp";
|
|
|
|
executable = true;
|
|
|
|
destination = "/bin/bridge-stp";
|
|
|
|
text = ''
|
|
|
|
#!${pkgs.stdenv.shell} -e
|
|
|
|
export PATH="${pkgs.mstpd}/bin"
|
|
|
|
|
|
|
|
BRIDGES=(${concatStringsSep " " (attrNames rstpBridges)})
|
|
|
|
for BRIDGE in $BRIDGES; do
|
|
|
|
if [ "$BRIDGE" = "$1" ]; then
|
|
|
|
if [ "$2" = "start" ]; then
|
|
|
|
mstpctl addbridge "$BRIDGE"
|
|
|
|
exit 0
|
|
|
|
elif [ "$2" = "stop" ]; then
|
|
|
|
mstpctl delbridge "$BRIDGE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
2014-11-24 23:06:07 +03:00
|
|
|
# We must escape interfaces due to the systemd interpretation
|
|
|
|
subsystemDevice = interface:
|
|
|
|
"sys-subsystem-net-devices-${escapeSystemdPath interface}.device";
|
|
|
|
|
2014-08-31 20:46:16 +04:00
|
|
|
addrOpts = v:
|
|
|
|
assert v == 4 || v == 6;
|
|
|
|
{
|
|
|
|
address = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
IPv${toString v} address of the interface. Leave empty to configure the
|
|
|
|
interface using DHCP.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
prefixLength = mkOption {
|
|
|
|
type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128));
|
|
|
|
description = ''
|
|
|
|
Subnet mask of the interface, specified as the number of
|
|
|
|
bits in the prefix (<literal>${if v == 4 then "24" else "64"}</literal>).
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2012-11-02 20:08:11 +04:00
|
|
|
interfaceOpts = { name, ... }: {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
example = "eth0";
|
2013-10-30 14:02:04 +04:00
|
|
|
type = types.str;
|
2012-11-02 20:08:11 +04:00
|
|
|
description = "Name of the interface.";
|
|
|
|
};
|
|
|
|
|
2014-11-20 13:37:48 +03:00
|
|
|
useDHCP = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
Whether this interface should be configured with dhcp.
|
|
|
|
Null implies the old behavior which depends on whether ip addresses
|
|
|
|
are specified or not.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-08-31 20:46:16 +04:00
|
|
|
ip4 = mkOption {
|
|
|
|
default = [ ];
|
|
|
|
example = [
|
|
|
|
{ address = "10.0.0.1"; prefixLength = 16; }
|
|
|
|
{ address = "192.168.1.1"; prefixLength = 24; }
|
|
|
|
];
|
|
|
|
type = types.listOf types.optionSet;
|
|
|
|
options = addrOpts 4;
|
|
|
|
description = ''
|
|
|
|
List of IPv4 addresses that will be statically assigned to the interface.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
ip6 = mkOption {
|
|
|
|
default = [ ];
|
|
|
|
example = [
|
|
|
|
{ address = "fdfd:b3f0:482::1"; prefixLength = 48; }
|
|
|
|
{ address = "2001:1470:fffd:2098::e006"; prefixLength = 64; }
|
|
|
|
];
|
|
|
|
type = types.listOf types.optionSet;
|
|
|
|
options = addrOpts 6;
|
|
|
|
description = ''
|
|
|
|
List of IPv6 addresses that will be statically assigned to the interface.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-11-02 20:08:11 +04:00
|
|
|
ipAddress = mkOption {
|
|
|
|
default = null;
|
2014-08-30 19:00:10 +04:00
|
|
|
example = "10.0.0.1";
|
2014-08-31 20:46:16 +04:00
|
|
|
type = types.nullOr types.str;
|
2012-11-02 20:08:11 +04:00
|
|
|
description = ''
|
2014-08-30 19:00:10 +04:00
|
|
|
IP address of the interface. Leave empty to configure the
|
|
|
|
interface using DHCP.
|
2012-11-02 20:08:11 +04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
prefixLength = mkOption {
|
|
|
|
default = null;
|
2014-08-30 19:00:10 +04:00
|
|
|
example = 24;
|
|
|
|
type = types.nullOr types.int;
|
2012-11-02 20:08:11 +04:00
|
|
|
description = ''
|
2014-08-30 19:00:10 +04:00
|
|
|
Subnet mask of the interface, specified as the number of
|
|
|
|
bits in the prefix (<literal>24</literal>).
|
2012-11-02 20:08:11 +04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
subnetMask = mkOption {
|
2014-08-31 20:46:16 +04:00
|
|
|
default = null;
|
2012-11-02 20:08:11 +04:00
|
|
|
description = ''
|
2014-08-31 20:46:16 +04:00
|
|
|
Defunct, supply the prefix length instead.
|
2012-11-02 20:08:11 +04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-11-07 14:32:15 +04:00
|
|
|
ipv6Address = mkOption {
|
|
|
|
default = null;
|
2014-08-30 19:00:10 +04:00
|
|
|
example = "2001:1470:fffd:2098::e006";
|
2014-08-31 20:46:16 +04:00
|
|
|
type = types.nullOr types.str;
|
2013-11-07 14:32:15 +04:00
|
|
|
description = ''
|
2014-08-30 19:00:10 +04:00
|
|
|
IPv6 address of the interface. Leave empty to configure the
|
|
|
|
interface using NDP.
|
2013-11-07 14:32:15 +04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-09-05 04:47:26 +04:00
|
|
|
ipv6PrefixLength = mkOption {
|
2014-08-30 19:00:10 +04:00
|
|
|
default = 64;
|
|
|
|
example = 64;
|
|
|
|
type = types.int;
|
2013-11-07 14:32:15 +04:00
|
|
|
description = ''
|
2014-08-30 19:00:10 +04:00
|
|
|
Subnet mask of the interface, specified as the number of
|
|
|
|
bits in the prefix (<literal>64</literal>).
|
2013-11-07 14:32:15 +04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-11-02 20:08:11 +04:00
|
|
|
macAddress = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = "00:11:22:33:44:55";
|
2013-10-30 14:02:04 +04:00
|
|
|
type = types.nullOr (types.str);
|
2012-11-02 20:08:11 +04:00
|
|
|
description = ''
|
|
|
|
MAC address of the interface. Leave empty to use the default.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-12-30 06:58:59 +04:00
|
|
|
mtu = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = 9000;
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
description = ''
|
|
|
|
MTU size for packets leaving the interface. Leave empty to use the default.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-11-02 20:08:11 +04:00
|
|
|
virtual = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Whether this interface is virtual and should be created by tunctl.
|
|
|
|
This is mainly useful for creating bridges between a host a virtual
|
|
|
|
network such as VPN or a virtual machine.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
virtualOwner = mkOption {
|
|
|
|
default = "root";
|
2013-10-30 14:02:04 +04:00
|
|
|
type = types.str;
|
2012-11-02 20:08:11 +04:00
|
|
|
description = ''
|
|
|
|
In case of a virtual device, the user who owns it.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-08-24 05:38:29 +04:00
|
|
|
virtualType = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = types.nullOr (types.addCheck types.str (v: v == "tun" || v == "tap"));
|
|
|
|
description = ''
|
|
|
|
The explicit type of interface to create. Accepts tun or tap strings.
|
|
|
|
Also accepts null to implicitly detect the type of device.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-11-02 20:08:11 +04:00
|
|
|
proxyARP = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Turn on proxy_arp for this device (and proxy_ndp for ipv6).
|
|
|
|
This is mainly useful for creating pseudo-bridges between a real
|
|
|
|
interface and a virtual network such as VPN or a virtual machine for
|
|
|
|
interfaces that don't support real bridging (most wlan interfaces).
|
|
|
|
As ARP proxying acts slightly above the link-layer, below-ip traffic
|
|
|
|
isn't bridged, so things like DHCP won't work. The advantage above
|
|
|
|
using NAT lies in the fact that no IP addresses are shared, so all
|
|
|
|
hosts are reachable/routeable.
|
|
|
|
|
|
|
|
WARNING: turns on ip-routing, so if you have multiple interfaces, you
|
|
|
|
should think of the consequence and setup firewall rules to limit this.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
name = mkDefault name;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2009-07-16 21:18:54 +04:00
|
|
|
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
hexChars = stringToCharacters "0123456789abcdef";
|
|
|
|
|
|
|
|
isHexString = s: all (c: elem c hexChars) (stringToCharacters (toLower s));
|
|
|
|
|
2011-09-14 22:20:50 +04:00
|
|
|
in
|
2009-07-16 21:18:54 +04:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2009-05-28 20:03:48 +04:00
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
networking.hostName = mkOption {
|
|
|
|
default = "nixos";
|
2014-11-20 13:37:48 +03:00
|
|
|
type = types.str;
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
2009-05-28 20:03:48 +04:00
|
|
|
The name of the machine. Leave it empty if you want to obtain
|
|
|
|
it from a DHCP server (if using DHCP).
|
2009-07-16 21:18:54 +04:00
|
|
|
'';
|
2009-05-28 20:03:48 +04:00
|
|
|
};
|
|
|
|
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
networking.hostId = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = "4e98920d";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = ''
|
|
|
|
The 32-bit host ID of the machine, formatted as 8 hexadecimal characters.
|
|
|
|
|
|
|
|
You should try to make this ID unique among your machines. You can
|
2014-12-19 00:52:29 +03:00
|
|
|
generate a random 32-bit ID using the following commands:
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
|
2014-12-19 00:52:29 +03:00
|
|
|
<literal>cksum /etc/machine-id | while read c rest; do printf "%x" $c; done</literal>
|
|
|
|
|
|
|
|
(this derives it from the machine-id that systemd generates) or
|
|
|
|
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
<literal>head -c4 /dev/urandom | od -A none -t x4</literal>
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2011-02-19 20:21:29 +03:00
|
|
|
networking.enableIPv6 = mkOption {
|
|
|
|
default = true;
|
2014-11-20 13:37:48 +03:00
|
|
|
type = types.bool;
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
2011-02-19 20:21:29 +03:00
|
|
|
Whether to enable support for IPv6.
|
2009-07-16 21:18:54 +04:00
|
|
|
'';
|
2009-05-28 20:03:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.defaultGateway = mkOption {
|
2014-11-20 13:37:48 +03:00
|
|
|
default = null;
|
2009-05-28 20:03:48 +04:00
|
|
|
example = "131.211.84.1";
|
2014-11-20 13:37:48 +03:00
|
|
|
type = types.nullOr types.str;
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
2009-05-28 20:03:48 +04:00
|
|
|
The default gateway. It can be left empty if it is auto-detected through DHCP.
|
2009-07-16 21:18:54 +04:00
|
|
|
'';
|
2009-05-28 20:03:48 +04:00
|
|
|
};
|
|
|
|
|
2014-12-18 04:54:06 +03:00
|
|
|
networking.defaultGateway6 = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = "2001:4d0:1e04:895::1";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = ''
|
|
|
|
The default ipv6 gateway. It can be left empty if it is auto-detected through DHCP.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-01-07 01:31:13 +04:00
|
|
|
networking.defaultGatewayWindowSize = mkOption {
|
2013-01-07 02:20:48 +04:00
|
|
|
default = null;
|
|
|
|
example = 524288;
|
|
|
|
type = types.nullOr types.int;
|
2013-01-07 01:31:13 +04:00
|
|
|
description = ''
|
|
|
|
The window size of the default gateway. It limits maximal data bursts that TCP peers
|
|
|
|
are allowed to send to us.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-05-28 20:03:48 +04:00
|
|
|
networking.nameservers = mkOption {
|
|
|
|
default = [];
|
|
|
|
example = ["130.161.158.4" "130.161.33.17"];
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
2009-05-28 20:03:48 +04:00
|
|
|
The list of nameservers. It can be left empty if it is auto-detected through DHCP.
|
2009-07-16 21:18:54 +04:00
|
|
|
'';
|
2009-05-28 20:03:48 +04:00
|
|
|
};
|
|
|
|
|
2014-04-25 02:46:12 +04:00
|
|
|
networking.search = mkOption {
|
|
|
|
default = [];
|
|
|
|
example = [ "example.com" "local.domain" ];
|
|
|
|
type = types.listOf types.str;
|
|
|
|
description = ''
|
|
|
|
The list of search paths used when resolving domain names.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-05-28 20:03:48 +04:00
|
|
|
networking.domain = mkOption {
|
2014-11-20 13:37:48 +03:00
|
|
|
default = null;
|
2009-05-28 20:03:48 +04:00
|
|
|
example = "home";
|
2014-11-20 13:37:48 +03:00
|
|
|
type = types.nullOr types.str;
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
2009-05-28 20:03:48 +04:00
|
|
|
The domain. It can be left empty if it is auto-detected through DHCP.
|
2009-07-16 21:18:54 +04:00
|
|
|
'';
|
2009-05-28 20:03:48 +04:00
|
|
|
};
|
|
|
|
|
2014-04-18 18:40:27 +04:00
|
|
|
networking.useHostResolvConf = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
In containers, whether to use the
|
|
|
|
<filename>resolv.conf</filename> supplied by the host.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-05-28 20:03:48 +04:00
|
|
|
networking.localCommands = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "text=anything; echo You can put $text here.";
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
2009-05-28 20:03:48 +04:00
|
|
|
Shell commands to be executed at the end of the
|
2013-04-11 16:23:35 +04:00
|
|
|
<literal>network-setup</literal> systemd service. Note that if
|
2009-05-28 20:03:48 +04:00
|
|
|
you are using DHCP to obtain the network configuration,
|
|
|
|
interfaces may not be fully configured yet.
|
2009-07-16 21:18:54 +04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.interfaces = mkOption {
|
2012-11-02 20:08:11 +04:00
|
|
|
default = {};
|
|
|
|
example =
|
2014-08-31 20:46:16 +04:00
|
|
|
{ eth0.ip4 = [ {
|
|
|
|
address = "131.211.84.78";
|
|
|
|
prefixLength = 25;
|
|
|
|
} ];
|
2012-11-02 20:08:11 +04:00
|
|
|
};
|
2009-07-16 21:18:54 +04:00
|
|
|
description = ''
|
|
|
|
The configuration for each network interface. If
|
|
|
|
<option>networking.useDHCP</option> is true, then every
|
|
|
|
interface not listed here will be configured using DHCP.
|
|
|
|
'';
|
2012-11-02 20:08:11 +04:00
|
|
|
type = types.loaOf types.optionSet;
|
|
|
|
options = [ interfaceOpts ];
|
2010-05-21 18:12:03 +04:00
|
|
|
};
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2011-03-15 18:13:48 +03:00
|
|
|
networking.bridges = mkOption {
|
|
|
|
default = { };
|
|
|
|
example =
|
|
|
|
{ br0.interfaces = [ "eth0" "eth1" ];
|
|
|
|
br1.interfaces = [ "eth2" "wlan0" ];
|
|
|
|
};
|
|
|
|
description =
|
|
|
|
''
|
|
|
|
This option allows you to define Ethernet bridge devices
|
|
|
|
that connect physical networks together. The value of this
|
|
|
|
option is an attribute set. Each attribute specifies a
|
|
|
|
bridge, with the attribute name specifying the name of the
|
|
|
|
bridge's network interface.
|
|
|
|
'';
|
|
|
|
|
|
|
|
type = types.attrsOf types.optionSet;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
interfaces = mkOption {
|
|
|
|
example = [ "eth0" "eth1" ];
|
2015-06-15 19:18:46 +03:00
|
|
|
type = types.listOf types.str;
|
2011-03-15 18:13:48 +03:00
|
|
|
description =
|
|
|
|
"The physical network interfaces connected by the bridge.";
|
|
|
|
};
|
|
|
|
|
2015-01-08 01:34:15 +03:00
|
|
|
rstp = mkOption {
|
|
|
|
example = true;
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether the bridge interface should enable rstp.";
|
|
|
|
};
|
|
|
|
|
2011-03-15 18:13:48 +03:00
|
|
|
};
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2011-03-15 18:13:48 +03:00
|
|
|
};
|
|
|
|
|
2013-12-30 13:14:41 +04:00
|
|
|
networking.bonds = mkOption {
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
bond0 = {
|
|
|
|
interfaces = [ "eth0" "wlan0" ];
|
|
|
|
miimon = 100;
|
|
|
|
mode = "active-backup";
|
|
|
|
};
|
|
|
|
fatpipe.interfaces = [ "enp4s0f0" "enp4s0f1" "enp5s0f0" "enp5s0f1" ];
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
This option allows you to define bond devices that aggregate multiple,
|
|
|
|
underlying networking interfaces together. The value of this option is
|
|
|
|
an attribute set. Each attribute specifies a bond, with the attribute
|
|
|
|
name specifying the name of the bond's network interface
|
|
|
|
'';
|
|
|
|
|
|
|
|
type = types.attrsOf types.optionSet;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
interfaces = mkOption {
|
|
|
|
example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
|
2014-10-05 04:57:51 +04:00
|
|
|
type = types.listOf types.str;
|
2013-12-30 13:14:41 +04:00
|
|
|
description = "The interfaces to bond together";
|
|
|
|
};
|
|
|
|
|
2014-10-05 04:57:51 +04:00
|
|
|
lacp_rate = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = "fast";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = ''
|
|
|
|
Option specifying the rate in which we'll ask our link partner
|
|
|
|
to transmit LACPDU packets in 802.3ad mode.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-12-30 13:14:41 +04:00
|
|
|
miimon = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = 100;
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
description = ''
|
|
|
|
Miimon is the number of millisecond in between each round of polling
|
|
|
|
by the device driver for failed links. By default polling is not
|
|
|
|
enabled and the driver is trusted to properly detect and handle
|
|
|
|
failure scenarios.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
mode = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = "active-backup";
|
2014-10-05 04:57:51 +04:00
|
|
|
type = types.nullOr types.str;
|
2013-12-30 13:14:41 +04:00
|
|
|
description = ''
|
|
|
|
The mode which the bond will be running. The default mode for
|
|
|
|
the bonding driver is balance-rr, optimizing for throughput.
|
|
|
|
More information about valid modes can be found at
|
|
|
|
https://www.kernel.org/doc/Documentation/networking/bonding.txt
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-10-05 04:57:51 +04:00
|
|
|
xmit_hash_policy = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = "layer2+3";
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = ''
|
|
|
|
Selects the transmit hash policy to use for slave selection in
|
|
|
|
balance-xor, 802.3ad, and tlb modes.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-12-30 13:14:41 +04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2014-11-27 02:42:32 +03:00
|
|
|
networking.macvlans = mkOption {
|
|
|
|
type = types.attrsOf types.optionSet;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
wan = {
|
|
|
|
interface = "enp2s0";
|
|
|
|
mode = "vepa";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
This option allows you to define macvlan interfaces which should
|
|
|
|
be automatically created.
|
|
|
|
'';
|
|
|
|
options = {
|
|
|
|
|
|
|
|
interface = mkOption {
|
|
|
|
example = "enp4s0";
|
|
|
|
type = types.string;
|
|
|
|
description = "The interface the macvlan will transmit packets through.";
|
|
|
|
};
|
|
|
|
|
|
|
|
mode = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
example = "vepa";
|
|
|
|
description = "The mode of the macvlan device.";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2014-06-26 09:13:21 +04:00
|
|
|
networking.sits = mkOption {
|
|
|
|
type = types.attrsOf types.optionSet;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
hurricane = {
|
|
|
|
remote = "10.0.0.1";
|
|
|
|
local = "10.0.0.22";
|
|
|
|
ttl = 255;
|
|
|
|
};
|
|
|
|
msipv6 = {
|
|
|
|
remote = "192.168.0.1";
|
|
|
|
dev = "enp3s0";
|
|
|
|
ttl = 127;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
This option allows you to define 6-to-4 interfaces which should be automatically created.
|
|
|
|
'';
|
|
|
|
options = {
|
|
|
|
|
|
|
|
remote = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
example = "10.0.0.1";
|
|
|
|
description = ''
|
|
|
|
The address of the remote endpoint to forward traffic over.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
local = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
example = "10.0.0.22";
|
|
|
|
description = ''
|
|
|
|
The address of the local endpoint which the remote
|
|
|
|
side should send packets to.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
ttl = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
default = null;
|
|
|
|
example = 255;
|
|
|
|
description = ''
|
|
|
|
The time-to-live of the connection to the remote tunnel endpoint.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
dev = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
example = "enp4s0f0";
|
|
|
|
description = ''
|
|
|
|
The underlying network device on which the tunnel resides.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-12-30 07:52:30 +04:00
|
|
|
networking.vlans = mkOption {
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
vlan0 = {
|
|
|
|
id = 3;
|
|
|
|
interface = "enp3s0";
|
|
|
|
};
|
|
|
|
vlan1 = {
|
|
|
|
id = 1;
|
|
|
|
interface = "wlan0";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
description =
|
|
|
|
''
|
|
|
|
This option allows you to define vlan devices that tag packets
|
|
|
|
on top of a physical interface. The value of this option is an
|
|
|
|
attribute set. Each attribute specifies a vlan, with the name
|
|
|
|
specifying the name of the vlan interface.
|
|
|
|
'';
|
|
|
|
|
|
|
|
type = types.attrsOf types.optionSet;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
id = mkOption {
|
|
|
|
example = 1;
|
|
|
|
type = types.int;
|
|
|
|
description = "The vlan identifier";
|
|
|
|
};
|
|
|
|
|
|
|
|
interface = mkOption {
|
|
|
|
example = "enp4s0";
|
|
|
|
type = types.string;
|
|
|
|
description = "The interface the vlan will transmit packets through.";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2012-02-20 18:29:21 +04:00
|
|
|
networking.useDHCP = mkOption {
|
2013-10-28 19:14:15 +04:00
|
|
|
type = types.bool;
|
2012-02-20 18:29:21 +04:00
|
|
|
default = true;
|
|
|
|
description = ''
|
2013-08-11 01:07:13 +04:00
|
|
|
Whether to use DHCP to obtain an IP address and other
|
2012-02-20 18:29:21 +04:00
|
|
|
configuration for all network interfaces that are not manually
|
|
|
|
configured.
|
|
|
|
'';
|
|
|
|
};
|
2013-02-11 19:01:01 +04:00
|
|
|
|
2014-11-20 13:37:48 +03:00
|
|
|
networking.useNetworkd = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Whether we should use networkd as the network configuration backend or
|
2014-11-25 22:44:14 +03:00
|
|
|
the legacy script based system. Note that this option is experimental,
|
|
|
|
enable at your own risk.
|
2014-11-20 13:37:48 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-05-28 20:03:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-16 21:18:54 +04:00
|
|
|
###### implementation
|
2009-05-28 20:03:48 +04:00
|
|
|
|
2009-07-16 21:18:54 +04:00
|
|
|
config = {
|
2009-03-06 15:27:38 +03:00
|
|
|
|
2014-08-31 20:46:16 +04:00
|
|
|
assertions =
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
(flip map interfaces (i: {
|
2014-08-31 20:46:16 +04:00
|
|
|
assertion = i.subnetMask == null;
|
|
|
|
message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead.";
|
2014-11-30 09:34:50 +03:00
|
|
|
})) ++ (flip map slaveIfs (i: {
|
|
|
|
assertion = i.ip4 == [ ] && i.ipAddress == null && i.ip6 == [ ] && i.ipv6Address == null;
|
|
|
|
message = "The networking.interfaces.${i.name} must not have any defined ips when it is a slave.";
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
})) ++ [
|
|
|
|
{
|
|
|
|
assertion = cfg.hostId == null || (stringLength cfg.hostId == 8 && isHexString cfg.hostId);
|
|
|
|
message = "Invalid value given to the networking.hostId option.";
|
|
|
|
}
|
|
|
|
];
|
2014-08-31 20:46:16 +04:00
|
|
|
|
2013-12-30 13:14:41 +04:00
|
|
|
boot.kernelModules = [ ]
|
|
|
|
++ optional cfg.enableIPv6 "ipv6"
|
|
|
|
++ optional hasVirtuals "tun"
|
2014-06-26 09:13:21 +04:00
|
|
|
++ optional hasSits "sit"
|
2013-12-30 13:14:41 +04:00
|
|
|
++ optional hasBonds "bonding";
|
|
|
|
|
|
|
|
boot.extraModprobeConfig =
|
|
|
|
# This setting is intentional as it prevents default bond devices
|
|
|
|
# from being created.
|
|
|
|
optionalString hasBonds "options bonding max_bonds=0";
|
2011-02-19 20:21:29 +03:00
|
|
|
|
2014-11-20 13:37:48 +03:00
|
|
|
boot.kernel.sysctl = {
|
2014-11-25 05:01:02 +03:00
|
|
|
"net.net.ipv4.conf.all.promote_secondaries" = true;
|
2014-11-20 13:37:48 +03:00
|
|
|
"net.ipv6.conf.all.disable_ipv6" = mkDefault (!cfg.enableIPv6);
|
|
|
|
"net.ipv6.conf.default.disable_ipv6" = mkDefault (!cfg.enableIPv6);
|
|
|
|
"net.ipv4.conf.all_forwarding" = mkDefault (any (i: i.proxyARP) interfaces);
|
|
|
|
"net.ipv6.conf.all.forwarding" = mkDefault (any (i: i.proxyARP) interfaces);
|
|
|
|
} // listToAttrs (concatLists (flip map (filter (i: i.proxyARP) interfaces)
|
|
|
|
(i: flip map [ "4" "6" ] (v: nameValuePair "net.ipv${v}.conf.${i.name}.proxy_arp" true))
|
|
|
|
));
|
2010-06-03 01:10:48 +04:00
|
|
|
|
|
|
|
security.setuidPrograms = [ "ping" "ping6" ];
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2013-05-22 03:30:24 +04:00
|
|
|
# Set the host and domain names in the activation script. Don't
|
|
|
|
# clear it if it's not configured in the NixOS configuration,
|
2013-10-29 20:34:43 +04:00
|
|
|
# since it may have been set by dhcpcd in the meantime.
|
2010-09-13 19:41:38 +04:00
|
|
|
system.activationScripts.hostname =
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
optionalString (cfg.hostName != "") ''
|
|
|
|
hostname "${cfg.hostName}"
|
2010-09-14 15:58:55 +04:00
|
|
|
'';
|
2013-05-22 03:30:24 +04:00
|
|
|
system.activationScripts.domain =
|
2014-11-20 13:37:48 +03:00
|
|
|
optionalString (cfg.domain != null) ''
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
domainname "${cfg.domain}"
|
2013-05-22 03:30:24 +04:00
|
|
|
'';
|
2009-07-16 21:18:54 +04:00
|
|
|
|
nixos: Add system-wide option to set the hostid
The old boot.spl.hostid option was not working correctly due to an
upstream bug.
Instead, now we will create the /etc/hostid file so that all applications
(including the ZFS kernel modules, ZFS user-space applications and other
unrelated programs) pick-up the same system-wide host id. Note that glibc
(and by extension, the `hostid` program) also respect the host id configured in
/etc/hostid, if it exists.
The hostid option is now mandatory when using ZFS because otherwise, ZFS will
require you to force-import your ZFS pools if you want to use them, which is
undesirable because it disables some of the checks that ZFS does to make sure it
is safe to import a ZFS pool.
The /etc/hostid file must also exist when booting the initrd, before the SPL
kernel module is loaded, so that ZFS picks up the hostid correctly.
The complexity in creating the /etc/hostid file is due to having to
write the host ID as a 32-bit binary value, taking into account the
endianness of the machine, while using only shell commands and/or simple
utilities (to avoid exploding the size of the initrd).
2014-10-23 06:59:06 +04:00
|
|
|
environment.etc = mkIf (cfg.hostId != null)
|
|
|
|
[
|
|
|
|
{
|
|
|
|
target = "hostid";
|
|
|
|
source = pkgs.runCommand "gen-hostid" {} ''
|
|
|
|
hi="${cfg.hostId}"
|
|
|
|
${if pkgs.stdenv.isBigEndian then ''
|
|
|
|
echo -ne "\x''${hi:0:2}\x''${hi:2:2}\x''${hi:4:2}\x''${hi:6:2}" > $out
|
|
|
|
'' else ''
|
|
|
|
echo -ne "\x''${hi:6:2}\x''${hi:4:2}\x''${hi:2:2}\x''${hi:0:2}" > $out
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2014-11-20 13:37:48 +03:00
|
|
|
environment.systemPackages =
|
|
|
|
[ pkgs.host
|
|
|
|
pkgs.iproute
|
|
|
|
pkgs.iputils
|
|
|
|
pkgs.nettools
|
2015-07-22 13:51:21 +03:00
|
|
|
pkgs.openresolv
|
|
|
|
]
|
|
|
|
++ optionals (!config.boot.isContainer) [
|
|
|
|
pkgs.wirelesstools # FIXME: obsolete?
|
2014-11-20 13:37:48 +03:00
|
|
|
pkgs.iw
|
|
|
|
pkgs.rfkill
|
2015-07-22 13:51:21 +03:00
|
|
|
]
|
|
|
|
++ bridgeStp;
|
2012-10-12 01:59:41 +04:00
|
|
|
|
2014-11-30 09:34:50 +03:00
|
|
|
systemd.targets."network-interfaces" =
|
|
|
|
{ description = "All Network Interfaces";
|
|
|
|
wantedBy = [ "network.target" ];
|
2014-11-30 09:43:54 +03:00
|
|
|
before = [ "network.target" ];
|
2014-12-02 04:19:06 +03:00
|
|
|
after = [ "network-pre.target" ];
|
2014-11-30 09:34:50 +03:00
|
|
|
unitConfig.X-StopOnReconfiguration = true;
|
|
|
|
};
|
|
|
|
|
2014-11-24 23:06:07 +03:00
|
|
|
systemd.services = {
|
|
|
|
network-local-commands = {
|
|
|
|
description = "Extra networking commands.";
|
2014-11-26 22:19:31 +03:00
|
|
|
before = [ "network.target" ];
|
|
|
|
wantedBy = [ "network.target" ];
|
2014-12-02 04:19:06 +03:00
|
|
|
after = [ "network-pre.target" ];
|
2014-11-24 23:06:07 +03:00
|
|
|
unitConfig.ConditionCapability = "CAP_NET_ADMIN";
|
|
|
|
path = [ pkgs.iproute ];
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
serviceConfig.RemainAfterExit = true;
|
|
|
|
script = ''
|
|
|
|
# Run any user-specified commands.
|
|
|
|
${cfg.localCommands}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
} // (listToAttrs (flip map interfaces (i:
|
|
|
|
nameValuePair "network-link-${i.name}"
|
|
|
|
{ description = "Link configuration of ${i.name}";
|
|
|
|
wantedBy = [ "network-interfaces.target" ];
|
|
|
|
before = [ "network-interfaces.target" ];
|
|
|
|
bindsTo = [ (subsystemDevice i.name) ];
|
2014-12-02 04:19:06 +03:00
|
|
|
after = [ (subsystemDevice i.name) "network-pre.target" ];
|
2014-11-28 09:53:50 +03:00
|
|
|
path = [ pkgs.iproute ];
|
2014-11-24 23:06:07 +03:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
};
|
|
|
|
script =
|
|
|
|
''
|
|
|
|
echo "Configuring link..."
|
|
|
|
'' + optionalString (i.macAddress != null) ''
|
|
|
|
echo "setting MAC address to ${i.macAddress}..."
|
|
|
|
ip link set "${i.name}" address "${i.macAddress}"
|
|
|
|
'' + optionalString (i.mtu != null) ''
|
|
|
|
echo "setting MTU to ${toString i.mtu}..."
|
|
|
|
ip link set "${i.name}" mtu "${toString i.mtu}"
|
|
|
|
'';
|
|
|
|
})));
|
2015-01-14 03:10:39 +03:00
|
|
|
|
|
|
|
services.mstpd = mkIf needsMstpd { enable = true; };
|
|
|
|
|
2009-07-16 21:18:54 +04:00
|
|
|
};
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2006-11-20 20:06:44 +03:00
|
|
|
}
|