Hi, I’m trying to figure out how to establish a connection to a local ethernet device. A separate ethernet interface is being used to connect to the resin-vpn. I’m using Resin OS 2.2.0+rev1.dev with an Intel NUC.
I am trying to access data from a LiDAR sensor, and this data is sent over ethernet. Inside the container I have created a network interface in the /etc/network/interfaces file, and set up a udev rule. I’m able to successfully bring up the interface using ifup lidar0
, the connection has an IP address associated with it in the ifconfig
output, and I am able to communicate with the device. However, shortly after the lidar0
interface is brought up, the IP address disappears and I’m not able to communicate with the device.
# New interface in /etc/network/interfaces
auto lidar0
iface lidar0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 0.0.0.0
# udev rule
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="asix", NAME="lidar0"
My theory is that somehow NetworkManager is resetting the interface connection, but I’m having difficulty debugging what NetworkManager is doing.
I’ve also tried adding a file in the ResinOS /flash-boot/system-connections/ folder to set up a static IP for the LiDAR connection, but I didn’t have any success with that either.
Can someone point me in the right direction or suggest any NetworkManager debugging tips? I have tried using nmcli
while SSHing into the host OS but I was getting an “Could not create NMClient object: Could not connect: No such file or directory” when running nmcli
.
Hi,
I think your suspicions are probably correct that NetworkManager is trying to take over managing the interface. If you run journalctl -f -u NetworkManager
while the problem happens it may be possible to confirm this.
It should be possible to write a simple NetworkManager connection file that does what you need however. Could you post the file you used?
Thanks, I’ll take a look at the journalctl
command and see if that helps with debugging. And this is the connection file that I’m currently using:
[connection]
id=lidar
type=ethernet
autoconnect=true
interface-name=enp0s20f0u2u4
permissions=
secondaries=
[ipv4]
never-default=true
route-metric=2000
address1=192.168.192.83/24,192.168.192.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=manual
When I start the container I see that the enp0s20f0u2u4
interface exists but it doesn’t have an IP address associated with it.
At first glance that all looks reasonable. Again it would be interesting to see the NetworkManager logs when trying this approach to see if it is picking up the file correctly.
It doesn’t look like systemd-journal
is started when the container is launched, but I found out that I can launch it by running
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket;
/usr/lib/systemd/systemd-journald
and then in another terminal I can view the output. I’m not seeing any logs from NetworkManager though. This is my output when I run journalctl -f
, while I’m bringing the lidar0 connection up and then waiting for the connection to be closed. There aren’t any logs that appear when the lidar connection is closed.
Oct 04 16:57:44 bf2f739 kernel: asix 1-2.4:1.0 lidar0: link up, 100Mbps, full-duplex, lpa 0x41E1
Running journalctl -u NetworkManager
results in “-- No entries --”.
Does it look like I’m running journald
wrong?
Hi,
You should be able to use nmcli
and journalctl -fn 100 -u NetworkManager
from the Host OS (not from your application container) to debug. The easiest way to do this is to grab a .dev
image and ssh into the host using resin local ssh --host
I agree it sounds like NetworkManager is interfering with the interface, to prevent this you need to edit /etc/NetworkManager/NetworkManager.conf
in the host, adding the following lines and replacing xx:xx:xx:xx:xx:xx
with MAC of your sensor.
[main]
plugins=keyfile
[keyfile]
unmanaged-devices=mac:xx:xx:xx:xx:xx:xx
Oh cool that worked! Thank you for the instructions on how to get into the Host OS. Previously I thought I was in the Host OS but I was actually ssh’ing into the resin supervisor. I was able to debug a few issues with my NetworkManager connection files using journalctl
and that cleared up my problems.
The solution to my problem was to create a NetworkManager connection file that would handle the lidar0
interface, and then to create udev rules in the container that will assign my devices to the lidar0
interface. This way NetworkManager handles the connection automatically.
# Network Connection File
[connection]
id=lidar-connection
type=ethernet
autoconnect=true
interface-name=lidar0
permissions=
secondaries=
[ipv4]
never-default=true
route-metric=2000
address1=192.168.192.83/24,192.168.192.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
# udev rule in the container at /etc/udev/rules.d/50-lidar.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="asix", NAME="lidar0"
Thank you willn and joe for your help! It’s much appreciated.
3 Likes