This setup is very similar to the dialup on demand router setup, but you may need to edit file /rc/rc_lease according your specific conditions.
#!/bin/sh
#
# Start leased line router (gateway - MODEM0)
. /etc/system.cfg
. /etc/live.cfg
. /etc/chat.pwd
if [ "$1" = stop -o "$1" = restart ]; then
echo -n "Stopping pppd... "
killall pppd
$DONE
[ "$1" = stop ] && exit
fi
[ "$MTU0" ] && MTU="mtu $MTU0"
[ "$MRU0" ] && MRU="mru $MRU0"
[ "$LOCAL$REMOTE" ] && LOCAL="$LOCAL:$REMOTE"
if [ "$ADRTYPE" = dynamic ]; then
NOIP=noipdefault
fi
echo -n "Starting pppd... "
pppd /dev/$MODEM0 $MSPEED0 crtscts modem defaultroute $MTU $MRU $NOIP \
passive $LOCAL persist -pap -chap
if [ $? = 0 ]; then
$DONE
[ "$GATEWAY" ] && route add default gw $GATEWAY
[ "$DYNNAME" ] && dyndns
fi