PPP Transport Switcher

If you would like to be able to switch back and forth between PPPoE and dialup as your transport modes, install the two startup scripts (adsl or pppoe and diald) in /etc/rc.d/init.d but do not enable them (via chkconfig). Copy the script that you are likely to use the most (or wish to use the first time) to /etc/rc.d./init.d/ppptransport and then do the following:

     chkconfig --add ppptransport
     chkconfig ppptransport on

/etc/ppp/switch-ppp:

Create this script to switch between the ADSL and PPP transport modes:

     #! /bin/sh
     # Script to switch PPP to dialup or adsl.
     #
     # Select the transport method that the user wanted.
     #
     case "$1" in
         #
         # If the caller picked dialup, set up diald as the outbound ppp transport
         # method.
         #
         dialup)
             #
             # Stop whatever PPP transport is currently running.
             #
             if [ -f /etc/rc.d/init.d/ppptransport ]; then
                 /etc/rc.d/init.d/ppptransport stop
             fi
             #
             # Switch the transport method to use diald and the modem.
             #
             cp /etc/rc.d/init.d/dialdaemon /etc/rc.d/init.d/ppptransport
          rm -f /etc/ppp/options
          cp /etc/ppp/options-diald /etc/ppp/options
          rm -f /etc/ppp/ip-up.local
          echo "PPP transport switched to dialup."
          #
          # Start the new transport method.
          #
          /etc/rc.d/init.d/ppptransport start
          ;;
      #
      # If the caller picked adsl, set up adsl as the outbound ppp transport
      # method.
      #
      adsl)
          #
          # Stop whatever PPP transport is currently running.
          #
          if [ -f /etc/rc.d/init.d/ppptransport ]; then
              /etc/rc.d/init.d/ppptransport stop
          fi
          #
          # Switch the transport method to use adsl and pppoe.
          #
          cp /etc/rc.d/init.d/adsl /etc/rc.d/init.d/ppptransport
          echo "" > /etc/ppp/options
          rm -f /etc/ppp/ip-up.local
          cp /etc/ppp/ip-up-adsl /etc/ppp/ip-up.local
          echo "PPP transport switched to adsl."
          #
          # Start the new transport method.
          #
          /etc/rc.d/init.d/ppptransport start
          ;;
      #
      # For all other cases, give help.
      #
      *)
          echo "Usage: /etc/ppp/switch-ppp {dialup|adsl}"
          exit 1
          ;;

esac

     exit 0