安裝 ADSL Modem 及啟動後自動連線

作者:Andrew Choi (蔡健發)

Since : 16 Jan 2001

Last Update : 5 Jun 2006


聲明:任何形式的摘抄必須保留上述作者和http地址

  • 我希望 ADSL Modem 在啟動 Solaris 後能夠自動連線,這個工作需要自行處理。Roaring Penguin's PPPoE Software 真是一個不錯的程式,在連線後因意外把 ADSL Modem 關掉、人為把電話線短路或網絡線錯誤地拔掉,在一切正常後 Roaring Penguin's PPPoE Software 會自行再連線。

  • 相關網頁:

    Roaring Penguin's PPPoE Software Version 3.3.1
    http://www.roaringpenguin.com/pppoe ( 下載 )

  • 安裝 Roaring Penguin's PPPoE Software Version 3.3.1

    • 把檔案放在 /usr/local/rp-pppoe-3.3.tar.gz

      # cd /usr/local
      # gzip -d rp-pppoe-3.3.tar.gz
      # tar -vxf rp-pppoe-3.3.tar.gz
      # cd rp-pppoe-3.3
      # cd src
      # ./configure
      # make
      # make install
      # rm /etc/defaultroute
      # adsl-setup

      Welcome to the Roaring Penguin ADSL client setup. First, I will run
      some checks on your system to make sure the PPPoE client is installed
      properly...


      Looks good! Now, please enter some information:

      USER NAME ( 輸入你的 PPPoE 使用者名稱 )

      -n >>> Enter your PPPoE user name (default test@test.gd): andrew@tophk.gd

      INTERFACE ( 那張網卡 Device 連接到 ADSL Modem )


      >>> Enter the Ethernet interface connected to the ADSL modem
      For Solaris, this is likely to be something like /dev/hme0.
      For Linux, it will be ethn, where 'n' is a number.
      -n (default /dev/elxl0): /dev/elxl1 ( 因為我有兩張網卡,elxl0留作 Local Network 用,elxl1用作 ADSL Modem 連線)


      Do you want the link to come up on demand, or stay up continuously?
      If you want it to come up on demand, enter the idle time in seconds
      after which the link should be dropped. If you want the link to
      stay up permanently, enter 'no' (two letters, lower-case.)
      NOTE: Demand-activated links do not interact well with dynamic IP
      addresses. You may have some problems with demand-activated links.
      -n >>> Enter the demand value (default no): no

      DNS


      Please enter the IP address of your ISP's primary DNS server.
      If your ISP claims that 'the server will provide DNS addresses',
      enter 'server' (all lower-case) here.
      If you just press enter, I will assume you know what you are
      doing and not modify your DNS setup.
      -n >>> Enter the DNS information here: server ( 如果你已經在 /etc/resolv.conf 設定好 DNS Server,只要按Enter便可以,否則,輸入 server [英文小楷] 或自行輸入 DNS Server IP address )

      PASSWORD

-n >>> Please enter your PPPoE password: ( 輸入密碼 )

-n >>> Please re-enter your PPPoE password: ( 再輸入密碼 )


FIREWALLING

Sorry, firewalling is only supported under Linux. Consult
your operating system manuals for details on setting up
packet filters for your system.

** Summary of what you entered **

Ethernet Interface: /dev/elxl1
User name: andrew@tophk.gd
Activate-on-demand: No
DNS addresses: Supplied by ISP's server
Firewalling: NONE

-n >>> Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/resolv.conf
(But first backing it up to /etc/resolv.conf-bak)
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
(But first backing it up to /etc/ppp/pap-secrets-bak)
(But first backing it up to /etc/ppp/chap-secrets-bak)

 

Congratulations, it should be all set up!

Type 'adsl-start' to bring up your ADSL link and 'adsl-stop' to bring
it down. Type 'adsl-status' to see the link status.

# adsl-start ADSL Modem 上網

# adsl-stop ADSL Modem 離線

  • 設定 ADSL ModemSolaris 啟動後自動連線

    把已下 Script 寫入 /etc/init.d/pppoe /etc/rc2.d/S47pppoe
    Solaris 啟動後ADSL Modem便會自動連線

    #!/sbin/sh
    #
    #ADSL Modem Startup Script By Andrew Choi
    #

    PATH=/sbin:/usr/bin:/usr/sbin; export PATH
    PPPDIR=/etc/ppp; export PPPDIR

    case "$1" in
    'start')
    echo "ADSL Modem Starting...."
    /usr/sbin/adsl-start
    ;;

    'stop')
    echo "ADSL Modem Offine now....."

    /usr/bin/pkill -x pppd
    sleep 1
    /usr/bin/pkill -x pppoed


    # Use ifconfig to make the interfaces down just in case
    if [ -f $PPPDIR/ifconfig ]; then
    nawk '/ifconfig[ ]*sppp/ { \
    system("ifconfig " $2 " down"); \
    system("ifconfig " $2 " unplumb"); \
    next; \
    } \
    /ifconfig/ { \
    $3 = "removeif"; \
    NF = 4; \
    system($0); \
    }' < $PPPDIR/ifconfig
    fi

    if [ -x /usr/sbin/sppptun -a -f $PPPDIR/pppoe.if ]; then
    sed -e 's/^#.*//;s/\([^\\]\)#.*/\1/;s/[ ]*$//;s/^[ ]*//' \
    $PPPDIR/pppoe.if | \
    while read intf; do
    if [ "$intf" ]; then
    /usr/sbin/sppptun unplumb ${intf}:pppoe
    /usr/sbin/sppptun unplumb ${intf}:pppoed
    fi
    done
    fi
    ;;

    *)
    echo "Usage: $0 { start | stop }"
    exit 1
    ;;
    esac
    exit 0



E-mail : andrew@tophk.net