免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: bao19830224
打印 上一主题 下一主题

[网络配置] CentOS使用pppoe拨号上网的问题 [复制链接]

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
11 [报告]
发表于 2012-06-26 12:37 |只看该作者
回复 9# bao19830224


    我再给你贴一次吧。

首先安装好CentOS6以后要安装rp-pppoe这个软件,centos之前的版本所adsl-setup这个命令安装,到centos6改了。
需要光驱内放好CentOS安装盘
挂载光盘
#mount /dev/cdrom /media
找出文件路径
# find /media -name 'rp-pppoe*'
这个文件没有依赖项,可以直接安装
#rpm -ivh /media/CentOS_6.0_Final/Packages/rp-pppoe-3.10-8.el6.i686.rpm

安装好以后可以开始设置ADSL和DNS信息
#pppoe-setup
Welcome to the PPPoE client setup.  First, I will run some checks on
your system to make sure the PPPoE client is installed properly...

The following DSL config was found on your system:

  Device:      Name:
  ppp0         DSLppp0

Please enter the device if you want to configure the present DSL config
(default ppp0) or enter 'n' if you want to create a new one: ppp0

LOGIN NAME

Enter your Login Name (default root): 中国电信或者网通给你的ADSL用户名,注意电信给的有ad打头

INTERFACE

Enter the Ethernet interface connected to the PPPoE 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← 指定网络接入设备,一块网卡的情况下,一般为默认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): ← 直接按回车,接受默认设置,询问的是,adsl连接以后,是否持续保持连接。或者是自动的断开,在指定的时间(以秒数计算)内。多数情况下,我们希望手动的打开关闭连接。所以这里选择默认的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: XXX.XXX.XXX.XXX 第一个DNS建议手动设置,不然可能连不上
Please enter the IP address of your ISP's secondary DNS server.
If you just press enter, I will assume there is only one DNS server.
Enter the secondary DNS server address here: XXX.XXX.XXX.XXX 第二个DNS建议手动设置,不然可能连不上

PASSWORD

Please enter your Password: 输入ADSL的连接密码
Please re-enter your Password: ← 再次确认输入ADSL的连接密码

USERCTRL

Please enter 'yes' (three letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): yes← 填入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
Accept these settings and adjust configuration files (y/n)? y← 配置信息确认无误后,键入y同意设置
** Summary of what you entered **
Ethernet Interface:eth0
User name:

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
12 [报告]
发表于 2012-06-26 12:40 |只看该作者
我在实际测试中发现,如果是这个 adsl 拨号在 network-manager 服务之后启动,则 DNS 解析信息会丢失。

因此我的做法是将 resolv.conf 文件备份,然后修改了它的权限为只读,不是通过 chmod 修改的,好像是通过 chattr 修改的,然后写了一个脚本,脚本文件就是执行 pppoe-start , 然后我将这个添加到 /etc/sysinit.conf 里面了。

论坛徽章:
0
13 [报告]
发表于 2012-06-26 13:09 |只看该作者
用的是联通的,好像帐号是需要破解的。
因为联通的拨号协议比较BT

论坛徽章:
0
14 [报告]
发表于 2012-06-27 00:15 |只看该作者
在大家的帮助下,小弟终于搞定了。snow888兄在11楼提到的做法完全正确。

我之所以原来设置没有成功有两个原因:1、pppoe设置DNS时填写server,应该填ISP服务商的DNS
2、网络协议选择错误,错选为DHCP

现在每次开机,都必须拨号,等学习一下后,研究下snow888提到的脚本的方法

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
15 [报告]
发表于 2012-06-27 10:24 |只看该作者
回复 14# bao19830224


    不客气,搞定就好。

论坛徽章:
0
16 [报告]
发表于 2012-06-28 22:17 |只看该作者
回复 15# snow888

这两天下班后一直在浏览网站的帖子,发现大侠们都建议新手不要用root帐号,所以我就建了一个新的一般用户,但是发现在该用户下使用pppoe拨号上不了网了,而在root却可以。我在pppoe-setup进行设置的时候已经选择了一般用户可以开启或者关闭ADSL的功能。

我检查/etc/resolv.conf等相关的文件,也都正常。baidu了下也没有解决

是不是一般用户权限不足呢?请问大家碰到过类似问题没有?谢谢
   

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
17 [报告]
发表于 2012-06-28 22:19 |只看该作者
@bao19830224我当初为什么要加在系统服务中,就是这个道理。

普通用户是无法拨号的,每次进入后都要用 su 切换到 root 用户,然后拨号,然后再退出 root 用户,这样很麻烦。

所以俺将这个拨号加入到系统服务中,这样就在系统启动的时候自动拨号了。普通用户也就都可以直接用了。

论坛徽章:
0
18 [报告]
发表于 2012-06-28 23:23 |只看该作者
回复 17# snow888


snow888兄,正像你所说的,普通用户无法进行拨号,但是我su root帐号了,并且运行了拨号命令,中间也没有提示错误,但我依然上不了网

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
19 [报告]
发表于 2012-06-28 23:33 |只看该作者
@bao19830224那应该是你的网卡没有联网。

实际上这里面有两个过程,第一个过程,你的计算机通过网线连上你的 adsl , 并获得 IP 地址。这个过程必须在前面。

第二个过程,通过 pppoe 拨号,你的机器将获得一个除网卡以外的公网的 IP 地址及 DNS 解析。

你先编辑你的网络设置,让它的连接设置成自动方式,下面勾选对所有的用户有用。

然后,你切换到 root 用户,进行 pppoe 拨号,拨号完成以后,应该就可以上网了。

论坛徽章:
0
20 [报告]
发表于 2012-06-28 23:48 |只看该作者
snow888 发表于 2012-06-28 22:19
@bao19830224我当初为什么要加在系统服务中,就是这个道理。

普通用户是无法拨号的,每次进入后都要用 s ...


snow888兄:

我的流程是这样的

1、我用root帐号登录系统,我用可视化的那个网络窗体进行设置(应该是network manager吧),我设置了自动连接,仅本地连接和所有用户都可用。开始用pppoe进行拨号,能上网

2、重启系统,选用普通用户登录,系统右上角的图标变成连接状态

3、su root  然后用pppoe进行拨号,但是不能上网。我感觉肯定是拨号成功了,因为这时我立即注销系统用root帐号登录,再进行pppoe拨号,会提示有错误,类型于Windows下用户名和密码正在登录中,过一二分钟后再重新拨号就成功了

我不知道为什么会这样
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP