首先我多谢本论坛的写了关于如何用ADSL文章的各位作者,没有你们我也不能在这里写下这篇文章。多谢了。
本文以Debian Linux 2.6.18 为实验平台,其它平台的Linux安装可以参照,具体有不同的地方
(主要是拔号的命令不同)
1、安装前的准备工作
1.1确保PC的网卡正常工作
使用命令
#ifconfig eth0
查看网卡状态
1.2编辑/etc/network/interfaces(以下是本作者的配置,有需要的请个别调整,也可以直接复制)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface (Loop回环地址)
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
# 启动系统激活设备.
auto eth0
# 网卡eth0设置为Static类型.
iface eth0 inet static
# 指定IP地址.子网掩码.广播.网关.
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
#不要设置网关,这个很重要,读者请注意!
#在系统中不要设置默认路由(网关),让ADSL拨号后自动获得
#gateway
1.3确保已安装ppp软件包
如果存在文件 /usr/sbin/pppd,则说明已经安装了pppd;
如果未安装,从Debian第一张安装光盘上的[pool/main/p/ppp]上安装ppp_2.*.*rel-4_i386.deb这个软件包
也可以从http://ftp.tw.debian.org/debian/pool/main/p/ppp/上下载最新的,具体的文件请自己上网下载。
2、安装rp-pppoe客户端口软件
2.1下载rp-pppoe软件包
有需要的请到http://ftp.tw.debian.org/debian/pool/main/r/rp-pppoe/上下载,里面的.deb包软件名是pppoe_3.8-*.*_i386.deb,请读者注意,源码包软件名rp-pppoe_3.8-*.*tar.gz,请其他格式版本的到相应的网站下载,自己编译也可以。
2.2安装rp-pppoe软件包
以下需要root的权限
2.2.1 .deb格式安装
#dpkg -i pppoe_3.*-*.*_i386.deb
2.2.2 源码包格式安装
2.2.2.1QUICKSTART(快速安装)
----------
If you're lucky, the "quickstart" method will work. After unpacking
the archive, become root and type:
./go
This should configure, compile and install the software and set up your
DSL connection. You'll have to answer a few questions along the way.
If you want the GUI wrapper, type:
./go-gui
If ./go and ./go-gui didn't work, read the rest of this README.
2.2.2.2Compiling(编译安装)
---------
Compile and install pppd if you don't already have it. Then:
1) Unpack:
$ tar xzvf rp-pppoe-xxx.tar.gz
2) Change to source directory:
$ cd src
3) Configure:
$ ./configure
4) Compile:
$ make
4) Install (this step must be done as root)
# make install
5) Now read doc/HOW-TO-CONNECT
2.3配置rp-pppoe客户端口
# /usr/local/sbin/pppoe-setup
Welcome to the Roaring Penguin PPPoE client setup. First, I will run
some checks on your system to make sure the PPPoE client is installed
properly...
Looks good! Now, please enter some information:
USER NAME
#输入ADSL帐号的用户名
>>> Enter your PPPoE user name (default [email protected]): **********(用户名)
INTERFACE
#ADSL相连的网卡的名字
>>> Enter the Ethernet interface connected to the DSL 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
#demand value不用输入
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 pr使用pppoe拨号oblems with demand-activated links.
>>> Enter the demand value (default no):
DNS
#DNS服务器的IP,两个
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide 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:server
这一行,请各位用‘server’,让PC自动配置IP
PASSWORD
#密码
>>> Please enter your PPPoE password:
>>> Please re-enter your PPPoE password:
FIREWALLING
#防火墙,设为0
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
** Summary of what you entered **
Ethernet Interface: eth0
User name: abcdefg(用户名)
Activate-on-demand: No
Primary DNS: *.*.*.*
Secondary DNS: *.*.*.*
Firewalling: NONE
#信息正确,输入 y ,完成配置,否则,输入 n 重新输入
>>> Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/resolv.conf
(But first backing it up to /etc/resolv.conf-bak)
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
(But first backing it up to /etc/ppp/pap-secrets-bak)
(But first backing it up to /etc/ppp/chap-secrets-bak)
Congratulations, it should be all set up!
Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring
it down. Type 'pppoe-status' to see the link status.
3、登录ADSL
3.1使用pppoe拨号
启动ADSL
#pppoe-start
#.Connected!(连接上)
停止ADSL
#pppoe-stop
ADSL状态
#pppoe-status
3.2测试网络
检查是否存在ppp0端口和其信息
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:80:48:01:00:DA
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::280:48ff:fe01:da/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:215259 errors:0 dropped:0 overruns:0 frame:0
TX packets:230149 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:100254479 (95.6 MiB) TX bytes:86978178 (82.9 MiB)
Interrupt:185 Base address:0xb400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:195732 errors:0 dropped:0 overruns:0 frame:0
TX packets:195732 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:82843977 (79.0 MiB) TX bytes:82843977 (79.0 MiB)
ppp0 Link encapoint-to-Point Protocol
inet addr:59.34.147.239 P-t-P:59.34.147.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:3808 errors:0 dropped:0 overruns:0 frame:0
TX packets:3913 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2164406 (2.0 MiB) TX bytes:586302 (572.5 KiB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
查看路由表信息
netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
59.34.147.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
如果没有默认路由,可以手动增加:
#route add default gw 上面获得的IP地址
如果解析出新浪的IP,说明已经从拨号中正确获得了DNS服务器
#nslookup www.sina.com.cn
最后,使用命令ping某个域名或IP,如果有响应,表示已经大功告成。
声明:本文参照多个作者的文章,有些是从网上搜索的,具体的名字我也查不到,如果有什么侵权的,请发e-mail:[email protected]
本文可以自由传播,具体请参照《GNU GENERAL PUBLIC LICENSE》。
|