public static List<InetAddress> getAllLocalNonLoopbackAddresses(boolean onlyIPv4) {
		List<InetAddress> addresses = new ArrayList<>();
		final Enumeration<NetworkInterface> networkInterfaces;
		try {
			networkInterfaces = getNetworkInterfaces();
			while (networkInterfaces.hasMoreElements()) {

				final NetworkInterface networkInterface = networkInterfaces.nextElement();
				if (networkInterface.isUp()) {
					final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
					while (inetAddresses.hasMoreElements()) {
						final InetAddress inetAddress = inetAddresses.nextElement();
						if (onlyIPv4 && inetAddress instanceof Inet6Address) {
							continue;
						}
						if (!inetAddress.isLoopbackAddress()) {
							addresses.add(inetAddress);
						}
					}
				}
			}
		} catch (SocketException e) {
			LOGGER.error("Error while resolving non look back local addresses.", e);
		}
		return addresses;
	}
Get IP form the given string.
<p/>
If the given ipOrHost is host name, it tries to turn it into IP.
If the host name is not available, it returns 127.0.0.1 instead.
ff

@param ipOrHost textual representation of ip or host name
@return ip
ngrinder-core/src/main/java/net/grinder/util/NetworkUtils.java