diff --git a/pkg/netutil/iface.go b/pkg/netutil/iface.go index bfe1654bbd..c6d9b44af7 100644 --- a/pkg/netutil/iface.go +++ b/pkg/netutil/iface.go @@ -38,7 +38,7 @@ func getIPFromInterface(ifaceName string) (string, error) { if err != nil { return "", errors.Wrapf(err, "unable to parse CIDR for interface %s", iface.Name) } - // skipping if not ipv4 + // if not IPv4 adding it on IPv6 list if ip.To4() == nil { if ip.IsGlobalUnicast() { globalUnicastsIPv6 = append(globalUnicastsIPv6, ip.String()) diff --git a/pkg/util/net.go b/pkg/util/net.go index c26f464dd9..6e9c2963db 100644 --- a/pkg/util/net.go +++ b/pkg/util/net.go @@ -142,9 +142,12 @@ func GetHostnameAndIPs(name string, nodeIPs cli.StringSlice) (string, []net.IP, return "", nil, err } ips = append(ips, hostIP) - hostIPv6, err := apinet.ResolveBindAddress(net.IPv6loopback) - if err == nil && !hostIPv6.Equal(hostIP) { - ips = append(ips, hostIPv6) + // If IPv6 it's an IPv6 only node + if hostIP.To4() != nil { + hostIPv6, err := apinet.ResolveBindAddress(net.IPv6loopback) + if err == nil && !hostIPv6.Equal(hostIP) { + ips = append(ips, hostIPv6) + } } } else { var err error