Network Manager Dispatcher scripts

TL;DR How do I set up “pre-up” for an interface that is managed by the Resin OS Network Manager when I set the interface via dbus to method=manual (static)?

Hello, I’m researching how to use the Network Manager that runs in Resin OS and figured out how to set an interface to manual configuration via a dbus invocation from within my application. I started with the docs [1], and then made some tweaks to create my own Python program. The documentation elsewhere on the Internet is sparse, to say the least. I’ve read another forum post about setting an interface to manual [2]. As it were, I started by updating an existing connection on the interface from the start and didn’t have the issue described in the post: the interface almost immediately gets the static IP I request.

Now, what I can’t figure out how to do is to have Network Manager in the host OS run dispatcher scripts for my interface set up by my container. I can assign it a static IP but I need to set up some extra stuff on pre-up. How do I do this in my Resin application? I’ve tried using the legacy /etc/network/if-pre-up.d/ and /etc/NetworkManager/dispatcher.d/pre-up.d described here [3] without luck. My environment details are here [4].

Any pointers would be greatly appreciated.

[2] Static IP configured via app
[4] Resin OS 2.0.9+rev1 (prod), Supervisor 5.1.0

What sort of extra stuff do you need to set on pre-up? Can you give us a bit more context or examples? :fountain_pen:

What seems difficult, is that NetworkManager is controlled from the user container over dbus messaging, so whatever scripts the dispatcher would refer to in the host OS, it wouldn’t be available in the host… Was wondering if all the things that needed to be set up could be done on the user container side with dbus messaging?

Thank you for the reply. I have a 2-nic device, so I’m setting up routing rules in iptables. I could probably do it in my entrypoint script, which I’ll give a try. I have a prototype working already to suit my needs, so I’m most of the way there. Having the NICs controlled via Network Manager seemed to be the best practice.

1 Like

Keep us posted how it goes! :slight_smile:

Setting things up inside your application is probably the best currently, as it’s not necessarily true that you’ll have all the required tools in the host OS (e.g. you might not have iptables available in the host) anyways.

We are working on a much more flexible approach to setting up applications, where all this will likely be even simpler, while in the meantime this is probably workable, as you mentioned.

One thing to note, though. Managing networking through the user application can be dangerous from the sense, that as long as the device is online, it can be fixed remotely if anything goes wrong, but if networking goes wrong, might need physical access. Just a note, to be completely clear of the limitations of remote management of devices.

Got it, thanks. My goal is to be able to accomplish the routing but not break the resin-vpn connection. I’ll let you know what comes of it.

1 Like