macvtap mac address
This commit is contained in:
parent
0e6d764517
commit
abedd98ac2
2 changed files with 5 additions and 3 deletions
|
|
@ -29,7 +29,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
mkMacvtap = macvtapName: macvtapCfg:
|
mkMacvtap = macvtapName: macvtapVmCfg:
|
||||||
let
|
let
|
||||||
macvtapNetworkCfg = config.vmix.networks.${netCfg.name}.bridges.macvtaps.${macvtapName};
|
macvtapNetworkCfg = config.vmix.networks.${netCfg.name}.bridges.macvtaps.${macvtapName};
|
||||||
macvtapInterfaceName = "mt-${vmCfg.name}-${macvtapNetworkCfg.uplink.iface}";
|
macvtapInterfaceName = "mt-${vmCfg.name}-${macvtapNetworkCfg.uplink.iface}";
|
||||||
|
|
@ -37,9 +37,10 @@ let
|
||||||
{
|
{
|
||||||
name = macvtapName;
|
name = macvtapName;
|
||||||
iface = macvtapInterfaceName;
|
iface = macvtapInterfaceName;
|
||||||
mac = macvtapCfg.mac;
|
mac = macvtapVmCfg.mac;
|
||||||
create = ''
|
create = ''
|
||||||
ip link add link ${macvtapNetworkCfg.uplink.iface} name ${macvtapInterfaceName} type macvtap mode bridge
|
ip link add link ${macvtapNetworkCfg.uplink.iface} name ${macvtapInterfaceName} type macvtap mode bridge
|
||||||
|
${lib.optionalString (macvtapVmCfg.mac != null) "ip link set dev ${macvtapInterfaceName} address ${macvtapVmCfg.mac}"}
|
||||||
ip link set ${macvtapInterfaceName} netns ${netName}.vmix
|
ip link set ${macvtapInterfaceName} netns ${netName}.vmix
|
||||||
ip netns exec ${netName}.vmix ip link set dev ${macvtapInterfaceName} up
|
ip netns exec ${netName}.vmix ip link set dev ${macvtapInterfaceName} up
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,8 @@ with lib;
|
||||||
description = "Enable the MACVTap interface.";
|
description = "Enable the MACVTap interface.";
|
||||||
};
|
};
|
||||||
mac = mkOption {
|
mac = mkOption {
|
||||||
type = types.str;
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
description = "MAC address for the MACVTap interface.";
|
description = "MAC address for the MACVTap interface.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue