日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

如何在Linux下用ADSL拨号上网

發(fā)布時(shí)間:2024/1/1 linux 57 豆豆
生活随笔 收集整理的這篇文章主要介紹了 如何在Linux下用ADSL拨号上网 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1??首先,你必須安裝相應(yīng)的ADSL撥號(hào)軟件。平常用的redhat發(fā)行版本中,帶有pppoe這個(gè)rpm包。
我們通過(guò)下面的命令實(shí)現(xiàn):
[root@Server root]# rpm -qa|grep pppoe
rp-pppoe-3.4-7
這個(gè)命令的輸出來(lái)確定系統(tǒng)中是否已經(jīng)安裝了pppoe這個(gè)包。rpm -qa是列出系統(tǒng)中已經(jīng)安裝的包。通過(guò)管道|將這個(gè)命令的輸出,作為第二個(gè)命令的輸入。grep pppoe是列出包含有pppoe的行。如果返回為空,則說(shuō)明沒(méi)有安裝。如果安裝了,會(huì)返回安裝了pppoe的版本號(hào)。如果你還沒(méi)有安裝的話,通過(guò)下面的命令安裝。
[root@Server root]# rpm -ivh redhat/ppp-2.4.1-7.i386.rpm
這樣,你就安裝好了撥號(hào)需要的軟件。

2??配置網(wǎng)卡
撥號(hào)需要將撥號(hào)的網(wǎng)卡設(shè)置為動(dòng)態(tài)獲取ip。而動(dòng)態(tài)獲取ip在機(jī)器啟動(dòng)的時(shí)候,將會(huì)花費(fèi)很長(zhǎng)時(shí)間去獲取ip。所以,我們最好將網(wǎng)卡設(shè)置不啟動(dòng)時(shí)不激活。(不建議這么做,如果是遠(yuǎn)程登陸的話,就很麻煩)一般情況下我們都使用命令netconfig可以方面的配置網(wǎng)絡(luò)相關(guān)信息。當(dāng)然,也可以通過(guò)修改網(wǎng)卡的配置文件實(shí)現(xiàn):
[root@Server root]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

3??配置撥號(hào)軟件

與ADSL相關(guān)的一共有四個(gè)命令adsl-connect?,adsl-setup,adsl-start,adsl-status,adsl-stop
通過(guò)下面這個(gè)命令,啟動(dòng)ADSL設(shè)置:
[root@Server root]# adsl-setup
首先,你會(huì)看到歡迎信息。
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):


接著,要求我們選擇使用的網(wǎng)絡(luò)接口。我們這時(shí)候,填入我們剛剛設(shè)置的那個(gè)網(wǎng)卡。對(duì)于大多數(shù)只有一個(gè)網(wǎng)卡的朋友而言,默認(rèn)eth0就可以了。
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):

接下來(lái),詢問(wèn)的是,adsl連接以后,是否持續(xù)保持連接?;蛘呤亲詣?dòng)的斷開(kāi),在指定的時(shí)間(以秒數(shù)計(jì)算)內(nèi)。多數(shù)情況下,我們希望手動(dòng)的打開(kāi)關(guān)閉連接。所以這里選擇默認(rèn)的no。
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):


再下來(lái),就是dns了。我發(fā)現(xiàn)很多時(shí)候,pppoe都不能夠正確獲取dns信息。我建議你輸入dns地址。這些信息在isp的網(wǎng)站上一般都有公布。
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.


帳號(hào)密碼是必須,輸入兩次。密碼顯示風(fēng)格和其他的地方一樣,不顯示在屏幕上。這個(gè),我不知道改怎么填寫(xiě)。太高深的問(wèn)題了。希望你將你的答案和我分享。:P。
PASSWORD
Please enter your Password:
Please re-enter your Password:


下面的設(shè)置,是表示是否允許普通用戶啟用/關(guān)閉 ADSL連接。默認(rèn)是允許。
Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes):


我們看下防火墻選項(xiàng)。這里提供的防火墻可以給你提供基本的安全保護(hù)。我不推薦你使用——你最好選擇“NONE”選項(xiàng)。無(wú)論是什么樣的用戶使用,我都建議你使用額外的工具來(lái)配置防火墻規(guī)則(iptables目前看來(lái)是一個(gè)非常不錯(cuò)的工具)。
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):


是否在開(kāi)機(jī)時(shí),打開(kāi)這個(gè)連接?
Do you want to start this connection at boot time?


所有的配置信息填寫(xiě)完成之后,系統(tǒng)將給出一個(gè)報(bào)告,完整的顯示出你輸入的配置信息。如果,你確信你輸入的配置信息是正確的,輸入yes寫(xiě)入配置文件。輸入no放棄配置。
Summary of what you entered
Ethernet Interface: eth0
User name: root
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
User Control: yes
Accept these settings and adjust configuration files (y/n)?

Please enter no or yes (default no):


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.

測(cè)試撥號(hào)
現(xiàn)在,我們需要測(cè)試下我們的撥號(hào)是否配置正確了。
輸入ADSL-start撥號(hào)。一般情況下,我會(huì)ping 我的ISP的主WWW服務(wù)器。比如
ping 61.139.2.69(該地址是電信的DNS服務(wù)器)

如果能ping通則說(shuō)明沒(méi)有什么問(wèn)題
如果不怕麻煩,打開(kāi)瀏覽器測(cè)試下,也可以。如果一切ok。那么我們就可以結(jié)束我們的配置了。
當(dāng)然,你關(guān)閉連接的話,使用命令adsl-stop就可以了。

?

故障排除

照上邊的操作步驟配置下來(lái),一般是沒(méi)有什么問(wèn)題的。但是因?yàn)長(zhǎng)inux沒(méi)有Windows那么直觀,出現(xiàn)問(wèn)題的話,排除故障是非常惱火的。

故障1:無(wú)法瀏覽網(wǎng)頁(yè),但是可以ping通DNS服務(wù)器地址,多半是在配置的時(shí)候DNS服務(wù)器地址填錯(cuò)了。建議檢查一下DNS服務(wù)器是否正確。

故障2:用ifconfig查看鏈接,確實(shí)出現(xiàn)了三個(gè)鏈接,一個(gè)eth0,一個(gè)lo,一個(gè)ppp0,但是就是無(wú)法ping通外網(wǎng),這種情況多出現(xiàn)在手動(dòng)修改ifcfg-eth0文件,或者用netconfig命令的情況下。

我查看了一下我Windows下和Linux下的路由信息發(fā)現(xiàn)少了如下路由,

Network???????Destination????????Netmask??????????Gateway???????Interface?

?0.0.0.0??????????0.0.0.0?????192.168.0.77????192.168.0.77???????1
?注釋:?192.168.0.77?是我windows撥號(hào)取得的PPPOE客戶端地址,這條路由的意思是所有的數(shù)據(jù)包都從77這個(gè)端口出去,但是Linux下就沒(méi)有這條路由。

后來(lái)查了很多資料終于找到了問(wèn)題所在,因?yàn)槲业膃th0網(wǎng)址信息是我手動(dòng)修改的,所以就有GATEWAY這一項(xiàng),?而且我發(fā)現(xiàn)路由都是從192.168.0.1這個(gè)端口出去的,而我PPP0E客戶端撥號(hào)獲得的地址是192.168.0.76,所以這肯定是不對(duì)的,怎么解決呢?

將/etc/sysconfig/network文件中的GATEWAY一項(xiàng)用#號(hào)注釋掉,

將/etc/sysconfig/network-scipts/ifcfg-eth0文件中的GATEWAY也注釋掉,

重啟撥號(hào),OK了,終于OK了,倒杯茶,點(diǎn)根煙慶祝一下吧!!!

總結(jié)

以上是生活随笔為你收集整理的如何在Linux下用ADSL拨号上网的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。