network-interfaces: Add mtu setting support
Adds a setting to the network interface configuration for changing the mtu for each specified interface.
This commit is contained in:
parent
4cc859c6be
commit
c6ab810e37
@ -58,6 +58,15 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
virtual = mkOption {
|
virtual = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
@ -342,6 +351,11 @@ in
|
|||||||
echo "setting MAC address to ${i.macAddress}..."
|
echo "setting MAC address to ${i.macAddress}..."
|
||||||
ip link set "${i.name}" address "${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}"
|
||||||
|
''
|
||||||
+ optionalString (i.ipAddress != null)
|
+ optionalString (i.ipAddress != null)
|
||||||
''
|
''
|
||||||
cur=$(ip -4 -o a show dev "${i.name}" | awk '{print $4}')
|
cur=$(ip -4 -o a show dev "${i.name}" | awk '{print $4}')
|
||||||
|
Loading…
Reference in New Issue
Block a user