CentOS 6 版本起,ADSL 撥號工具從傳統的 adsl-setup 改為 rp-pppoe 套件。本文記錄從安裝套件、掛載光碟到完成撥號配置的完整流程,適合需要在無網路環境下透過安裝光碟離線部署的場景。
# mount /dev/cdrom /media
# find /media -name 'rp-pppoe*'
# rpm -ivh /media/CentOS_6.0_Final/Packages/rp-pppoe-3.10-8.el6.i686.rpm
安裝完成後執行 # pppoe-setup 進入配置精靈,以下為關鍵步驟說明:
Please enter the device if you want to configure the present DSL config (default ppp0) or enter 'n' if you want to create a new one: ppp0
直接按 Enter 採用預設 ppp0。
Enter your Login Name (default root): 輸入 ISP 提供的 ADSL 帳號(中華電信通常以 ad 開頭)
Enter the Ethernet interface connected to the PPPoE modem (default eth0): eth0
單網卡環境通常為 eth0,多網卡請依實際情況選擇。
Do you want the link to come up on demand, or stay up continuously? Enter the demand value (default no): 直接按 Enter(選 no)
選 no 代表持續保持連線,適合伺服器或長期在線需求。
Enter the DNS information here: 202.96.209.5 # 主 DNS(以電信為例) Enter the secondary DNS server address here: 202.96.209.133 # 備 DNS
注意:若選擇 server 由 ISP 動態分配,某些情況下會導致解析失敗,建議手動填入穩定的 DNS。
Please enter your Password: 輸入 ADSL 密碼 Please re-enter your Password: 再次確認密碼
Please enter 'yes' if you want to allow normal user to start or stop DSL connection (default yes): no
建議輸入 no,僅允許 root 控制撥號,提升安全性。
Choose a type of firewall (0-2): 0
0 NONE:不設定防火牆規則(若跑服務請選此項,自行配置 iptables)1 STANDALONE:適合單機上網2 MASQUERADE:適合作為區域網路閘道Do you want to start this connection at boot time? (default no): yes
Accept these settings and adjust configuration files (y/n)? y
# pppoe-start # 啟動 ADSL 連線 # pppoe-status # 查看連線狀態
若顯示 Connected! 並顯示 IP 位址,即代表撥號成功。
/etc/resolv.conf 是否正確寫入 DNSip link 查看)完成上述步驟,CentOS 6 即可穩定透過 ADSL 上網。若為虛擬機環境,建議改用 NAT 或橋接模式直接共享宿主機網路,較為簡便。