# ISP specific settings USER='username@isp.domain.name' PASS='isp-password' PROTO="pppoa" # or "pppoe", but "pppoa" seems more reliable ENCAPS="vc" # or "llc" VPI=8 # Australian defaults are 8, 35 VCI=35 # Configure network type uci set network.wan=interface uci set network.wan.ifname=nas0 uci set network.wan.proto=$PROTO uci set network.wan.encaps=$ENC uci set network.wan.vpi=$VPI uci set network.wan.vci=$VCI uci set network.wan.username=$USER uci set network.wan.keepalive=5,20 # Detect dead link uci commit network # Set up PPP password files echo "\"$USER\" \"*\" \"$PASS\" \"*\"" > /etc/ppp/chap-secrets chmod 600 /etc/ppp/chap-secrets ln -sf chap-secrets /etc/ppp/pap-secrets unset USER unset PASS # Fix miniupnpd mapping when PPPoE is in use sed -i -e 's@^EXTIF=.*$@EXTIF=$(tail -n1 /var/run/ppp-wan.pid 2>/dev/null) ; EXTIF=${EXTIF:-$(uci get network.wan.ifname)}@' /usr/bin/iptables_init.sh # Set up a process to monitor the ADSL and ensure PPP stays up sed -i -e '/ppp-watch$/d' /etc/inittab cat << EOM > /etc/ppp-watch #!/bin/sh while [ 1 ] do MODEM_STATUS=\$(cat /proc/avalanche/avsar_modem_training 2> /dev/null | head -n1) if [ "x\$MODEM_STATUS" != "xSHOWTIME" ]; then sleep 2 continue fi if ! kill -0 \`head -n1 /var/run/ppp-wan.pid 2>/dev/null\` 2> /dev/null then ifup wan fi sleep 120 done EOM chmod 755 /etc/ppp-watch echo "::respawn:/etc/ppp-watch" >> /etc/inittab