public static String getIPV4LocalAddress(String defEthName) {
        boolean foundNetInter = false;
        try {
            Enumeration<NetworkInterface> enumeration =
                    NetworkInterface.getNetworkInterfaces();
            if (enumeration == null) {
                throw new AddressException("Get NetworkInterfaces is null");
            }
            while (enumeration.hasMoreElements()) {
                NetworkInterface oneInterface = enumeration.nextElement();
                if (oneInterface == null
                        || oneInterface.isLoopback()
                        || !oneInterface.isUp()
                        || !defEthName.equalsIgnoreCase(oneInterface.getName())) {
                    continue;
                }
                foundNetInter = true;
                try {
                    Tuple2<Boolean, String> result =
                            getValidIPV4Address(oneInterface, null);
                    if (result.getF0()) {
                        localIPAddress = result.getF1();
                        return localIPAddress;
                    }
                } catch (Throwable e) {
                    //
                }
            }
        } catch (Throwable e) {
            throw new AddressException("Call getDefNetworkAddress throw exception", e);
        }
        if (foundNetInter) {
            throw new AddressException(new StringBuilder(256)
                    .append("Illegal parameter: not found valid ip")
                    .append(" in networkInterfaces ").append(defEthName).toString());
        } else {
            throw new AddressException(new StringBuilder(256)
                    .append("Illegal parameter: ").append(defEthName)
                    .append(" does not exist or is not in a valid state!").toString());
        }
    }
Get the local IP V4 address from the designated NetworkInterface

@return  the local IP V4 address
inlong-tubemq/tubemq-core/src/main/java/org/apache/inlong/tubemq/corebase/utils/AddressUtils.java