Is that a realistic user scenario that you’re trying to support?
You are correct—this is exactly the scenario I am trying to implement.
The primary challenge is that the network configuration cannot be modified while it is active. Currently, when a user attempts to change the network settings while it is in use, I prompt them either to restart the application or to stop any virtual machines using the network. This allows me to properly clean up and recreate the network with the updated configuration.
At this stage, I have chosen to require an application restart for network modifications, as I have not found a reliable method to fully release the vmnet network. The documentation suggests using CFRelease, but this is not directly compatible with ARC. I did identify a workaround that appears to function correctly; however, the limitation remains that the network configuration cannot be changed while it is active.
Additionally, it is not possible to hot-plug or remove network attachments from a running virtual machine, which further constrains dynamic reconfiguration.
Given this, my current focus has shifted to resolving the port forwarding issue. Even when the configuration is predefined, port forwarding is not functioning as expected, despite the API call returning success. I am investigating why this discrepancy is occurring. This is where i need help.
Instead of ip discovery i asked the user to set static ip which i can get it work with dhcp reservation with the network.