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
|
||||
macvtapNetworkCfg = config.vmix.networks.${netCfg.name}.bridges.macvtaps.${macvtapName};
|
||||
macvtapInterfaceName = "mt-${vmCfg.name}-${macvtapNetworkCfg.uplink.iface}";
|
||||
|
|
@ -37,9 +37,10 @@ let
|
|||
{
|
||||
name = macvtapName;
|
||||
iface = macvtapInterfaceName;
|
||||
mac = macvtapCfg.mac;
|
||||
mac = macvtapVmCfg.mac;
|
||||
create = ''
|
||||
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 netns exec ${netName}.vmix ip link set dev ${macvtapInterfaceName} up
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -151,7 +151,8 @@ with lib;
|
|||
description = "Enable the MACVTap interface.";
|
||||
};
|
||||
mac = mkOption {
|
||||
type = types.str;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "MAC address for the MACVTap interface.";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue