2nd dropbear instance not started on startup

I have 2 instances of drop bear configured. One listens in the lan and the other one in the wan. However, on startup only the instance listening on the lan seems to be up and running. The instance listening on the wan has not been started. When I use “netstat” to check what’s listening on port 22 for both lan/wan and I can only see port 22 accepting connections on the lan. No trace of a listening port 22 on the wan. I have to go and restart dropbear (etc/init.d/dropbear restart) to get the issue solved.

Any ideas?

root@GL-AR300M# cat /etc/config/dropbear

config dropbear
option Port ‘22’
option GatewayPorts ‘on’
option PasswordAuth ‘on’
option Interface ‘lan’

config dropbear
option Port ‘22’
option Interface ‘wan’
option PasswordAuth ‘on’

Found a solution.

https://wiki.openwrt.org/doc/uci/dropbear

If you try to run multiple dropbear instances and they are not started you probably have a timing issue. To fix the timing issue just create a small hotplug script in /etc/hotplug.d/iface/40-dropbear that simply restarts dropbear after the WAN interface is restarted.

/etc/hotplug.d/iface/40-dropbear

#!/bin/sh

if [ “$INTERFACE” = “wan” ] && [ “$ACTION” = “ifup” -o “$ACTION” == “ifupdate” ]
then
/etc/init.d/dropbear restart
fi

thanks for sharing. Has to check network status before running the service.