From a0897c704dd5a8aea261aab8929f117317324094 Mon Sep 17 00:00:00 2001 From: Predrag Rogic Date: Tue, 18 Apr 2023 01:20:22 +0100 Subject: [PATCH] fix HostIP --- pkg/minikube/cluster/ip.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/cluster/ip.go b/pkg/minikube/cluster/ip.go index 5b5c7c22c4d7..5042494984d2 100644 --- a/pkg/minikube/cluster/ip.go +++ b/pkg/minikube/cluster/ip.go @@ -67,8 +67,12 @@ func HostIP(host *host.Host, clusterName string) (net.IP, error) { // user network case return net.ParseIP("10.0.2.2"), nil } - // "socket_vmnet" and "vmnet-*" network case - return net.ParseIP(ipString), nil + // "socket_vmnet" and "vmnet-*" network case: host ip should be start address of subnet + vmIP := net.ParseIP(ipString).To4() + if vmIP == nil { + return []byte{}, errors.Wrap(err, "Error converting VM IP address to IPv4 address") + } + return net.IPv4(vmIP[0], vmIP[1], vmIP[2], byte(1)), nil case driver.HyperV: v := reflect.ValueOf(host.Driver).Elem() var hypervVirtualSwitch string