1.網路設定
#ifconfig eth0
ifconfig 命令顯示資訊說明:
Link encap 網路介面類型,如乙太網路或PPP等
HWadrr 網卡的 Mac 地址。每一塊網卡都有自己的編號,用於在乙太網路協議下定位網路主機
inet addr 此介面對應的 IP 位址
網路介面狀態標誌 UP — 網路介面被啟用
RUNNING — 介面正在運行
BROADCAST — 支援廣播 IP 定址方式
MULTICAST — 支援多播 IP 定址方式
LOOPBACK — 表示本地迴環裝置介面
MTU Message transfer unit, 此介面所能傳輸的最大 frame 數
Metric 此介面的 Metric 數,用於引導路由決策
Bcast 廣播位址,通常是網路的最後一個 IP 位址
Mask 子網路遮罩
RX packets 接收的封包總數、錯誤數、遺失數和溢流數
TX packets 發送的封包總數、錯誤數、遺失數和溢流數
collisions 衝突數(當多個 NIC 同時使用網線傳輸資料時會產生衝突)
txqueuelen 指出網路介面可以儲存的資料包的個數
RX bytes 與 RX packets 類似,表示接收的具體位元組數
TX bytes 與 TX packets 類似,表示發送的具體位元組數
Interrupt 網卡使用的中斷(IRQ)
Base address 網卡使用的記憶體位址
2、配置PPPOE用戶端軟體 Centos 預設安裝了PPPOE 軟體,直接配置[root@sample ~]# adsl-setup ← 建立ADSL串連
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): ← 填入ADSL串連的使用者名稱
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
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): ← 直接按斷行符號,接受預設設定,斷線後不自動撥號
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: ← 如果知道DNS伺服器的資訊在此填入。不知道的情況按斷行符號跳過
修改etc/resolve.conf檔案
輸入 server ,這表示使用ADSL撥號自動獲得的DNS伺服器IP地址 或者202.106.0.20備用DNS 202.106.148.1
PASSWORD
Please enter your Password: ← 輸入ADSL的串連密碼
Please re-enter your Password: ← 再次確認輸入ADSL的串連密碼
USERCTRL
Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): no ← 填入no,不允許一般使用者控制PPPoE的串連
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 ← 輸入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 ← 填入yes,在系統啟動時自動連接ADSL
** Summary of what you entered **
Ethernet Interface: eth0
User name: caun870293@ca.dti.ne.jp
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
User Control: no
Accept these settings and adjust configuration files (y/n)? y ← 配置資訊確認無誤後,鍵入y同意設定否則,輸入n重新輸入。
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
(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.
#adsl-setup 這個工具進行配置:3.啟動PPPOE用戶端軟體# adsl-start← 啟動ADSL串連
#← 稍等片刻後若啟動成功後出現提示符(無任何提示即意味著串連成功)如果不成功,請檢查網線、ADSL MODEM等物理裝置,並查看 /var/log/messages中的資訊 #adsl-stop 關閉和ISP的串連#adsl-status 查看當前串連的狀態 4.測試#ifconfig -a
在輸出中應該含有關於 ppp0 的一堆資訊,其中還綁定了 IP 位址,說明已經從撥號中獲得了IP地址。 #netstat -nr
查看路由表資訊,這時的預設路由應該是上面獲得的IP地址。 如果沒有預設路由,我們可以手動增加:#route add default gw 上面獲得的IP地址
#nslookup www.sina.com.cn
如果解析出新浪的IP,說明已經從撥號中正確獲得了DNS伺服器
最後,使用命令ping某個網域名稱或IP,如果有響應,表示你已經大功告成了。