設定 ADSL

Loading

設定 ADSL
Cent OS 提供了一套 adsl 相關的指令,其中的 adsl-setup 就是使用 PPPoE 撥接的方式來取得 IP,不過電信系統業者提供了兩種方式來提供 IP,第一是非固定制客戶也就是 IP 的內容是隨意給的,每一次重新開機後都不會一樣,另外一種就是固定 IP ,如果我們要架站的話就是要使用這一種方式.
這裏使用中華電信的HiNET ADSL為範例.

[root@benjr ~]# adsl-setup
Welcome to the ADSL client setup. First, I will run some checks on
your system to make sure the PPPoE client is installed properly…
LOGIN NAME
Enter your Login Name (default root): 123456@ip.hinet.net

這裡請依你的真實 HiNET 給你的帳號輸入.重點在這裡:依據 HiNET 的定義,如果你要使用固定 IP 那 @ 後面要用 ip.hinet.net,如果是用 HiNet ADSL非固定制客戶那要用 123456@hinet.net hinet.net前面就不需要 ip. 了

INTERFACE 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 ethX, where 'X' is a number.
(default eth0): eth0

PPPoE 是透過 Ethernet 網卡再出去的方式所以他會問你要指定哪一張網卡當作你撥接介面.通常我們也只有一張網卡所以是 eth0,如果你有兩張網卡那就可以指定 eth1,以此推 eth0-第一張網卡,eth1-第二張網卡.

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.
Enter the demand value (default no): yes

這邊是問妳,你的網路是不是要在一定的時間之後就斷線,我們要架站當然是希望網路是一直通的,所以選 “yes”.

DNS Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic 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.
Enter the DNS information here: 168.95.192.1

這裡是要填入電信業者提供的 DNS IP ,DNS是將網路名稱轉成實際 IP 的服務,如 www.yahoo.com.tw 的實際 IP 為202.43.195.13,請依據你實際系統業者給你的 IP,這邊的 IP 是由 HiNET 所提供的位址.

Please enter the IP address of your ISP's secondary DNS server.
If you just press enter, I will assume there is only one DNS server.
Enter the secondary DNS server address here: 168.95.1.1

通常 DNS 會有兩台以免其中一台掛了,就無法正常上網了.

PASSWORD Please enter your Password

密碼輸入時不會看到任何提示符號請小心鍵入,這是電信系統業者提供給你的密碼,不是你作業系統的密碼.

Please re-enter your Password:

第二次只是要確定你剛剛輸入沒有因為一時錯誤到時造成無法連線的窘境.

USERCTRL
Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): no

恩!!要不要讓一般使用者可以開啟或關閉連線,我想沒有必要讓一般使用者來設定網路連線.通常不需要將其他服務開放給使用者.

FIREWALLING
Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port. 
The firewall choices are:
0 – NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 – STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 – MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
Choose a type of firewall (0-2): 0

這邊可以幫我們設定防火牆或者是順便把這一台電腦當成 IP 分享器(其他電腦可以經由這一台電腦上 Internet 不需要再透過 PPPoE).因為後面還會再談到 iptables(IP防火牆),所以這裡我們就不需要在這裡設定所以選 “0”

Start this connection at boot time Do you want to start this connection at boot time?
Please enter no or yes (default no): yes

一開機就連線,這當然是最好的 .

** Summary of what you entered ** Ethernet Interface: eth0
User name: 123456@ip.hinet.net
Activate-on-demand: Yes; idle timeout = yes seconds
Primary DNS: 168.95.192.1
Secondary DNS: 168.95.1.1
Firewalling: NONE
User Control: yes
Accept these settings and adjust configuration files (y/n)? y

檢查一下看看剛剛設定是不是符合我們的要求.沒錯的話那就按一下 “y”

Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0

PPPoE設定檔的位置.

Adjusting /etc/resolv.conf

DNS設定檔就是這一個.

(But first backing it up to /etc/resolv.conf.bak)
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets

chap-secrets/pap-secrets 主要是存放你的帳號和密碼,不過很討厭的是他都是用明碼的方式存放. Chap-secrets.bak/pap-secrets.bak 則是備份檔,如果你之前有設定過 pppoe,那原先的 chap-secrets/pap-secrets 就變成了 chap-secrets.bak/pap-secrets.bak.
註:PAP/CHAP為兩種不同的密碼驗證方式,PAP(Password Authentication Protocol) 使用明碼驗證 ,CHAP(Challenge Handshake Authentication Protocol) 使用 MD5 的加密驗證.

(But first backing it up to /etc/ppp/chap-secrets.bak)
(But first backing it up to /etc/ppp/pap-secrets.bak)
Congratulations, it should be all set up!

恭喜了!!設定已經完成了.

Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
to bring it down.
Type '/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.
[root@benjr ~]# ifup ppp0

到目前為止的設定都正常的話,你將得到 HiNet 給你的一個固定 IP.
先上網看看如果你的 Firefox 是否可以正常瀏覽網頁,如果可以那就可以繼續下一跟步驟,不行的話可以參考 附錄一:網路連線的錯誤排除

沒有解決問題,試試搜尋本站其他內容

3 thoughts on “設定 ADSL

  1. 自動引用通知: 硬體裝置 | Benjr.tw
  2. 自動引用通知: Drupal | Benjr.tw

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料