Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kwein1 opened this issue Feb 19, 2021 · 0 comments

Comments

@kwein1
Copy link

kwein1 commented Feb 19, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant