Network connection rmnet0 and /etc/network/if-up.d


#1

Hiya,

I need to have something happen when the FX30 connects to the cellular data network (i.e. when interface rmnet0 comes up).

I can see the network comes up correctly (ifconfig shows that rmnet0 is present and has ip address etc), but none of my scripts in /etc/network/if-up.d/ are run. They don’t appear to be run when eth0 comes and goes either.

The scripts are OK, as if I manually do ifup eth0 (for example), I see that a log message is inserted into the logger indicating that my script has run.

Can anyone explain why these scripts are not being run, and even better, how to make a script run when an network interface comes and goes?

Thanks, Dave


#2

Hi Dave,

I guess “rmnet0” is not managed by networking (/etc/network/interface) so those script is not called.

Instead, I would use Legato API callback to keep track the data connection state to trigger the action/script, i.e. le_data_AddConnectionStateHandler() or le_mdc_AddSessionStateHandler().
Similar to “cm data watch” tool.

Thx