Chinaunix
标题:
linux下用wvdial实现gprs拨号上网
[打印本页]
作者:
itlanger
时间:
2009-12-15 11:34
标题:
linux下用wvdial实现gprs拨号上网
1. 安装wvdial
sudo apt-get install wvdial
2. 在/etc/wvdial.conf中写入wvdial的配置信息: femacs /etc/wvdial.conf
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","CMNET" ##important! 否则无法使用DNS
Modem Type = Analog Modem
Baud = 115200 ##根据你的gprs modem来设定
New PPPD = yes
Modem = /dev/ttyS0 ##你所连接的串口
ISDN = 0
Phone = *99***1# ##中国移动的拨号号码
Password = *** ##其实没什么用
Username = itlanger
这一步,可以首先运行wvdial,这时会出现找不到modem,然后修改/etc/wvdial.conf, 增加
Baud = 115200 ##根据你的gprs modem来设定
Modem = /dev/ttyS0 ##你所连接的串口
然后再次运行wvdial, 再手动加入一下内容到/etc/wvdial.conf:
Init3 = AT+CGDCONT=1,"IP","CMNET"
Phone = *99***1# ##中国移动的拨号号码
Password = *** ##其实没什么用
Username = itlanger
这里Init3 = AT+CGDCONT=1,"IP","CMNET" 一定要加,否则wvdial拨号时会出现:
warning, can't find address for `www.suse.de`
--> warning, address lookup does not work
--> Nameserver (DNS) failure, the connection may not work.
导致只能ping通IP,不能ping通域名
3. 配置ppp参数: femacs /etc/ppp/options
noipdefault
ipcp-accept-local
ipcp-accept-remote
defaultroute
noauth
crtscts
debug
4.拨号上网: sudo wvdial
--> WvDial: Internet dialer version 1.60
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","CMNET"
AT+CGDCONT=1,"IP","CMNET"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
~[7f]}#@!}!}#} }9}"}&} }*} } }'}"}(}"}%}&K_{}$}#}%B#}% Carrier detected. Waiting for prompt.
~[7f]}#@!}!}#} }9}"}&} }*} } }'}"}(}"}%}&K_{}$}#}%B#}% PPP negotiation detected.
--> Starting pppd at Tue Dec 15 11:19:14 2009
--> Pid of pppd: 6666
--> Using interface ppp0
--> Authentication (CHAP) started
--> Authentication (CHAP) successful
--> local IP address 10.24.229.233
--> remote IP address 192.168.254.254
--> primary DNS address 211.137.160.5
--> secondary DNS address 211.136.17.107
--> Script /etc/ppp/ip-up run successful
--> Default route Ok.
--> Nameserver (DNS) Ok.
--> Connected... Press Ctrl-C to disconnect
4. 断开以太网连接:
sudo ifconfig eth0 down
sudo route add default gw 10.24.229.233 ##这里是ppp0的IP
5. 测试网络:
ping 60.28.166.84
ping www.chinaunix.net
如果ping不通域名,可以cat /etc/resolv.conf
然后写入拨号获得的DNS
本文来自ChinaUnix博客,如果查看原文请点:
http://blog.chinaunix.net/u1/56406/showart_2121756.html
作者:
nettui
时间:
2013-07-09 11:25
wvdial拨号3G上网错误:The PPP daemon has died: PPP negotiation failed (exit code = 10)
[root@EmbedSky /]# wvdial
--> WvDial: Internet dialer version 1.56 (root@EmbedSky)
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","CMNET"
AT+CGDCONT=1,"IP","CMNET"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 7200000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Jan 1 00:17:33 1970
--> Pid of pppd: 317
--> pppd: x鯷01]
--> Using interface ppp0
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
--> pppd: x鯷01]
netconsole: network logging stopped, interface ppp0 unregistered
--> Disconnecting at Thu Jan 1 00:18:03 1970
--> The PPP daemon has died: PPP negotiation failed (exit code = 10)
--> man pppd explains pppd error codes in more detail.
--> I guess that's it for now, exiting
--> The PPP daemon has died. (exit code = 10)pppd错误码
10 PPP连接错误,也就是说在建立PPP连接中所有可用网络协议都不可到达。
这是什么原因啊?是联通公司的原因还是我的原因,该跟么解决呢,求高手详细帮助!
作者:
nettui
时间:
2013-07-09 11:25
然后我换成直接用PPPD拨号,打印消息如下:
[root@EmbedSky peers]# pppd call wcdma
pppd options in effect:
debug debug # (from /etc/ppp/peers/wcdma)
nodetach # (from /etc/ppp/peers/wcdma)
dump # (from /etc/ppp/peers/wcdma)
noauth # (from /etc/ppp/peers/wcdma)
user card # (from /etc/ppp/peers/wcdma)
password ?????? # (from /etc/ppp/peers/wcdma)
remotename 3gppp # (from /etc/ppp/peers/wcdma)
/dev/ttyUSB1 # (from /etc/ppp/peers/wcdma)
115200 # (from /etc/ppp/peers/wcdma)
connect /usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect # (from /etc/ppp/peers/wcdma)
nocrtscts # (from /etc/ppp/peers/wcdma)
local # (from /etc/ppp/peers/wcdma)
hide-password # (from /etc/ppp/peers/wcdma)
novj # (from /etc/ppp/peers/wcdma)
novjccomp # (from /etc/ppp/peers/wcdma)
ipcp-accept-local # (from /etc/ppp/peers/wcdma)
ipcp-accept-remote # (from /etc/ppp/peers/wcdma)
ipparam 3gppp # (from /etc/ppp/peers/wcdma)
noipdefault # (from /etc/ppp/peers/wcdma)
defaultroute # (from /etc/ppp/peers/wcdma)
usepeerdns # (from /etc/ppp/peers/wcdma)
noccp # (from /etc/ppp/peers/wcdma)
abort on (NO CARRIER)
abort on (ERROR)
abort on (NO DIALTONE)
abort on (BUSY)
abort on (NO ANSWER)
send (/rAT^M)
expect (OK)
AT^M^M
OK
-- got it
send (/rATZ^M)
expect (OK)
^M
ATZ^M^M
OK
-- got it
send (/rAT+CGDCONT=1,"IP","3gnet",,0,0^M)
expect (OK)
^M
AT+CGDCONT=1,"IP","3gnet",,0,0^M^M
OK
-- got it
send (ATDT*99#^M)
expect (CONNECT)
^M
ATDT*99#^M^M
CONNECT
-- got it
send (/d/c^M)
Script /usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect finished (pid 386), status = 0x0
Serial connection established.
using channel 4
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea2eb38> <pcomp> <accomp>]
LCP: timeout sending Config-Requests
Connection terminated.
netconsole: network logging stopped, interface ppp0 unregistered
Modem hangup
求高手指教啊
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2