自己编写MODEM的驱动,但是通过GPRS获得IP后却上不了网????!!!
我写了个MODEM的驱动,
我是在LINUX下通过PPPD GPRS拨号上网,分配了IP ,可是不能上网 请给予帮助!
log 信息如下:
Nov 3 15:33:58 localhost kernel: PPP generic driver version 2.4.2
Nov 3 15:33:58 localhost pppd[2123]: pppd 2.4.1 started by root, uid 0
Nov 3 15:33:59 localhost chat[2124]: send (ath0^M)
Nov 3 15:33:59 localhost chat[2124]: expect (OK)
Nov 3 15:33:59 localhost chat[2124]: ath0^M^M
Nov 3 15:33:59 localhost chat[2124]: OK
Nov 3 15:33:59 localhost chat[2124]: -- got it
Nov 3 15:33:59 localhost chat[2124]: send (at+cgdcont=1,"IP","cmnet"^M)
Nov 3 15:33:59 localhost chat[2124]: expect (OK)
Nov 3 15:33:59 localhost chat[2124]: ^M
Nov 3 15:33:59 localhost chat[2124]: at+cgdcont=1,"IP","cmnet"^M^M
Nov 3 15:33:59 localhost chat[2124]: OK
Nov 3 15:33:59 localhost chat[2124]: -- got it
Nov 3 15:33:59 localhost chat[2124]: send (atd*98*1#^M)
Nov 3 15:34:00 localhost chat[2124]: expect (CONNECT)
Nov 3 15:34:00 localhost chat[2124]: ^M
Nov 3 15:34:00 localhost chat[2124]: atd*98*1#^M^M
Nov 3 15:34:00 localhost chat[2124]: CONNECT
Nov 3 15:34:00 localhost chat[2124]: -- got it
Nov 3 15:34:00 localhost pppd[2123]: Serial connection established.
Nov 3 15:34:00 localhost pppd[2123]: Using interface ppp0
Nov 3 15:34:00 localhost pppd[2123]: Connect: ppp0 <--> /dev/pts/1
Nov 3 15:34:00 localhost /etc/hotplug/net.agent: assuming ppp0 is already up
Nov 3 15:34:01 localhost kernel: PPP Deflate Compression module registered
Nov 3 15:34:04 localhost pppd[2123]: not replacing existing default route to eth2 [172.17.255.254]
Nov 3 15:34:04 localhost pppd[2123]: local IP address 10.67.26.6
Nov 3 15:34:04 localhost pppd[2123]: remote IP address 192.168.0.1
Nov 3 15:34:04 localhost pppd[2123]: primary DNS address 211.136.20.203
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Closing down the logical channel 3.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Logical channel 3 closed.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Closing down the logical channel 2.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Logical channel 2 closed.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Closing down the logical channel 1.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Logical channel 1 closed.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: Sending close down request to the multiplexer.
Nov 3 15:34:35 localhost /root/work/DTM8110/gsmMuxd[2026]: The mobile station requested mux-mode termination.
Nov 3 15:34:35 localhost pppd[2123]: Hangup (SIGHUP)
Nov 3 15:34:35 localhost pppd[2123]: Modem hangup
Nov 3 15:34:35 localhost pppd[2123]: Connection terminated.
Nov 3 15:34:35 localhost pppd[2123]: Connect time 0.6 minutes.
Nov 3 15:34:35 localhost pppd[2123]: Sent 110 bytes, received 58 bytes.
我把后面5行也贴出来了,因为received 58 bytes 一直接受的是58个包。这58个包是PPP协商的时候接受的,也就是说。我以后运行PING的时候,根本
就没有包通过,
netstat -nr 运行的结果如下:
eth0 Link encap:Ethernet HWaddr 00:0C:29:F2:EE:AE
inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:53 errors:0 dropped:0 overruns:0 frame:0
TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:33652 (32.8 Kb) TX bytes:6782 (6.6 Kb)
Interrupt:10 Base address:0x1080
eth1 Link encap:Ethernet HWaddr 00:0C:29:F2:EE:B8
inet addr:192.168.2.119 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:672 (672.0 b)
Interrupt:9 Base address:0x1400
eth2 Link encap:Ethernet HWaddr 00:0C:29:F2:EE:C2
inet addr:172.17.1.199 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:672 (672.0 b)
Interrupt:5 Base address:0x1480
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1892 (1.8 Kb) TX bytes:1892 (1.8 Kb)
ppp0 Link encapoint-to-Point Protocol
inet addr:10.67.26.6 P-t-P:192.168.0.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:58 (58.0 b) TX bytes:110 (110.0 b)
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 172.17.255.254 0.0.0.0 UG 0 0 0 eth2
当然在PING的时候,我运行 PING IP地址 -I ppp0 指定了是通过ppp0!
-save防火墙我是关了的喔,应该没有关系的呵呵,
THANKS VERY MUCH!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
ping的时候通过ppp0,但上网是不是也要通过这个,而默认的确不是这样的哦
谢谢管理的关心,我设置了以PPP0作为路由 下面是我拨号后运行netstat -nr 的输出
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 ppp0
请管理给予支持,小弟万分感谢!!
MS不像驱动的问题,楼主可以检查一下OPTIONS里的内容有没有问题
哇!!!楼上的果然是高手呀!!!
我搞定了,呵呵,就是OPTIONS里面的问题呀!!呵呵果然这里高手如云呵呵!!!
谢谢!!!
LZ:
能将你的程序架构描叙一下吗
其实也没有什么呀!
首先打开串口,进行串口设置;
然后循环读取和写入数据,注意根据不同的模块对写入数据和读取数据进行进行不同的封装和拆包!
就这样! 呵呵 是不是很简单呀 呵呵!
能不能简单描述一下?