IP address doesn't change when reconfiguring network

Hello expert,

I have question about reconfiguration. When I changed the network during the reconfiguration, the network will be changed but the IP address doesn’t be reconfigured in the VM. Is this expected behavior?

Before reconfiguring network:

After reconfiguring network:

Thank you.

Depending on the version of Morpheus you should see a note in reconfigure that the IP is not changed only the network connection. This applies to both adding a new interface or changing it to another port group.

You could send a task to the instance prior to making this change or in the reconfigure phase of your provisioning workflow to update the IP info as needed.

1 Like

Yep this is a roadmap item as it can be complex depending on your integrations, as well as error handling (what do we do if the machine doesn’t start pinging back?). IPAM and DNS for example. Additionally, different flavors of Linux require different processes.

Here is an example script I have working with Windows in a reconfigure phase. Note, this is not calling to reclaim the IP allocation from an IPAM, and you would have to make a call to the new network to get a dynamic IP. (I tried to update a few of my static values with variables. May want to double check they are passing as intended)

#Update IP Address(es)
$script =  "c:\updateIp.ps1"
'$mac = ("<%=server.interfaces[0].macAddress%>").Replace(":","-")
$nic = (Get-NetAdapter | where MacAddress -eq $mac).ifIndex
$ip = "<%=customOptions.newIP%>"
$gw = "<%=customOptions.newGw%>"
$dns = @("8.8.8.8","1.1.1.1")

Remove-NetIPAddress -InterfaceIndex $nic -AddressFamily IPv4 -Confirm:$false
Remove-NetRoute -InterfaceIndex $nic -AddressFamily IPv4 -Confirm:$false
New-NetIPAddress -IPAddress $ip -InterfaceIndex $nic -DefaultGateway $gw -AddressFamily IPv4 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceIndex $nic -ServerAddresses $dns
' | out-file $script -Force
$Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-file $script"
$Trigger = New-ScheduledTaskTrigger -Once -At (get-date).AddSeconds(5); $Trigger.EndBoundary = (get-date).AddSeconds(30).ToString('s')
$Settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DeleteExpiredTaskAfter 00:00:30
Register-ScheduledTask -Force -user SYSTEM -TaskName "Update IP Address" -Action $Action -Trigger $Trigger -Settings $Settings -RunLevel Highest
1 Like