i have a d-link dwr-921 lte router running openwrt 18.06.4
the router frequently loses its internet connection, then i mostly have to reboot, connect the router to a computer via network cable and run the commands
# ssh root@192.168.1.1 and
# ifup wwan
manually to bring the router back online.
i am wondering if its possible to automate this, so the router automatically issues the "ifup wwan" command while booting or after booting (so i only have to reboot the router when it loses its internet connection, with no need to go to the command line in addition).
my knowledge about linux is limited, but i suppose this should be done by a boot script, right? unfortunately, i have no experience with writing scripts :-/
what do you think? what would be the best way to set up openwrt to run the "ifup wwan" command automatically at boot?
There is an option in the interface settings to bring it up on boot.
For anything else there is rc.local
root@koutsomoura:~# cat /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
exit 0
You should not need to reboot the device, and you should not need to bring the interface up manually. Post your config files here, perhaps there is something weird there.
thank you. by "option in the interface settings" you mean the bottom section in system -> startup in luci, right?
so it should look like this?
exit 0 ifup wwan
thank you. i somehow got used to the thought that i have to reboot it to make the commands work, but maybe it was not necessary.
today i tried it and they worked without a reboot. so it looks like i have gotten that wrong.
are you sure that it is not normal that i have to bring up the wwan interface manually? the documentation sounds like this is normal, unless i'm misunderstanding it: https://openwrt.org/toh/d-link/d-link_dwr-921#g3g_modem
Another thing to consider is that many wireless modems fail to notify upper layers that the connection to the provider is down, so that the OS doesn't "know" that it needs to initiate reconnection. One page that discusses this is http://www.embeddedpi.com/documentation/3g-4g-modems/raspberry-pi-sierra-wireless-mc7304-modem-qmi-interface-setup I don't think the scripts there are generally useful for OpenWrt as they require Perl (which is for all-in-one routers, huge), but perhaps worth seeing if the interface is actually marked as "DOWN" (using, for example, ip link) when you lose connectivity.
I haven't written a "router friendly" version of the script myself, but understanding the source of the problem can help determine a resolution better than the sledgehammer of "reboot".
i'm encountering a problem when trying to do that. there is no "advanced settings" tab and it just reads:
there is no device assigned yet, please attach a network device in the "physical settings" tab
however, i have a working internet connection right now.
here are two screenshots (i have removed details like ip-addresses):
it would have been my next step to change it to '1'...but right now (after noticing that wwan is shown as not connected though it apparently should be) i'm fearing that there may be a basic problem with my configuration of network interfaces.
i suppose as long as i'm not sure about that, i shouldn't make any changes.
what do you say to the screenshots and the terminal output i posted? is it normal that wwan interface is shown as not connected?
so to change the value, is it correct to run the following commands?
uci set network.wwan.auto='1'
service network reload
or is there a better way? e.g. editing the /etc/config/network file?
i still don't know if it is normal that the wwan interface is shown as not connected (see the screenshots i posted), but maybe this will change when i set the value to '1'
okay, it works now. i don't have to run the ifup wwan command manually anymore. thank you and everybody else
in luci, i now have the option to click on "restart" in the wwan section. however:
protocol is still shown as "unmanaged"
when i click "edit", it is the same as in the first screenshot i posted ("there is no device assigned yet...", protocol is shown as "static address")
the wwan_4 section is like in the second screenshot i posted (protocol "virtual dynamic interface (dhcp client)" with no option to click on restart, stop, edit or delete)