This topic contains 6 replies, has 3 voices, and was last updated by
January 27, 2016 at 11:47 am #34391
Server 2012R2 in VMware 5.5 using the script below the settings don't stick
$NIC = get-netadapter –name ethernet0
$NIC | set-netipinterface –dhcp disabled
$staticIP = Read-Host "What is the static IP for this NIC?"
$gateway = "gatewayIP"
$NIC |new-netipaddress –addressfamily IPv4 –ipaddress $staticIP`
–prefixlength 25 –type unicast –defaultgateway $gateway
$dns = "DNSserver1IP","DNSserver2IP"
set-dnsclientserveraddress –interfacealias ethernet0 –serveraddresses $DNS
Whether I reboot the server after the script or use restart-netadapter the settings do not stick. I get the I get the autoconfig IP 169.254.x.x with a subnet of 255.255.0.0 right back.
Any help would be appreciated. I have looked for a force type setting but have not found any.
January 27, 2016 at 11:56 am #34392ParticipantPoints: 0Rank: Member
Hi Ken, you're using a CIDR of 25, are you intentionally subclassing?
January 27, 2016 at 11:59 am #34393
Also, are you checking the settings after setting them, to make sure they took effect prior to rebooting? As in, is the machine able to communicate with the network once you've finished the settings?
Have you confirmed there's nothing in place in vSphere or Windows that might be forcing the setting back to DHCP?
January 27, 2016 at 12:52 pm #34394
Tim, Yes we are intentionally subclassing. We do not control the network, so we were give that portion of the class C subnet.
Don, I have tried with some mixed results. I am waiting on a fresh pair of VM's to test on. As far as I know there is nothing in Vsphere that would set them back. We have a few VM's in the environment that had the networking manually setup. I am trying to automate that process.
January 27, 2016 at 1:00 pm #34395
Personally, I've never had a problem using the cmdlets to set stuff, although nowadays I'm relying more on DSC.
January 28, 2016 at 8:32 am #34455
OK still stuck. I am going to go check out the Vsphere side of this equation. But I thought I would throw some more info at you incase it jogs a memory.
When I manually put in the TCPIP setting shown. It works fine and I see it get identified a a private network. I can then see everything I want to see.
When I use the script it goes to "Unidentified" and I can't see any portion of the network. I even tried using a full class subnetmask of 255.255.255.0
Any thoughts appreciated.
January 28, 2016 at 9:19 am #34461
But after you use the script, you can run ipconfig and see the new settings?
The topic ‘TCPIP setting not stincking’ is closed to new replies.