linux下使用ADSL,必须安装PPPOE客户端软件。下面说明如何进行安装:
一、安装的前提条件
1.确保安装了 卡并工作正常
使用命令
#ifconfig eth0
查看 卡状态
2.在系统中不要设置默认路由( 关),让ADSL拨 后自动获得
如果已经设置了默认路由,使用以下方法删除:
在文件 /etc/sysconfig/network 中删除 GATEWAY= 这一行,然后以root执行:
#/etc/rc.d/init.d/network restart
3.已经安装了pppd软件包
如果存在文件 /usr/sbin/pppd,则说明已经安装了pppd;
如果未安装,从RedHatLinux 6.2安装光盘上安装ppp-2.3.11-4.i386.rpm这个软件包
二、安装PPPOE客户端软件
Linux下的PPPOE客户端软件比较多,而且大多使用GNU License,我们推荐使用rp-pppoe
这个软件包。从这个 站上,不仅可以下栽
RedHat 62平台下的rp-pppoe的二进制软件包,而且可以下栽源代码软件包。
1.二进制软件包的安装:
A.下栽二进制软件包
rp-pppoe-3.2-1.i386.rpm
B.进行安装
以root执行:
#rpm -Uvh rp-pppoe-3.2-1.i386.rpm
2.从源代码进行安装:
从源代码进行安装同样适用于其它平台的Linux,但必须在Linux系统中安装gcc编译器。
A.下栽源代码软件包
rp-pppoe-3.2.tar.gz
B.解压缩
#tar xvfz rp-pppoe-3.2.tar.gz
#cd rp-pppoe-3.2
C.进行编译和安装
运行脚本
#./go
将自动进行编译和安装,最后,调用/usr/sbin/adsl-setup进行配置,具体解释见三。
三、配置PPPOE客户端软件
安装完软件包后,必须配置pppoe的配置文件/etc/ppp/pppoe.conf,从而让ADSL拨 时
使用配置文件中的用户名、密码等参数。我们不必手工改动这个文件,可以使用
adsl-setup这个工具进行配置:
#/usr/sbin/adsl-setup
当出现
>>> Enter your PPPoE user name :
输入ADSL帐 的用户名
当出现
>>> 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 ethn, where ‘n’ is a number.
(default eth0):
输入 eth0 ,这是ADSL相连的 卡的名字
当出现
>>> Enter the demand value (default no):
输入 no
当出现
>>> Enter the DNS information here:
输入 server ,这表示使用ADSL拨 自动获得的DNS服务器IP地址
当出现
>>> Please enter your PPPoE password:
输入ADSL帐 的密码
当出现
>>> Choose a type of firewall (0-2):
输入 0 ,不使用防火墙
当出现
>>> Accept these settings and adjust configuration files (y/n)/p>
如果输入的信息正确,输入 y ,完成配置,否则,输入 n 重新输入。
四、启动PPPOE客户端软件
使用命令
/usr/sbin/adsl-start 启动PPPOE客户端软件,进行连接,如果成功,将出现
Connected;
如果不成功,请检查 线、ADSL MODEM等物理设备,并查看 /var/log/messages中的信
息
/usr/sbin/adsl-stop 关闭和ISP的连接
/usr/sbin/adsl-status 查看当前连接的状态
如果想在Linux系统启动时自动启动ADSL连接,输入以下命令
#chkconfig –add adsl
将在当前的运行级下加入ADSL的自启动脚本
五、测试
当连接成功后,使用命令
#ifconfig -a
在输出中应该含有关于 ppp0 的一堆信息,其中还绑定了 IP 地址,说明已经从拨 中获
得了IP地址。
使用命令
#netstat -nr
查看路由表信息,这时的默认路由应该是上面获得的IP地址。
如果没有默认路由,我们可以手动增加:
#route add default gw 上面获得的IP地址
使用命令
#nslookup
如果解析出新浪的IP,说明已经从拨 中正确获得了DNS服务器
最后,使用命令ping某个域名或IP,如果有响应,表示你已经大功告成了。
六、其它说明
RedHat Linux 7.1已经集成了rp-pppoe这个软件包,只不过版本有些低,如果你不在意版
buchong:
笔者使用rp-pppoe软件拨 上 ,但每次重启之后都要手动添加 关,
手动同步动态ip到3322,尤为不爽。
pppoe连接建立后,系统自动调用/etc/ppp/ip-up脚本。
其参数如下面文件所示,第4个参数是系统获得的动态ip。
#!/bin/bash
#
# Script which handles the routing issues as necessary for pppd
# Only the link to Newman requires this handling.
#
# When the ppp link comes up, this script is called with the following
# parameters
# $1 the interface name used by pppd (e.g. ppp3)
# $2 the tty device name
# $3 the tty device speed
# $4 the local IP address for the interface
# $5 the remote IP address
# $6 the parameter specified by the ‘ipparam’ option to pppd
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
route add default gw $4
#下面这一行是使用3322.org的动态域名,如没有使用,可以不加。
/usr/local/bin/ez-ipupdate -c /usr/local/ezip/qdns.conf
把以上内容存为/etc/ppp/ip-up.local
并chmod 755 /etc/ppp/ip-up.local,使之有执行权限。
因为ip-up会自动找ip-up.local执行,所以不用修改ip-up文件。
最后执行:
service network restart
ip addr
(多看几次ip,如果ppp0获取了ip地址,则用route查看 关是否已经自动添加)
route
祝您成功!
文章知识点与官方知识档案匹配,可进一步学习相关知识CS入门技能树Linux入门初识Linux24718 人正在系统学习中 相关资源:PHP寄生虫繁殖劫持程序V3.0_寄生虫程序-PHP代码类资源-CSDN文库
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!