private static String getFirstLocalAddress() {
        try {
            final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
            while (interfaces.hasMoreElements()) {
                final NetworkInterface ni = interfaces.nextElement();
                final Enumeration<InetAddress> addresses = ni.getInetAddresses();
                while (addresses.hasMoreElements()) {
                    InetAddress address = addresses.nextElement();
                    if (!address.isLoopbackAddress() && !address.getHostAddress().contains(":")) {
                        return address.getHostAddress();
                    }
                }
            }
        } catch (final Throwable ignored) {
            // ignored
        }

        return "127.0.0.1";
    }
Gets the first valid IP in the NIC
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/NetUtil.java