I have a system with 4G LTE modem.
I am currently using ncm protocol to connect to 4G network.
It works fine.
But sometime for some reason the system present a message log like that
Thu Apr 4 17:45:53 2019 daemon.notice netifd: Interface 'wan_4' has link connectivity loss
Thu Apr 4 17:45:53 2019 daemon.notice netifd: Interface 'wan_6' has link connectivity loss
Thu Apr 4 17:45:53 2019 daemon.notice netifd: wan_4 (5767): udhcpc: received SIGTERM
After this kind of messages, the ip address of the 4G interface disappeared and I have no access to internet. Which is quite normal.
But I am wondering about the fact that netifd is not retring to connect to the 4G network.
I need to do a "ifup ethLTE" to reteive a 4G network connection and obviously an IP address.
Probably it is an issue in my configuration.
I used that one
I thought there was a watchdog or something like that but I could not find it.
Have a look at this thread, I think with some slight customization to your needs it should do the job.
I already use the hotplug functionality to create link but I did not know that it was possible to catch "action".
I am going to make a try.
Thanks for your help
I am using ModemManager, but I have this crude hotplug script that works in most cases. Essentially it parses the modem manager output and takes some action based on the status (ifup/down). You are welcome to adapt it to your purposes if it helps.
Maybe the package mwan3 could be used to monitor and restart the interface.
I saw in the mwantrack script that if a failed connection is detected (failed to ping for example), ifdown is called for the corresponding interface which generates an hotplug event.
So scripts in /etc/hotplug.d/iface are called.
I experimented that the interface is not restarted automatically.
But the hotplug script 16-mwan3-user calls the user script /etc/mwan3.user.
So i modifed this user script to make an ifup on the interface after a disconnect or a ifdown.
cat /etc/mwan3.user
#!/bin/sh
#
# This file is interpreted as shell script.
# Put your custom mwan3 action here, they will
# be executed with each netifd hotplug interface event
# on interfaces for which mwan3 is enabled.
#
# There are three main environment variables that are passed to this script.
#
# $ACTION
# <ifup> Is called by netifd and mwan3track
# <ifdown> Is called by netifd and mwan3track
# <connected> Is only called by mwan3track if tracking was successful
# <disconnected> Is only called by mwan3track if tracking has failed
# $INTERFACE Name of the interface which went up or down (e.g. "wan" or "wwan")
# $DEVICE Physical device name which interface went up or down (e.g. "eth0" or "wwan0")
if [ "$ACTION" == "ifdown" -o "$ACTION" == "disconnected" ]; then
ifup "$INTERFACE"
fi