Code:In die Zwischenablage kopieren
package WebDev;
import java.io.*;
import java.net.*;
import java.util.*;
import static java.lang.System.out;
public class ListNets {
public static void main(String args[]) throws SocketException {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets))
displayInterfaceInformation(netint);
}
static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
out.printf("Display name: %s\n", netint.getDisplayName());
out.printf("Name: %s\n", netint.getName());
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses)) {
out.printf("InetAddress: %s\n", inetAddress);
}
out.printf("\n");
}
}
Resultat:
Kein plan was das alles ist
Display name: Software Loopback Interface 1
Name: lo
InetAddress: /127.0.0.1
InetAddress: /0:0:0:0:0:0:0:1
Display name: WAN Miniport (SSTP)
Name: net0
Display name: WAN Miniport (L2TP)
Name: net1
Display name: WAN Miniport (PPTP)
Name: net2
Display name: WAN Miniport (PPPOE)
Name: ppp0
Display name: WAN Miniport (IPv6)
Name: eth0
Display name: WAN Miniport (Network Monitor)
Name: eth1
Display name: WAN Miniport (IP)
Name: eth2
Display name: RAS Async Adapter
Name: ppp1
Display name: WAN Miniport (IKEv2)
Name: net3
Display name: Microsoft Teredo Tunneling Adapter
Name: net4
InetAddress: /fe80:0:0:0:e0:0:0:0%net4
Display name: Bluetooth Device (Personal Area Network)
Name: eth3
Display name: Bluetooth Device (RFCOMM Protocol TDI)
Name: net5
Display name: Intel(R) Ethernet Connection I217-V
Name: eth4
InetAddress: /10.36.59.48
InetAddress: /fe80:0:0:0:98d3:622e:943b:f9da%eth4
Display name: Intel(R) Dual Band Wireless-AC 7260
Name: wlan0
InetAddress: /fe80:0:0:0:1ceb:2b0c:d843:cea2%wlan0
Display name: Bluetooth Device (RFCOMM Protocol TDI) #2
Name: net6
Display name: Bluetooth Device (Personal Area Network) #2
Name: eth5
Display name: Microsoft Virtual WiFi Miniport Adapter
Name: wlan1
InetAddress: /fe80:0:0:0:6c34:ece4:17d1:728d%wlan1
Display name: Microsoft ISATAP Adapter #3
Name: net7
InetAddress: /fe80:0:0:0:0:5efe:a24:3b30%net7
Display name: Microsoft ISATAP Adapter #2
Name: net8
Display name: Microsoft ISATAP Adapter #2-Symantec Endpoint Protection Firewall-0000
Name: net9
Display name: Microsoft ISATAP Adapter #3-Symantec Endpoint Protection Firewall-0000
Name: net10
Display name: Microsoft Teredo Tunneling Adapter-Symantec Endpoint Protection Firewall-0000
Name: net11
Display name: Intel(R) Ethernet Connection I217-V-Symantec Endpoint Protection Firewall-0000
Name: eth6
Display name: Intel(R) Ethernet Connection I217-V-QoS Packet Scheduler-0000
Name: eth7
Display name: Intel(R) Ethernet Connection I217-V-WFP LightWeight Filter-0000
Name: eth8
Display name: Intel(R) Dual Band Wireless-AC 7260-Symantec Endpoint Protection Firewall-0000
Name: wlan2
Display name: Intel(R) Dual Band Wireless-AC 7260-Virtual WiFi Filter Driver-0000
Name: wlan3
Display name: Intel(R) Dual Band Wireless-AC 7260-QoS Packet Scheduler-0000
Name: wlan4
Display name: WAN Miniport (Network Monitor)-Symantec Endpoint Protection Firewall-0000
Name: eth9
Display name: WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000
Name: eth10
Display name: WAN Miniport (IP)-Symantec Endpoint Protection Firewall-0000
Name: eth11
Display name: WAN Miniport (IP)-QoS Packet Scheduler-0000
Name: eth12
Display name: WAN Miniport (IPv6)-Symantec Endpoint Protection Firewall-0000
Name: eth13
Display name: WAN Miniport (IPv6)-QoS Packet Scheduler-0000
Name: eth14
Display name: Intel(R) Dual Band Wireless-AC 7260-Native WiFi Filter Driver-0000
Name: wlan5
Display name: Intel(R) Dual Band Wireless-AC 7260-WFP LightWeight Filter-0000
Name: wlan6
Display name: Microsoft Virtual WiFi Miniport Adapter-Native WiFi Filter Driver-0000
Name: wlan7
Display name: Microsoft Virtual WiFi Miniport Adapter-QoS Packet Scheduler-0000
Name: wlan8
Display name: Microsoft Virtual WiFi Miniport Adapter-WFP LightWeight Filter-0000
Name: wlan9
Display name: Microsoft Virtual WiFi Miniport Adapter-Symantec Endpoint Protection Firewall-0000
Name: wlan10
Display name: Microsoft ISATAP Adapter
Name: net12
Display name: Microsoft ISATAP Adapter-Symantec Endpoint Protection Firewall-0000
Name: net13