有人能解释为什么Java GetNetworkInterfaces在Windows 7上返回这么多接口吗
我一直在使用有人能解释为什么Java GetNetworkInterfaces在Windows 7上返回这么多接口吗,java,windows-7,network-interface,Java,Windows 7,Network Interface,我一直在使用NetworkInterface.getNetworkInterfaces() 查询我的计算机上的网络接口。基本上我是在寻找网络接口卡。这些通常被称为eth0、eth1等 它在win xp甚至vista上都有很好的表现,并且有很小的过滤功能 我刚刚注意到在Windows7的某些配置中,我得到了大量列出的网络适配器。远远超过xp和vista。我只配置了一张卡,但似乎有三个不同的网络接口 英特尔(R)82567LM-3千兆网络连接 英特尔(R)82567LM-3千兆网络连接QoS数据包
NetworkInterface.getNetworkInterfaces()
查询我的计算机上的网络接口。基本上我是在寻找网络接口卡。这些通常被称为eth0、eth1等
它在win xp甚至vista上都有很好的表现,并且有很小的过滤功能
我刚刚注意到在Windows7的某些配置中,我得到了大量列出的网络适配器。远远超过xp和vista。我只配置了一张卡,但似乎有三个不同的网络接口
- 英特尔(R)82567LM-3千兆网络连接
- 英特尔(R)82567LM-3千兆网络连接QoS数据包调度程序-0000
- 英特尔(R)82567LM-3千兆网络连接WFP轻型过滤器-0000
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import static java.lang.System.out;
public class ListNetsEx {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Enumeration<NetworkInterface> nets;
try {
nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets))
displayInterfaceInformation(netint);
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
// TODO Auto-generated method stub
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("Up? %s\n", netint.isUp());
out.printf("Loopback? %s\n", netint.isLoopback());
out.printf("PointToPoint? %s\n", netint.isPointToPoint());
out.printf("Supports multicast? %s\n", netint.supportsMulticast());
out.printf("Virtual? %s\n", netint.isVirtual());
out.printf("Hardware address: %s\n",
Arrays.toString(netint.getHardwareAddress()));
out.printf("MTU: %s\n", netint.getMTU());
out.printf("\n");
}
}
导入java.net.InetAddress;
导入java.net.NetworkInterface;
导入java.net.SocketException;
导入java.util.array;
导入java.util.Collections;
导入java.util.Enumeration;
导入静态java.lang.System.out;
公共类ListNetEx{
/**
*@param args
*/
公共静态void main(字符串[]args){
//TODO自动生成的方法存根
枚举网;
试一试{
nets=NetworkInterface.getNetworkInterfaces();
用于(网络接口netint:Collections.list(nets))
显示接口信息(netint);
}捕获(SocketException e){
//TODO自动生成的捕捉块
e、 printStackTrace();
}
}
私有静态void DisplayInterface信息(NetworkInterface netint)引发SocketException{
//TODO自动生成的方法存根
out.printf(“显示名称:%s\n”,netint.getDisplayName());
out.printf(“名称:%s\n”,netint.getName());
枚举inetAddresses=netint.getInetAddresses();
用于(InetAddress:Collections.list(inetAddresses)){
out.printf(“InetAddress:%s\n”,InetAddress);
}
out.printf(“Up?%s\n”,netint.isUp());
out.printf(“环回?%s\n”,netint.isLoopback());
out.printf(“PointToPoint?%s\n”,netint.isPointToPoint());
out.printf(“支持多播?%s\n”,netint.supportsMulticast());
out.printf(“虚拟?%s\n”,netint.isVirtual());
out.printf(“硬件地址:%s\n”,
toString(netint.getHardwareAddress());
out.printf(“MTU:%s\n”,netint.getMTU());
out.printf(“\n”);
}
}
在Windows7上,输出是
Display name: Software Loopback Interface 1
Name: lo
InetAddress: /0:0:0:0:0:0:0:1
InetAddress: /127.0.0.1
Up? true
Loopback? true
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: []
MTU: -1
Display name: WAN Miniport (SSTP)
Name: net0
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (IKEv2)
Name: net1
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (L2TP)
Name: net2
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (PPTP)
Name: net3
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (PPPOE)
Name: ppp0
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (IPv6)
Name: eth0
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (Network Monitor)
Name: eth1
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (IP)
Name: eth2
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: RAS Async Adapter
Name: ppp1
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: Intel(R) 82567LM-3 Gigabit Network Connection
Name: eth3
InetAddress: /fe80:0:0:0:b1b1:7531:17b1:bf26%11
InetAddress: /172.24.9.148
Up? true
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: [120, 43, -53, 125, -80, 74]
MTU: 1500
Display name: Microsoft ISATAP Adapter
Name: net4
Up? false
Loopback? false
PointToPoint? true
Supports multicast? false
Virtual? false
Hardware address: [0, 0, 0, 0, 0, 0, 0, -32]
MTU: 1280
Display name: Teredo Tunneling Pseudo-Interface
Name: net5
InetAddress: /fe80:0:0:0:e0:0:0:0%13
Up? false
Loopback? false
PointToPoint? true
Supports multicast? false
Virtual? false
Hardware address: [0, 0, 0, 0, 0, 0, 0, -32]
MTU: 1280
Display name: Microsoft ISATAP Adapter #2
Name: net6
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: Intel(R) 82567LM-3 Gigabit Network Connection-QoS Packet Scheduler-0000
Name: eth4
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: Intel(R) 82567LM-3 Gigabit Network Connection-WFP LightWeight Filter-0000
Name: eth5
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000
Name: eth6
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (IP)-QoS Packet Scheduler-0000
Name: eth7
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
Display name: WAN Miniport (IPv6)-QoS Packet Scheduler-0000
Name: eth8
Up? false
Loopback? false
PointToPoint? false
Supports multicast? true
Virtual? false
Hardware address: null
MTU: -1
显示名称:软件环回接口1
姓名:罗
InetAddress:/0:0:0:0:0:0:0:0:1
InetAddress:/127.0.0.1
向上的真的
环回?真的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:[]
MTU:-1
显示名称:广域网微型端口(SSTP)
名称:net0
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:广域网微型端口(IKEv2)
名称:net1
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:广域网微型端口(L2TP)
名称:net2
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:广域网微型端口(PPTP)
名称:net3
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:广域网微型端口(PPPOE)
姓名:ppp0
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:广域网微型端口(IPv6)
姓名:eth0
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:WAN微型端口(网络监视器)
姓名:eth1
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:广域网微型端口(IP)
姓名:eth2
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:RAS异步适配器
名称:ppp1
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:英特尔(R)82567LM-3千兆网络连接
姓名:eth3
InetAddress:/fe80:0:0:0:b1b1:7531:17b1:bf26%11
InetAddress:/172.24.9.148
向上的真的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:[120,43,-53,125,-80,74]
MTU:1500
显示名称:Microsoft ISATAP适配器
名称:net4
向上的假的
环回?假的
点到点?真的
支持多播?假的
事实上的假的
硬件地址:[0,0,0,0,0,0,0,0,0,-32]
MTU:1280
显示名称:Teredo隧道伪接口
姓名:net5
InetAddress:/fe80:0:0:0:e0:0:0%13
向上的假的
环回?假的
点到点?真的
支持多播?假的
事实上的假的
硬件地址:[0,0,0,0,0,0,0,0,0,-32]
MTU:1280
显示名称:Microsoft ISATAP适配器#2
名称:net6
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:英特尔(R)82567LM-3千兆网络连接QoS数据包调度程序-0000
姓名:eth4
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称:英特尔(R)82567LM-3千兆网络连接WFP轻型过滤器-0000
姓名:eth5
向上的假的
环回?假的
点到点?假的
支持多播?真的
事实上的假的
硬件地址:空
MTU:-1
显示名称: