www.muyu.org
    木鱼在线
  8.jpg (10929 字节)
 
在LINUX (Mandrake 7.0)下安装ADSL


环境
系统:Linux Mandrake release 7.1 (helium) Kernel 2.2.15-4mdk on an i686
ADSL客户端设备:ANT:Alcatel A1000 10/100baseT 接口的网桥;
NIC:TP-Link 8139B 10/100M网卡。
ANT与NIC用一对一五类双绞线连接。
没有固定IP地址,有局端动态分配。
所需软件包:pppoed-0.48b1.tgz,可在http://www.davin.ottawa.on.ca/pppoe/得到。

一、网卡设置
先安装一块网卡,并配置好网卡的参数(相关配置手册)。如我的网卡IP为192.168.0.8。
二、安装PPPOED软件包
在安装好系统后,系统会缺省安装PPP软件,并在/usr/sbin下生成pppd,pppstats等文件,故不用安装PPP软件包了。
将下载的软件包pppoed-0.48b1.tgz解压到/usr/src/pppoed-0.48b1目录下:
# tar –zxvf pppoed-0.48b1.tgz
进入该目录,并运行命令:
#Install_pppoed
出现以下提示,根据提示进行安装如下:
Linux source directory[where kernel headers are found] [/usr/src/linux]:
(原码路径)(按回车)
Module install dir [/lib/modules/2.2.15-4mdk/net]:
(模块安装路径)(按回车)
RH-like init directory [/etc/rc.d/init.d]: 初始化路径)(按回车)
compiler for modules. If you have RH7.0, select kgcc instead of gcc
[gcc]:(编译时所需的
C环境,Mandrake 7.0下,是用gcc)(按回车)

Kernel source: /usr/src/linux
init_dir: /etc/rc.d/init.d
module install directory: /lib/modules/2.2.15-4mdk/net
Compiler for modules : gcc
is this correct?(answer y/n only)
[y]:(询问以上设置是否正确,如果正确就按y)
然后就进行编译过程。编译完后出现以下提示:
Do you want me to setup PPP for you?(answer y/n only)
[y]:(是否要设置PPP)(按回车)
Please enter your Username for your ISP [ ]: (输入用户名)(如 abc)
Please enter your Password for your ISP [ ]:(输入你的密码)
Please enter your domain name
This is often trailing the @ in your email address
If your email was John@Doe.com, then most often, your
domain name would be: Doe.com
domain name : [ ]: (输入你的域)(如我的是163.gd)

collected information

User Name : szourweb
passWord: ourweb
domainName: 163.gd
is this correct?(answer y/n only) [y]:
(确认你的信息是否正确,如果正确就按回车)
setting ppp-options ....
Setting /etc/ppp/pap-secrets* perms to 600

Do you want me to setup DNS for you?(answer y/n only)
[y]:(是否设置DNS,按y)
Please enter your Primary DNS server
It should be in the form ###.###.###.###
Where the "#" is either a number or blank space
Primary DNS server: [ ]:
(输入数据局提供的DNS服务起IP,如:202.96.134.133)

If you have a Secondary DNS server please enter it
If none, just press enter
Secondary DNS server: []: (如果有辅助DNS,则在此输入,如:202.96.128.68)

collected information
nameServer1 Name : 202.96.134.133
second nameserver: 202.96.128.68
is this correct?(answer y/n only) [y]:(再次确认信息是否正确,正确则按y)

would you like to start pppoed?(answer y/n only) [y]:(提示是否启动pppoed)
到此pppoed安装完成,在结束时,如果提示:
Starting pppoed: Warning: modutils is reading from /etc/modules.conf and
ignoring /etc/conf.modules. The use of /etc/conf.modules is
depreciated,
please remove /etc/conf.modules as soon as possible. Command
rm /etc/conf.modules
则请删除/etc/conf.modules.模块配置文件改用modules.conf。
三、配置相关文件
pppoe安装后,在modules.conf中加入:
alias char-major-144 pppox
并将配置信息写入/etc/sysconfig/network-scripts/ifcfg-ppp0中
更改ifcfg-ppp0中的这一句:
MODEMPORT="/dev/ppp0"
为:MODEMPORT="/dev/pppox0"
在安装完pppoed后,/etc/ppp/目录下的两个文件应该如下:
-------------------------------------options-------------------------------------
lock
local
nocrtscts
noauth
#be careful with mtu/mru if you are masquerading.
# look at Kal Lin's page at http://www.cs.toronto.edu/~kal/hse/resource.html
mru 1490
mtu 1490
#please make sure you have noaccomp for now
noaccomp
#the construct below is needed by sympatico
name "szourweb@163.gd"
#you might want to change defaultroute if you have more
#than one pppoe session
defaultroute
hide-password
sync
#it might be a good idea to uncoment the debug below
#debug
#kdebug 7
#if you use the -R option to make it persistent
#then uncomment the next two lines below
#lcp-echo-interval 240
#lcp-echo-failure 3
#nodetach
----------------------------------end
options---------------------------------

-------------------------------------
pap-secrets------------------------------
# Secrets for authentication using PAP
# client server secret IP addresses
abc@163.gd * 123456
---------------------------------end
secrets----------------------------------
根据自己的实际情况更改相关项目。
至此,软件设置完成。
将ANT和NTC连接无误后运行:
# /etc/sbin/pppoed
就可以连接上了。
你可以:
# tail -f /var/log/message
看整个连接过程。
如果连接上了将出现以下类似信息:
Oct 25 01:59:59 adsl pppoed[10323]: starting /usr/sbin/pppd to interface
/dev/pp
pox0
Oct 25 01:59:59 adsl modprobe: Note: /etc/modules.conf is more recent than
/lib/
modules/2.2.15-4mdk/modules.dep
Oct 25 01:59:59 adsl kernel: registered device ppp0
Oct 25 01:59:59 adsl pppoed[10322]: Line id which died is: 0
Oct 25 01:59:59 adsl pppoed[10322]: OK we got killed
Oct 25 01:59:59 adsl pppoed[10322]: ppp_connect came back!
Oct 25 01:59:59 adsl pppd[10325]: pppd 2.3.11 started by root, uid 0
Oct 25 01:59:59 adsl pppd[10325]: Using interface ppp0
Oct 25 01:59:59 adsl pppd[10325]: Connect: ppp0 <--> /dev/pppox0
Oct 25 02:00:04 adsl kernel: PPP BSD Compression module registered
Oct 25 02:00:04 adsl kernel: PPP Deflate Compression module registered
Oct 25 02:00:04 adsl insmod: Note: /etc/modules.conf is more recent than
/lib/mo
dules/2.2.15-4mdk/modules.dep
Oct 25 02:00:05 adsl pppd[10325]: local IP address 61.141.206.79
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 25 02:00:05 adsl pppd[10325]: remote IP address 61.141.204.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[root@adsl sysconfig]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt
Iface
192.168.0.8 0.0.0.0 255.255.255.255 UH 0 0 0
eth1
192.168.1.8 0.0.0.0 255.255.255.255 UH 0 0 0
eth0
61.141.204.1 0.0.0.0 255.255.255.255 UH 0 0 0
ppp0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0
eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0
eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 61.141.204.1 0.0.0.0 UG 0 0 0
ppp0

# ifconfig
ppp0 Link encap:Point-to-Point Protocol
inet addr:61.141.206.79 P-t-P:61.141.204.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1490 Metric:1
RX packets:13 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10

注意:在/usr/doc/pptp-adsl-fr-1.0.2目录中有Alcatel的ADSL.htm,如果按照该文件的做法,运行pptp
alcatel ,会出错:
# tail –f /var/log/message
Oct 25 01:04:07 adsl pptp[10036]: connect: No route to host
Oct 25 01:04:07 adsl pptp[10036]: Could not open control connection to
192.168.0.138
Oct 25 01:04:07 adsl pptp[10035]: Call manager exited with error 256