gnmyt / myspeed

A speed test analysis software that shows your internet speed for up to 30 days
https://myspeed.dev
MIT License
694 stars 32 forks source link

[Bug] Interface eth0 not found. Falling back to default. #806

Open Snake16547 opened 2 months ago

Snake16547 commented 2 months ago

General

The Bug

Working with myspeed with an Raspberry Pi 4 + Dockge and for a couple weeks it worked flawless and suddenly stopped with following error message:

Interface eth0 not found. Falling back to default.

Working with following compose setup:

services:
  myspeed:
    ports:
      - 5216:5216
    volumes:
      - myspeed:/myspeed/data
    restart: unless-stopped
    container_name: MySpeed
    image: germannewsmaker/myspeed
volumes:
  myspeed: {}
networks:
  dockge_default:
    external: true

What device are you using to access the page?

In the browser

Which operating system is your MySpeed instance running on?

Linux

towermom9 commented 1 month ago

same problem here, use casa os. breaks after full os restart

jason4bury commented 1 month ago

Same problem here when running in Arch.

It looks like myspeed is looking for eth0 but as my interface is enp1s0 myspeed will not connect.

Is this correct?

NorthernScott commented 1 month ago

Same issue.

NorthernScott commented 4 weeks ago

I believe that the issue is found in server/util/loadInterfaces.js but I'm not sure why. Apologies, I am not a JS dev and not familiar with node. However, I can see that it is using the os.networkInterfaces() method to get an array of available interfaces. If I exec into my container, start the node interpreter, and execute something like i = os.networkInterfaces(), I get the following output:

> i = os.networkInterfaces()
{
  lo: [
    {
      address: '127.0.0.1',
      netmask: '255.0.0.0',
      family: 'IPv4',
      mac: '00:00:00:00:00:00',
      internal: true,
      cidr: '127.0.0.1/8'
    },
    {
      address: '::1',
      netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      internal: true,
      cidr: '::1/128',
      scopeid: 0
    }
  ],
  eth0: [
    {
      address: '172.100.0.3',
      netmask: '255.255.255.0',
      family: 'IPv4',
      mac: 'bc:24:11:ec:f1:3a',
      internal: false,
      cidr: '172.100.0.3/24'
    }
  ]
}

As you can see, the first object has two child objects which are the local loopback interfaces, but the second object is the eth0 interface showing the correct ip address for the container.

I can see that the function skips over any interfaces marked as "internal," and so it should ignore those first two and proceed on to the eth0 interface, but for some reason it's bailing out of the loop and "falling back to the default." Apologies again, I get a bit lost in the code at this point and I'm not sure what it's trying to use as the default.

As a point of comparison, this issue is only occuring when I bootstrap a container using docker compose. I tried installing it using the install script and it builds the container on the same host and works just fine. Unfortunately, I want to use Docker Compose so that the container is attached to my Portainer stack and is assigned the correct IP address.

For reference, here are the relevant bits of my compose:

  myspeed:
    image: germannewsmaker/myspeed:latest
    restart: unless-stopped
    container_name: myspeed
    hostname: myspeed
    privileged: false
    ports:
      - 5216:5216
    volumes:
      - myspeed:/myspeed/data
    networks:
      tradewinds:
        ipv4_address: 172.100.0.3

networks:
  tradewinds:
    name: tradewinds
    attachable: true
    driver: ipvlan
    driver_opts:
      parent: eth0
      ipvlan_mode: l3
      ipvlan_flag: bridge
    ipam:
      config:
        - subnet: 172.100.0.0/24
          gateway: 172.100.0.1
          ip_range: 172.100.0.0/24

Hoping that this helps.