Network Interface Info

/* Get Network Interface details of the Local machine */
import java.util.Collections;
import java.util.Enumeration;

public class networkParameter {
	public static void main(String args[]) throws SocketException {

		/* Collect network interface details */
		Enumeration<NetworkInterface> netInf = NetworkInterface.getNetworkInterfaces();
		for (NetworkInterface netInfo : Collections.list(netInf)) {

			/* Display network interface details */
			System.out.println("Display name: "+ netInfo.getDisplayName());
			System.out.println("Name: "+ netInfo.getName());
			Enumeration<InetAddress> ipAddresses = netInfo.getInetAddresses();
			for (InetAddress ipAddress : Collections.list(ipAddresses))
				System.out.println("IP Address: "+ inetAddress);


Display name: eth0

Name: eth0

IP Address: /fe80:0:0:0:eea8:6bff:fef5:1e5f%eth0

IP Address: /

Display name: lo

Name: lo

IP Address: /0:0:0:0:0:0:0:1%eth0

IP Address: /

Learn more about Network Interface

Recommended for you