600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > linux gprs 拨号上网 linux下用wvdial实现gprs拨号上网

linux gprs 拨号上网 linux下用wvdial实现gprs拨号上网

时间:2023-04-26 18:30:00

相关推荐

linux gprs 拨号上网 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

--> 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 g

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。