Chinaunix首页 | 论坛 | 博客
  • 博客访问: 646919
  • 博文数量: 227
  • 博客积分: 8017
  • 博客等级: 中将
  • 技术积分: 2069
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-08 22:50
文章分类

全部博文(227)

文章存档

2011年(10)

2010年(55)

2009年(28)

2008年(134)

我的朋友

分类: LINUX

2009-12-15 11:34:31

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 ``
--> 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
如果ping不通域名,可以cat /etc/resolv.conf
然后写入拨号获得的DNS


阅读(1163) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~