Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
3.67k stars 511 forks source link

Network adapters without IP addresses are not included in networking list #6183

Closed Nick2253 closed 2 weeks ago

Nick2253 commented 2 weeks ago

Describe the bug I have a server with a network adapter used only for WoL, and to avoid conflict with its primary 10Gbps network adapter, this WoL adapter does not get an IP address (in Windows, the adapter is enabled, but does not use any of the components).

In MeshCentral, when I view the "Details" page for this machine, it does not list the WoL adapter in the "Networking" section.

This is a problem, because when I use Action-->Wake, no packet is sent to the WoL adapter, and therefore the machine does not wake up.

To Reproduce Steps to reproduce the behavior:

  1. Configure a Windows Machine with MeshCentral Agent.
  2. Install a network adapter that supports WoL on this Windows machine, and disable all components for that adapter.
  3. View Details for this machine in MeshCentral. Note that the new network adapter does not show up in the "Networking" section.
  4. Put the machine to sleep. Attempt to wake the machine using Action-->Wake, and observe that the machine does not wake.
  5. Send a wake packet to this new adapter, and observe the machine wakes correctly.

Expected behavior All adapters will show correctly in the Networking section, and all adapters will be used to attempt to wake the machine.

Screenshots In these screenshots, observe that "Ethernet 4" is not shown in MeshCentral:

image image

Server Software (please complete the following information):

Client Device (please complete the following information):

Remote Device (please complete the following information):

Additional context I'm successfully able to wake other systems through MeshCentral, but not this particular system due to its unique network adapter setup.

My current work-around for this is to manually send the WoL packet from a different machine that is also local, but I'd much rather be able to do it directly through the MeshCentral webui.

si458 commented 2 weeks ago

If u go into the device, then console tab.

What's the output of running netinfo (can u share) ?

Does it include ur missing network device?

Nick2253 commented 2 weeks ago

No, it doesn't include that device.

> netinfo
{
  Ethernet 2: {
    0: {
      address: "xxx"
      gateway: "xxx"
      fqdn: ""
      family: "IPv6"
      mac: "xxx"
      index: 10
      status: "up"
      type: "ethernet"
    }
    1: {
      address: "xxx"
      gateway: "xxx"
      fqdn: ""
      family: "IPv6"
      mac: "xxx"
      index: 10
      status: "up"
      type: "ethernet"
    }
    2: {
      address: "xxx"
      gateway: "xxx"
      fqdn: ""
      family: "IPv6"
      mac: "xxx"
      index: 10
      status: "up"
      type: "ethernet"
    }
    3: {
      address: "xxx"
      gateway: "xxx"
      fqdn: ""
      family: "IPv6"
      mac: "xxx"
      index: 10
      status: "up"
      type: "ethernet"
    }
    4: {
      address: "xxx"
      fqdn: ""
      family: "IPv4"
      netmask: "255.255.255.0"
      mac: "xxx"
      index: 10
      status: "up"
      type: "ethernet"
    }
  }
  Ethernet 3: {
    0: {
      address: "xxx"
      fqdn: ""
      family: "IPv6"
      mac: "xxx"
      index: 3
      status: "up"
      type: "ethernet"
    }
    1: {
      address: "xxx"
      fqdn: ""
      family: "IPv4"
      netmask: "255.255.255.0"
      mac: "xxx"
      index: 3
      status: "up"
      type: "ethernet"
    }
  }
  Loopback Pseudo-Interface 1: {
    0: {
      address: "::1"
      fqdn: ""
      family: "IPv6"
      mac: "00:00:00:00:00:00"
      index: 1
      status: "up"
      type: "loopback"
    }
    1: {
      address: "127.0.0.1"
      fqdn: ""
      family: "IPv4"
      netmask: "255.0.0.0"
      mac: "00:00:00:00:00:00"
      index: 1
      status: "up"
      type: "loopback"
    }
  }
  vEthernet (WSL): {
    0: {
      address: "xxx"
      fqdn: ""
      family: "IPv6"
      mac: "xxx"
      index: 34
      status: "up"
      type: "ethernet"
    }
    1: {
      address: "xxx"
      fqdn: ""
      family: "IPv4"
      netmask: "255.255.240.0"
      mac: "xxx"
      index: 34
      status: "up"
      type: "ethernet"
    }
  }
}
si458 commented 2 weeks ago

You say u have 'disabled all components for that interface' can u share screenshot?

What happens if u enable the IP component for the interface but leave it without an ip address then restart meshagent, does the interface appear?

I have a feeling we look for devices that have the IP component enabled, as I have interfaces with no ip addresses that show no problem?

Nick2253 commented 2 weeks ago

You say u have 'disabled all components for that interface' can u share screenshot? All the boxes are unchecked image

What happens if u enable the IP component for the interface but leave it without an ip address then restart meshagent, does the interface appear?

You can't simply re-enable the interface without an IP address. It will attempt DHCP to get an IP address unless a static IP is configured (and since I have DHCP on that network, that's a no-go). However, I put a static link-local IP address on the interface, and I was able to see that interface using netinfo from the console.

snip:

  Ethernet 4: {
    0: {
      address: "169.254.20.30"
      fqdn: ""
      family: "IPv4"
      netmask: "255.255.0.0"
      mac: "xxx"
      index: 5
      status: "up"
      type: "ethernet"
    }
  }

After restarting the Mesh Agent, then it populates the info for Ethernet 4 in the Details screen.

I can't put it to sleep right now (it's currently processing), but I should be able to sleep it sometime in the next hour.

si458 commented 2 weeks ago

Right that's OK! Thank you! I will check the code 2moz. as I said I think it checks for the IP component being enabled and because it was disabled it doesn't find it!

Nick2253 commented 2 weeks ago

It's a kludge, but it worked!

I'm going to close this because I can't imagine that this is really a bug for anyone but a very small minority who use 10Gbps network adapters that don't support WoL and want to actually use WoL.

Thank you for your awesome responsiveness! I've opened far more legitimate bug reports on many different projects, and it's usually weeks to months before anyone responds. The fact that we identified the problem and had a simple work-around in a few hours is nothing short of incredible!

si458 commented 2 weeks ago

OK no worries! I will still check the code tomorrow anyways just in case it is infact ignoring interfaces without ip addresses!?

si458 commented 2 weeks ago

Just had a quick night-time google. We mimic the nodejs functions but in C with the meshagent https://nodejs.org/docs/latest-v18.x/api/os.html#osnetworkinterfaces And the raw nodejs function only return interfaces with IP addresses, so I'm guessing it's only interfaces with the IP component enabled!