This is an extension of the following problem: NetworkInterface.getNetworkInterfaces() not listing all interfaces
I have 4 interface in an embedded device and if I run ifconfig I get the following output
eth0 Link encap:Ethernet HWaddr 04:a3:16:b0:a9:d7
inet addr:192.168.60.112 Bcast:192.168.60.255 Mask:255.255.255.0
inet6 addr: fe80::6a3:16ff:feb0:a9d7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:73134 errors:0 dropped:202 overruns:0 frame:0
TX packets:17867 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14662058 (13.9 MiB) TX bytes:3698311 (3.5 MiB)
Interrupt:77
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:3901 errors:0 dropped:0 overruns:0 frame:0
TX packets:3901 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:266106 (259.8 KiB) TX bytes:266106 (259.8 KiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet6 addr: fe80::7455:ff:fe00:0/0 Scope:Link
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:667 errors:0 dropped:0 overruns:0 frame:0
TX packets:712 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:87072 (85.0 KiB) TX bytes:70380 (68.7 KiB)
wlan0 Link encap:Ethernet HWaddr 7c:dd:90:90:99:97
UP BROADCAST MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
I have taken an example Java code from https://docs.oracle.com/javase/tutorial/networking/nifs/listing.html to list all the network interfaces and if I run it form a console I get the following output.
Display name: tun0
Name: tun0
InetAddress: /fe80:0:0:0:7455:ff:fe00:0%3
Display name: eth0
Name: eth0
InetAddress: /fe80:0:0:0:6a3:16ff:feb0:a9d7%2
InetAddress: /192.168.60.112
Display name: lo
Name: lo
InetAddress: /0:0:0:0:0:0:0:1%1
InetAddress: /127.0.0.1
If I run the same java class from Node-red installed in the same embedded device using exec node, I am getting the following output
Display name: eth0
Name: eth0
InetAddress: /192.168.60.112
Display name: lo
Name: lo
InetAddress: /127.0.0.1
I have understood the reason for missing wlan0 interface which is because the interface wasn't configured. But I don't understand why I am not able to see the tun0 interface if I run the same java class from the Node-red whereas I am able to see that interface if I run it from the console.
I found this problem while I was debugging a java application running from Node-red. I was able to run that application from a console without any problem but when I ran it form the Node-red I was getting the following error.
java.net.UnknownHostException: no such interface tun0
Can someone help me with this?
via Vamsi
No comments:
Post a Comment