NetworkingDsc
NetworkingDsc copied to clipboard
Issue with Networkteaminterface when vlanid is used
Hello DSC gurus,
Scenario is physical servers with trunk network ports that need to be teamed on Server 2019 and vlanid assigned. Config is created successfully the first time but fails on re-apply. This is related to how windows names the interfaces when team is created and when vlanid is assigned. When new team is created, a team nic with the same name is created. It is possible with powershell to set vlanid on that nic or to create new nic. when DSC Networkteaminterface is used if the name matches the team name, the vlanid is set but the name changes, and subsequent re-apply fails. If different name is used, it adds a second interface with the new name which is undesirable (having two interfaces on two vlans).
Undersired behavior Even though the name of the interface is specified as "Prod" it is created with name "Prod - VLAN 390" and it is not recognized on re-apply. Playing with the name adds a second interface and doesn't appear to be a solution
error message on re-apply PowerShell DSC resource DSC_NetworkTeamInterface failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: VlanID 390 is already being used by another TeamNic 'Prod - VLAN 390' in team 'Prod' + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName :
sample code (requires two nics for teaming). Run in push mode
Configuration teamnic { Import-DSCResource -ModuleName NetworkingDsc
node $allnodes.nodename {
NetworkTeam Prod { Name = "Prod" TeamMembers = $node.TeamMembers TeamingMode = $node.TeamingMode LoadBalancingAlgorithm = $node.LoadBalancingAlgorithm } NetworkTeamInterface Prod { Name = "Prod - VLAN $($node.vlanid)" TeamName = "Prod" VlanId = $node.VlanId DependsOn = "[NetworkTeam]Prod" } NetIPInterface Prod { AddressFamily = $node.AddressFamily Dhcp = "Disabled" InterfaceAlias = "Prod - VLAN $($node.vlanid)" DependsOn = "[NetworkTeamInterface]Prod" } IPAddress NewIPv4Address { IPAddress = $node.IPAddress InterfaceAlias = "Prod - VLAN $($node.vlanid)" AddressFamily = $node.AddressFamily DependsOn = "[NetIPInterface]Prod" } DefaultGatewayAddress Gateway { InterfaceAlias = "Prod - VLAN $($node.vlanid)" AddressFamily = $node.AddressFamily Address = $node.Gateway } DnsServerAddress DNSConfig { InterfaceAlias = "Prod - VLAN $($node.vlanid)" AddressFamily = $node.AddressFamily Address = $node.DNS } } } teamnic -ConfigurationData teamnic.psd1
sample teamnic.psd1 file: @{ AllNodes = @( @{ NodeName="$($env:computername)" IPAddress = "192.168.1.10/24" Gateway = "192.168.1.1" DNS = @("8.8.8.8","1.1.1.1") VLANID="390" TeamMembers=@("slot 1","slot 1 2") TeamingMode = "LACP" LoadBalancingAlgorithm = "Dynamic" AddressFamily = "IPv4" } ) }