Assign Static IP Address
Overview
Most hypervisors do not support extending the lease time when the IP is assigned using DHCP. This might lead to a new IP being assigned to the VM after a restart as it will conflict with the security certificates generated for the old IP. This will make Minishift completely unusable until a new instance is set up by running minishift delete
followed by minishift start
.
To prevent this, Minishift includes the functionality to set a static IP address to the VM. This will prevent the IP address from changing between restarts. However, it will not work on all of the driver plug-ins at the moment due to the way the IP address is resolved.
|
Assign IP Address to Hyper-V
Since the Internal Virtual Switch for Hyper-V does not provide a DHCP offer option, an IP address needs to be provided in a different way. Functionality is provided to assign an IP address on startup using the Data Exchange Service for Hyper-V.
to make this work, you need to create a Virtual Switch using NAT.
WinNAT is limited to one NAT network per host. For more details about capabilities and limitations, please see the WinNAT capabilities and limitations blog. |
The following command will attempt to assign an IP address for use on the Internal Virtual Switch ‘MyInternal’:
PS> minishift.exe config set hyperv-virtual-switch "MyInternal"
PS> minishift.exe start `
--network-ipaddress 192.168.1.10 `
--network-gateway 192.168.1.1 `
--network-nameserver 8.8.8.8
If you want to use the ‘DockerNAT’ network, the following commands are needed to setup the correct NAT networking and assign an IP in the range expected:
PS> New-NetNat -Name SharedNAT -InternalIPInterfaceAddressPrefix 10.0.75.1/24
PS> minishift.exe config set hyperv-virtual-switch "DockerNAT"
PS> minishift.exe start `
--network-ipaddress 10.0.75.128 `
--network-gateway 10.0.75.1 `
--network-nameserver 8.8.8.8
Be sure to specify a valid gateway and nameserver. Failing to do so will result in connectivity issues. |
Set Fixed IP Address
This feature is not supported on KVM as the driver plug-in relies on the DHCP offer to determine the IP address. |
The following command will set the IP address that was assigned as fixed:
$ minishift ip --set-static
If you prefer to use dynamic assignment, you can use:
$ minishift ip --set-dhcp
Use |