dsccommunity / dsccommunity/NetworkingDsc
Issue with Networkteaminterface when vlanid is used
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 235
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
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"
}
)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the NetworkTeamInterface resource and reproduce the sample configuration in PowerShell push mode on Server 2019. Inspect how DSC_NetworkTeamInterface finds the team NIC after assigning VlanId and how the generated alias is handled on re-apply. Done means the configuration can be applied again without the duplicate-VLAN error or an unwanted second interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100