// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

public class IPs {
    public static void main(String[] args) throws Exception {
        Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
        while(e.hasMoreElements()) {
            NetworkInterface ni = e.nextElement();
            System.out.println("Net interface: " + ni.getName());
            Enumeration<InetAddress> e2 = ni.getInetAddresses();
            while (e2.hasMoreElements()){
                InetAddress ip = e2.nextElement();
                System.out.println("IP address: " + ip.getHostAddress());
            }
        }
    }
}
