Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

[Linux] Network module shows offline all the time #460

Closed
presianbg opened this issue Mar 17, 2019 · 17 comments
Closed

[Linux] Network module shows offline all the time #460

presianbg opened this issue Mar 17, 2019 · 17 comments
Labels
bug Confirmed bugs.

Comments

@presianbg
Copy link

Hi,

Great project.
The network module seems to not working in Solus Linux. It shows "OFFLINE" all the time.
Detected NICs are correct + ping to 1.1.1.1 is OK.
Changing the LAN to WLAN and the address for test is not giving any different results.
My public IPv4 address is blinking.

Is there a way to debug and troubleshoot this issue? I'm running it from AppImage.

@GitSquared
Copy link
Owner

Could you give me a list of your NICs?
Do you think you could have any latency issues reaching https://ipinfo.now.sh?
Do the 3D globe and network traffic monitor work or are they blinking/displaying "offline"?

@presianbg
Copy link
Author

presianbg commented Mar 17, 2019

enp0s31f6 Link encap:Ethernet  HWaddr 10:62:E5:51:FE:53
          inet addr:172.16.16.28  Bcast:172.16.16.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:35088 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22804 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:38707434  TX bytes:2973114
          Interrupt:16 Memory:e6300000-e6320000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Bcast:0.0.0.0  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3253 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3253 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:352802  TX bytes:352802

wlp1s0    Link encap:Ethernet  HWaddr 5C:5F:67:96:71:9D
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:4174 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3329 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2842134  TX bytes:534273
curl https://ipinfo.now.sh
{"api_version":"3.0.0","geo":{"latitude":42.6833,"longitude":23.3167,"metro_code":null,"time_zone":"Europe/Sofia"},"ip":"REDACTED","time":1552822217}

3D globe and network traffic monitor are showing OFFLINE too.

EDIT: I understand most of the code (haven't write a single line in JS though), but this part of the netstat class does not make sense to me:

            if (net.ip4 === "127.0.0.1") {
                offline = true;

I assume the while loop does not pick my local network and the above case sets the offline flag.

@GitSquared
Copy link
Owner

The part of netstat that loops through NICs to try to find the correct one will return the loopback interface if it hasn't found anything better.
If after selecting a network interface, its IP address matches localhost, the code concludes that no externally connected interface was found, and so flags the system as offline.

There should be a tiny text in the top right corner of the netstat module indicating the interface it's trying to monitor. Can you confirm that's the right one?

@presianbg
Copy link
Author

image

wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 5c:5f:67:96:71:9d brd ff:ff:ff:ff:ff:ff
    inet 172.16.16.29/24 brd 172.16.16.255 scope global dynamic noprefixroute wlp1s0
       valid_lft 68942sec preferred_lft 68942sec
    inet6 2001:REDACTED:b8f1/64 scope global dynamic noprefixroute 
       valid_lft 86341sec preferred_lft 14341sec
    inet6 fe80::ab3c:873a:5083:8cd1/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

@GitSquared
Copy link
Owner

Seems like you got multiple addresses linked to that interface, and I'm not quite sure how the JS code is handling that.

Try opening the dev tools in eDEX (Ctrl+Maj+I), clicking on the "console" tab and running this:
window.si.networkInterfaces(d => console.log(JSON.stringify(d, 0, " ")))

Copy/paste the JSON output here please. Also, it would be helpful if you could run it a few times and check if the output is consistent - notably in the ip4/ip6 fields.

@presianbg
Copy link
Author

Hi,

The output is consistent:

[
 {
  "carrierChanges": 0,
  "duplex": "",
  "iface": "lo",
  "ifaceName": "lo",
  "internal": true,
  "ip4": "127.0.0.1",
  "ip6": "::1",
  "mac": "",
  "mtu": 65536,
  "operstate": "unknown",
  "speed": -1,
  "type": "virtual"
 },
 {
  "carrierChanges": 4,
  "duplex": "",
  "iface": "wlp1s0",
  "ifaceName": "wlp1s0",
  "internal": false,
  "ip4": "172.16.16.29",
  "ip6": "2001:REDACTED:b8f1",
  "mac": "REDACTED:96:71:9d",
  "mtu": 1500,
  "operstate": "up",
  "speed": 866.7,
  "type": "wireless"
 }
]

@GitSquared
Copy link
Owner

Okay, all good so far.

Can you give me the output of the following command in eDEX's dev console?

output = {iface: window.mods.netstat.iface, internalIPv4: window.mods.netstat.internalIPv4, externalIPinfo: window.mods.netstat.ipinfo, lastReachFinished: window.mods.netstat.lastconn.finished, lastReachHeader: window.mods.netstat.lastconn._header, offlineVerdict: (window.mods.netstat.offline) ? "offline" : "online"};console.log(JSON.stringify(output, 0, " "));

@presianbg
Copy link
Author

presianbg commented Mar 17, 2019

@GitSquared, thanks for your time and effort for solving this.

It looks right to me, except the "offlineVerdict" value 👎

{
 "iface": "wlp1s0",
 "internalIPv4": "172.16.16.29",
 "externalIPinfo": {
  "geo": {
   "latitude": 42.6833,
   "longitude": 23.3167,
   "metro_code": null,
   "time_zone": "Europe/Sofia"
  },
  "ip": "Public IP REDACTED"
 },
 "lastReachFinished": true,
 "lastReachHeader": "GET / HTTP/1.1\r\nHost: ipinfo.now.sh\r\nConnection: keep-alive\r\n\r\n",
 "offlineVerdict": "offline"
}

@GitSquared
Copy link
Owner

Indeed. I'm going to continue investigating this tomorrow, hopefully i'll have something for you.

@GitSquared
Copy link
Owner

@presianbg Could you try this test version? I'm exactly sure it will fix the problem but doesn't hurt to try.

@presianbg
Copy link
Author

image
Same result + the file system widget is stuck on "Calculating Available Space..."

@GitSquared
Copy link
Owner

Seems like a case of #446 on linux too... Well that one at least will be easy to fix. Gonna have to try something else to fix your original issue though. Hang tight!..

GitSquared added a commit that referenced this issue Mar 22, 2019
@GitSquared
Copy link
Owner

@presianbg How about this one?

@presianbg
Copy link
Author

Works flawlessly :) Thanks!

@GitSquared
Copy link
Owner

Great! So here's what's going on: After the geoip API call, there's another test that tries to determine the latency (ping) of your connection. It's using external software utilities and because of that, doesn't necessarily run on the NIC selected by eDEX.

Your screen probably shows --ms as ping, right? That's why.

In the build I just sent you, I just commented out the line that triggered the offline state when the ping failed. To actually fix the issue, I'm going to look into making the geoip call send back some latency report - not sure how though.

I tried replacing the ping implementation with something that would use Node's built-in networking modules and always work on the right NIC, but using ICMP packets with Node requires root privileges :/

@GitSquared GitSquared added bug bug Confirmed bugs. labels Mar 22, 2019
@presianbg
Copy link
Author

presianbg commented Mar 22, 2019

Your screen probably shows --ms as ping, right?

Yes, this is correct.

You may try using something like that:

 curl -w "dns_resolution: %{time_namelookup}, tcp_established: %{time_connect}, ssl_handshake_done: %{time_appconnect}, TTFB: %{time_starttransfer}\n" -o /dev/null -s "https://gitub.com"

I mean it's not the perfect solution, but it's not mandatory to use ICMP :)

@5hanth
Copy link

5hanth commented Nov 5, 2020

ipinfo.now.sh is no longer working. moved to ipinfo.io

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bugs.
Projects
None yet
Development

No branches or pull requests

3 participants