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
#p#副标题#e#
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#}%<e~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!}#} }9}"}&} }*} } }'}"}(}"}%}&K_{}$}#}%B#}%<e~
--> 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
关键词标签:linux,wvdial,gprs,拨
相关阅读
热门文章 安装红帽子RedHat Linux9.0操作系统教程使用screen管理你的远程会话GNU/Linux安装vmware如何登录linux vps图形界面 Linux远程桌面连
人气排行 Linux下获取CPUID、硬盘序列号与MAC地址linux tc实现ip流量限制dmidecode命令查看内存型号linux下解压rar文件安装红帽子RedHat Linux9.0操作系统教程Ubuntu linux 关机、重启、注销 命令lcx.exe、nc.exe、sc.exe入侵中的使用方法查看linux服务器硬盘IO读写负载
查看所有0条评论>>