You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a powershell in admin mode, set the network adapter to static mode.
I used address 192.168.180.30, Mask 255.255.255.0 and gateway 192.168.180.2
however it does not matter what ip address, gateway or mask is used as long as its a valid ip, gateway, and netmask combination.
You will notice that the enable static function results in setting the ip address the static address as expected.
The set gateways function also sets the gateway as expected. You can observe this in the printed route table, and ipconfig /all information.
Per the wmi documentation setting the gateway to the same address used to call EnableStatic should result in the gateway being cleared. However as observed in the route print, and also ipconfig /all this actually results in the gateway being set to 0.0.0.0 which is not the expected behavior, it actually applies a "default route" instead of no route.
As note this issue is also observed using c++ however I am not sure how to report this to the windows team, or the WMI Team at microsoft.
The route should be cleared when SetGateways is called with the same IP address that was used to EnableStatic
Actual behavior
The route should default gateway is set to 0.0.0.0 when SetGateways is called which results in the incorrect routing table and a network that does not route traffic properly.
Prerequisites
Steps to reproduce
Using a powershell in admin mode, set the network adapter to static mode.
I used address 192.168.180.30, Mask 255.255.255.0 and gateway 192.168.180.2
however it does not matter what ip address, gateway or mask is used as long as its a valid ip, gateway, and netmask combination.
You will notice that the enable static function results in setting the ip address the static address as expected.
The set gateways function also sets the gateway as expected. You can observe this in the printed route table, and ipconfig /all information.
Per the wmi documentation setting the gateway to the same address used to call EnableStatic should result in the gateway being cleared. However as observed in the route print, and also ipconfig /all this actually results in the gateway being set to 0.0.0.0 which is not the expected behavior, it actually applies a "default route" instead of no route.
As note this issue is also observed using c++ however I am not sure how to report this to the windows team, or the WMI Team at microsoft.
$nic = Get-WmiObject Win32_NetworkAdapterConfiguration -filter "Index='3'"
$ip_address = Read-Host("What's the IP address? :")
$subnetMask = Read-Host("what's the subnet mask? :")
$gateway = Read-Host("what's the gateway? :")
$nic.EnableStatic($ip_address,$subnetmask)
$nic.SetGateways($gateway,1)
Start-Sleep -Seconds 5
route print
ipconfig /all
$nic.SetGateways($ip_address,1)
Start-Sleep -Seconds 5
route print
ipconfig /all
Expected behavior
The route should be cleared when SetGateways is called with the same IP address that was used to EnableStatic
Actual behavior
The route should default gateway is set to 0.0.0.0 when SetGateways is called which results in the incorrect routing table and a network that does not route traffic properly.
Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: