TCPIP setting not stincking

This topic contains 6 replies, has 3 voices, and was last updated by Profile photo of Don Jones Don Jones 10 months, 1 week ago.

  • Author
    Posts
  • #34391
    Profile photo of Ken Resler
    Ken Resler
    Participant

    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.

  • #34392
    Profile photo of Tim Pringle
    Tim Pringle
    Participant

    Hi Ken, you're using a CIDR of 25, are you intentionally subclassing?

  • #34393
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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?

  • #34394
    Profile photo of Ken Resler
    Ken Resler
    Participant

    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.

  • #34395
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Personally, I've never had a problem using the cmdlets to set stuff, although nowadays I'm relying more on DSC.

  • #34455
    Profile photo of Ken Resler
    Ken Resler
    Participant

    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.

  • #34461
    Profile photo of Don Jones
    Don Jones
    Keymaster

    But after you use the script, you can run ipconfig and see the new settings?

You must be logged in to reply to this topic.