• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NetworkInterface.isUp() is returning false for the interface which is up

 
Ravikanth Boorugadda
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a strange problem, windows ipconfig/all is showing the interface with ipaddress. But java is returning false for isUp() for the NetworkInterface.

I am running this code on Windows.

Here is the piece of code:
Enumeration<NetworkInterface> nwIfs = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface nwIf : Collections.list(nwIfs)) {
System.out.println("Interface = " + nwIf);
System.out.println("Interface is Up =" + nwIf.isUp());
System.out.println("Interface is virtual =" + nwIf.isVirtual());
System.out.println("Interface MTU =" + nwIf.getMTU());
System.out.println("Interface parent =" + nwIf.getParent());
System.out.println("Interface is loopback =" + nwIf.isLoopback());
System.out.println("Interface is point to point =" + nwIf.isPointToPoint());
System.out.println("Interface support Muticast =" + nwIf.supportsMulticast());

Here is the output:

Interface = name:eth4 (AAAAAAAA) index: 0 addresses:
/10.1.20.2;

Interface is Up =false
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true

Here is the ipconfig output for the interface
Ethernet adapter XXXXXXX:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : AAAAAAAA
Physical Address. . . . . . . . . : XX-XX-XX-XX-XX-XX
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.1.20.2(Preferred)
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . :
NetBIOS over Tcpip. . . . . . . . : Enabled

Any clue why the NetworkInterface code is behaving this way.
I have already posted this in forums.oracle.com, but didn't get any response.
 
Ravikanth Boorugadda
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more observation is , index is 0 for all the interfaces.
 
Raghu Shank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I executed the same program. I got the results as expected. Please check the permission of user profile. Please also check the java version.
 
Paul Clapham
Sheriff
Posts: 20998
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravikanth Boorugadda wrote:One more observation is , index is 0 for all the interfaces.


Index?
 
Raghu Shank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the interface also. Please see the output below.

Interface is Up =true
Interface is virtual =false
Interface MTU =1520
Interface parent =null
Interface is loopback =true
Interface is point to point =false
Interface support Muticast =true
Interface = name:eth0 (VMware Virtual Ethernet Adapter for VMnet8) index: 2 addresses:
/192.168.63.1;

Interface is Up =true
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true
Interface = name:eth1 (VMware Virtual Ethernet Adapter for VMnet1) index: 3 addresses:
/192.168.221.1;

Interface is Up =true
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true
Interface = name:eth2 (Intel(R) 82566DM Gigabit Network Connection - Teefer2 Miniport) index: 4 addresses:
/10.10.98.183;

Interface is Up =true
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic