资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

linuxpppd命令 pd linux

linux(系统经过裁减)killall pppd后再使用pppd call wcdma可以连上,但有时候killall pppd后无法连上

只能有一个ROOT帐号。

专注于为中小企业提供网站设计制作、成都网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业新野免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了超过千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

想要普通用户有权限,以ROOT帐号登陆,然后输入chmod o +rw [fileName]。

建议你用man chmod看看chmod的详细说明。

修改权限:

1)管理用户(user)的工具或命令;

useradd 注:添加用户

adduser 注:添加用户

passwd 注:为用户设置密码

usermod 注:修改用户命令,可以通过usermod 来修改登录名、用户的家目录等等;

pwcov 注:同步用户从/etc/passwd 到/etc/shadow

pwck 注:pwck是校验用户配置文件/etc/passwd 和/etc/shadow 文件内容是否合法或完整;

pwunconv 注:是pwcov 的立逆向操作,是从/etc/shadow和 /etc/passwd 创建/etc/passwd ,然后会删除 /etc/shadow 文件;

finger 注:查看用户信息工具

id 注:查看用户的UID、GID及所归属的用户组

chfn 注:更改用户信息工具

su 注:用户切换工具

sudo 注:sudo 是通过另一个用户来执行命令(execute a command as another user),su 是用来切换用户,然后通过切换到的用户来完成相应的任务,但sudo 能后面直接执行命令,比如sudo 不需要root 密码就可以执行root 赋与的执行只有root才能执行相应的命令;但得通过visudo 来编辑/etc/sudoers来实现;

visudo 注:visodo 是编辑 /etc/sudoers 的命令;也可以不用这个命令,直接用vi 来编辑 /etc/sudoers 的效果是一样的;

sudoedit 注:和sudo 功能差不多。

2)管理用户组(group)的工具或命令;

groupadd 注:添加用户组;

groupdel 注:删除用户组;

groupmod 注:修改用户组信息

groups 注:显示用户所属的用户组

grpck

grpconv 注:通过/etc/group和/etc/gshadow 的文件内容来同步或创建/etc/gshadow ,如果/etc/gshadow 不存在则创建;

grpunconv 注:通过/etc/group 和/etc/gshadow 文件内容来同步或创建/etc/group ,然后删除gshadow文件。

linux有gprs也有线怎么选择

认情况在/etc/ppp/目录下建立文件gprs-connect-chat,内容如下(每个参数解释在ppp-howto中有详细解释。它是在ppp

底层会话的时候给chat进程的参数每行是一个“期望/发送”的组合序列。当出现一些经典的错误如: "LCP: timeout sending

Config-Requests" ,"serial line is not 8 bit clean...",“serial line is

looped

back”等,去参看方式2提到的两个文档,或者google。注意,为什么不能确切地给出解决的方式,原因是打印出来的同一个错误信息,我称之为现象,

同一现象可能是由很多种原因造成的,需要自己实地排查。)

#/etc/ppp/gprs-connect-chat

TIMEOUT 15

ABORT '\nBUSY\r'

ABORT '\nNO ANSWER\r'

ABORT '\nRINGING\r\n\r\nRINGING\r'

#'' AT

#'OK-+++\c-OK' ATH0

TIMEOUT 40

'' \rAT

OK ATS0=0 #这些都是标准的at命令,建议查看随模块的at命令手册

OK ATE0V1

OK AT+CGDCONT=1,"IP","CMNET" #设置isp接入网关为中国移动的cmnet,如果你想 获得更多访问资源的话

OK ATDT*99***1# #中国移动gprs的接入号吗

CONNECT ''

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

建立文件/etc/ppp/peers/gprs,它的作用是给pppd进程提供配置参数(详见man 8 pppd的输出内容,如果出现问题这个将是非常重要的参考页),内容如下:

#/etc/ppp/peers/gprs

# Usage: rootpppd call gprs

/dev/s3c2410_serial1 #改成自己的端口名

115200 #改成自己串口波特率

nocrtscts

#可能你的串口是需要crtscts,硬件流控的,这是由你的串口决定的,一般嵌入式系统的串口没有带硬件流控,也不需要就加nocrtscts

modem #这个参数使得pppd进程将等待模块发回的CD (Carrier Detect)信号,与local真好相反

#noauth

debug #把调试信息输出到/var/log/messages,在调试成功后去掉它,以减少垃圾的产生。

nodetach

#hide-password

usepeerdns #以下的3个参数一般不可少

noipdefault

defaultroute

user smsong #设置接入的用户名,在chap-secrets或者pap-secets中使用

0.0.0.0:0.0.0.0 #本地和远端的ip都设为0使得接入的isp分配本地的ip地址

ipcp-accept-local #要求peer也就是isp给自己非配动态的IP地址

#ipcp-accept-remote

#lcp-echo-failure 12

#lcp-echo-interval 3

noccp #不需要压缩控制协议,有可能对端不需要,根据自己的isp的情况

#novj

#novjccomp

persist #保证在连接断开的情况下不退出,并尝试重新打开连接

connect '/usr/sbin/chat -s -v -f /etc/ppp/gprs-connect-chat'

#pppd调用chat会话进程接入对端isp,启动对端的pppd,然后本地pppd与对端的pppd一起进行协

#商网络参数和chap/pap认证,成功后,再进行ncp层的ip的分配。

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#/etc/ppp/chap-secets

# Secrets for authentication using CHAP

# client server secret IP addresses

####### redhat-config-network will overwrite this part!!! (begin) ##########

####### redhat-config-network will overwrite this part!!! (end) ############

smsong * 123456 *

有点地区的GPRS可能使用pap方式认证接入用户,所以在同一级目录下,创建pap-secets文件,内容与chap-secets类似有4项的内容第2和第4项一般不限制就用*(星号)代表。反正要你在/etc/ppp/下放着这两个文件就好。

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

在建立了ppp0连接以后可以使用ctrl+c或者下面的脚本程序ppp-off断开ppp连接

#/etc/ppp/ppp-off

#!/bin/sh

######################################################################

#

# Determine the device to be terminated.

#

if [ "$1" = "" ]; then

DEVICE=ppp0

else

DEVICE=$1

fi

######################################################################

#

# If the ppp0 pid file is present then the program is running. Stop it.

if [ -r /var/run/$DEVICE.pid ]; then

kill -INT `cat /var/run/$DEVICE.pid`

#

# If the kill did not work then there is no process running for this

# pid. It may also mean that the lock file will be left. You may wish

# to delete the lock file at the same time.

if [ ! "$?" = "0" ]; then

rm -f /var/run/$DEVICE.pid

echo "ERROR: Removed stale pid file"

exit 1

fi

#

# Success. Let pppd clean up its own junk.

echo "PPP link to $DEVICE terminated."

exit 0

fi

#

# The ppp process is not running for ppp0

echo "ERROR: PPP link is not active on $DEVICE"

exit 1

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

做好上面的配置以后,输入pppd call gprs命令,注意如果你的gprs这个文件不在/etc/ppp/peers/目录下,在给出标注路径给pppd

[root@localhost ppp_scripts]# pppd call gprs

timeout set to 15 seconds

abort on (\nBUSY\r)

abort on (\nNO ANSWER\r)

abort on (\nRINGING\r\n\r\nRINGING\r)

timeout set to 40 seconds

send (^MAT^M^M)

expect (OK)

^M^M

OK

-- got it

send (ATS0=0^M^M)

expect (OK)

^M

AT^M

OK

-- got it

send (ATE0V1^M^M)

expect (OK)

^M

^M^M

OK

-- got it

send (AT+CGDCONT=1,"IP","CMNET"^M^M)

expect (OK)

^M

ATS0=0^M^M

OK

-- got it

send (ATDT*99***1#^M^M)

expect (CONNECT)

^M

^M^M

OK^M

ATE0V1^M^M

OK^M

^M

OK^M

^M

OK^M

^M

OK^M

^M

CONNECT

-- got it

send (^M)

Serial connection established.

using channel 20

Using interface ppp0

Connect: ppp0 /dev/ttyS0

Warning - secret file /etc/ppp/pap-secrets has world and/or group access

sent [LCP ConfReq id=0x1 ]

rcvd [LCP ConfRej id=0x1 ]

sent [LCP ConfReq id=0x2 ]

rcvd [LCP ConfAck id=0x2 ]

rcvd [LCP ConfReq id=0x1 ]

sent [LCP ConfAck id=0x1 ]

rcvd [CHAP Challenge id=0x1 , name = ""]

Warning - secret file /etc/ppp/chap-secrets has world and/or group access

sent [CHAP Response id=0x1 , name = "smsong"]

rcvd [CHAP Success id=0x1 ""]

CHAP authentication succeeded

CHAP authentication succeeded

sent [CCP ConfReq id=0x1 ]

sent [IPCP ConfReq id=0x1 ]

rcvd [LCP ProtRej id=0x1 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]

Protocol-Reject for 'Compression Control Protocol' (0x80fd) received

rcvd [IPCP ConfReq id=0x1]

sent [IPCP ConfNak id=0x1 ]

rcvd [IPCP ConfRej id=0x1 ]

sent [IPCP ConfReq id=0x2 ]

rcvd [IPCP ConfReq id=0x2]

sent [IPCP ConfAck id=0x2]

rcvd [IPCP ConfNak id=0x2 ]

sent [IPCP ConfReq id=0x3 ]

rcvd [IPCP ConfAck id=0x3 ]

Could not determine remote IP address: defaulting to 10.64.64.64

local IP address 10.144.202.159

remote IP address 10.64.64.64

primary DNS address 211.138.200.69

secondary DNS address 211.103.13.101

Script /etc/ppp/ip-up started (pid 4578)

Script /etc/ppp/ip-up finished (pid 4578), status = 0x0

使用ctrl+c可以断开连接,这样一般不太好测试是不是连接上了(遇有开发不上的控制台只有一个的原因),可以去掉/etc/ppp

/peers/gprs文件中的nodetach参数,要用ping,你需要将eth0即网口给禁用掉,这样ping才会通过ppp0端口寻找路由连接外

网。

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

可以用命令tail -f /var/log/messages看到日志:

Mar 20 20:55:55 localhost pppd[4557]: pppd 2.4.4 started by root, uid 0

Mar 20 20:55:56 localhost chat[4558]: timeout set to 15 seconds

Mar 20 20:55:56 localhost chat[4558]: abort on (\nBUSY\r)

Mar 20 20:55:56 localhost chat[4558]: abort on (\nNO ANSWER\r)

Mar 20 20:55:56 localhost chat[4558]: abort on (\nRINGING\r\n\r\nRINGING\r)

Mar 20 20:55:56 localhost chat[4558]: timeout set to 40 seconds

Mar 20 20:55:56 localhost chat[4558]: send (^MAT^M^M)

Mar 20 20:55:56 localhost chat[4558]: expect (OK)

Mar 20 20:55:56 localhost chat[4558]: ^M^M

Mar 20 20:55:56 localhost chat[4558]: OK

Mar 20 20:55:56 localhost chat[4558]: -- got it

Mar 20 20:55:56 localhost chat[4558]: send (ATS0=0^M^M)

Mar 20 20:55:56 localhost chat[4558]: expect (OK)

Mar 20 20:55:56 localhost chat[4558]: ^M

Mar 20 20:55:56 localhost chat[4558]: AT^M

Mar 20 20:55:56 localhost chat[4558]: OK

Mar 20 20:55:56 localhost chat[4558]: -- got it

Mar 20 20:55:56 localhost chat[4558]: send (ATE0V1^M^M)

Mar 20 20:55:56 localhost chat[4558]: expect (OK)

Mar 20 20:55:56 localhost chat[4558]: ^M

Mar 20 20:55:56 localhost chat[4558]: ^M^M

Mar 20 20:55:56 localhost chat[4558]: OK

Mar 20 20:55:56 localhost chat[4558]: -- got it

Mar 20 20:55:56 localhost chat[4558]: send (AT+CGDCONT=1,"IP","CMNET"^M^M)

Mar 20 20:55:57 localhost chat[4558]: expect (OK)

Mar 20 20:55:57 localhost chat[4558]: ^M

Mar 20 20:55:57 localhost chat[4558]: ATS0=0^M^M

Mar 20 20:55:57 localhost chat[4558]: OK

Mar 20 20:55:57 localhost chat[4558]: -- got it

Mar 20 20:55:57 localhost chat[4558]: send (ATDT*99***1#^M^M)

Mar 20 20:55:57 localhost chat[4558]: expect (CONNECT)

Mar 20 20:55:57 localhost chat[4558]: ^M

Mar 20 20:55:57 localhost chat[4558]: ^M^M

Mar 20 20:55:57 localhost chat[4558]: OK^M

Mar 20 20:55:57 localhost chat[4558]: ATE0V1^M^M

Mar 20 20:55:57 localhost chat[4558]: OK^M

Mar 20 20:55:57 localhost chat[4558]: ^M

Mar 20 20:55:57 localhost chat[4558]: OK^M

Mar 20 20:55:57 localhost chat[4558]: ^M

Mar 20 20:55:57 localhost chat[4558]: OK^M

Mar 20 20:55:57 localhost chat[4558]: ^M

Mar 20 20:55:57 localhost chat[4558]: OK^M

Mar 20 20:55:57 localhost chat[4558]: ^M

Mar 20 20:55:57 localhost chat[4558]: CONNECT

Mar 20 20:55:57 localhost chat[4558]: -- got it

Mar 20 20:55:57 localhost chat[4558]: send (^M)

Mar 20 20:55:57 localhost pppd[4557]: Serial connection established.

Mar 20 20:55:57 localhost pppd[4557]: Using interface ppp0

Mar 20 20:55:57 localhost pppd[4557]: Connect: ppp0 /dev/ttyS0

Mar 20 20:55:58 localhost pppd[4557]: Warning - secret file /etc/ppp/pap-secrets has world and/or group access

Mar 20 20:56:00 localhost pppd[4557]: Warning - secret file /etc/ppp/chap-secrets has world and/or group access

Mar 20 20:56:00 localhost pppd[4557]: CHAP authentication succeeded

Mar 20 20:56:00 localhost pppd[4557]: CHAP authentication succeeded

Mar 20 20:56:01 localhost kernel: PPP Deflate Compression module registered

Mar 20 20:56:02 localhost pppd[4557]: Could not determine remote IP address: defaulting to 10.64.64.64

Mar 20 20:56:02 localhost pppd[4557]: local IP address 10.144.202.159

Mar 20 20:56:02 localhost pppd[4557]: remote IP address 10.64.64.64

Mar 20 20:56:02 localhost pppd[4557]: primary DNS address 211.138.200.69

Mar 20 20:56:02 localhost pppd[4557]: secondary DNS address 211.103.13.101

Linux下pppd出现问题,我无法上网,怎么办

看看mac地址是不是正确的。 命令:ifconfig。 设置步骤; ifdown eth0 停止网卡 ifconfig eth0 hw ether aabbcc112233(mac地址) ifup eth0 启动网卡 如果报错说mac地址不一致,检查配置文件中是否有mac地址设置,删除之 配置文件:/etc/sysconfig.

如何设置Linux服务器为PPP拨入服务器

我按下面这个配置成功了,你可以试下:

一、安装的前提条件

1.确保安装了网卡并工作正常

使用命令

#ifconfig eth0

查看网卡状态,然后关闭ifdown eth0,注意一定要关闭ifdown 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.下载二进制软件包

B.进行安装

以root执行:

#rpm -Uvh rp-pppoe-3.2-1.i386.rpm

2.从源代码进行安装:

从源代码进行安装同样适用于其它平台的Linux,但必须在Linux系统中安装gcc编译器。

A.下载源代码软件包

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)?

如果输入的信息正确,输入 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,如果有响应,表示你已经大功告成了。

六、其它说明

1、RedHat Linux 7.1已经集成了rp-pppoe这个软件包,只不过版本有些低,如果你不在意版本高低,可以直接进行三后面的步骤。

2、以后要拔号上网时,只要:

ifdown eth0

ifup ppp0

/usr/sbin/adsl-start


网站题目:linuxpppd命令 pd linux
文章转载:http://cdkjz.cn/article/ddjgogi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220