dsccommunity / dsccommunity/NetworkingDsc

IpConfiguration: Can't configure IPv4 address on adapter that only has IPv6 on it

Open
#487 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
235
Forks
93
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring

Trying to set IPv4 address on network adapter that currently only has IPv6. But that fails because DSC_IPAddress checks for "AddressFamily = 2" being set on the adapter, and refuses to proceed if that's not the case.

My manual workaround is to log in to the server and run the following:

Get-NetAdapter | Where-Object {$_.name -eq "ethernet1"} | New-NetIPAddress -IPAddress 172.16.2.100 -PrefixLength 24

After that, the DSC configuration will push properly. But I don't know how (idiomatically) to create the configuration that says "I know this adapter doesn't have an IPv4 address, but I'd like you to create one."

Note: issue #417 "Can't test a configuration that depends on Rename-NetAdapter" may be a related issue, in which @johlju mentions that neither Get-TargetResource nor Set-TargetResource should throw an error if the adapter does not exist yet.

Verbose logs showing the problem
[[IPAddress]IpAddressEthernet19f309ccb-69ce-427a-8374-e989113c1db3::[IpConfiguration]IpConfiguration] Importing the module DSC_IPAddress in force
mode.
VERBOSE: [TARGETSERVER]:
[[IPAddress]IpAddressEthernet19f309ccb-69ce-427a-8374-e989113c1db3::[IpConfiguration]IpConfiguration] Set-TargetResource: Applying the IP Address.
VERBOSE: [TARGETSERVER]: LCM:  [ End    Set      ]
[[IPAddress]IpAddressEthernet19f309ccb-69ce-427a-8374-e989113c1db3::[IpConfiguration]IpConfiguration]  in 0.1880 seconds.
PowerShell DSC resource DSC_IPAddress  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: No matching MSFT_NetIPAddress objects found by CIM query for
instances of the ROOT/StandardCimv2/MSFT_NetIPAddress class on the  CIM server: SELECT * FROM MSFT_NetIPAddress  WHERE ((InterfaceAlias LIKE
'Ethernet1')) AND ((AddressFamily = 2)). Verify query parameters and retry.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)

Where adapter Ethernet1 only has a default IPv6 address, and I want to put an IPv4 address on it, I try:

IpConfiguration:
  Adapter:
    - NewName: Ethernet1
      AddressFamily: IPv4
      IPAddress: 172.16.2.141/24
      GatewayAddress: 172.16.2.1
The operating system the target node is running

OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

Name Value


PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the DSC_IPAddress resource's Set-TargetResource path and how it queries MSFT_NetIPAddress for AddressFamily 2. Reproduce the failure with the provided Ethernet1 configuration on the stated Windows Server environment. Done means an adapter with only IPv6 can receive the requested IPv4 address through DSC without the CIM query failing.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.