0

我有一个通过 USB 连接到 Linux 机器的 MultiTech MTD-H5-2.0 GPRS 蜂窝调制解调器。我可以看到设备并直接与它通信而没有问题。我正在尝试设置 PPP,以便我可以通过此设备访问互联网。我遇到了一些麻烦。当 PPP 启动时,它为本地和远程端分配相同的 IP。我原以为他们会有所不同。有没有人有使用蜂窝调制解调器建立 PPP 连接的经验?您可以在下面看到我的 PPP 脚本和 AT 命令。

# pppd --version
pppd version 2.4.5

# cat pppd_script
debug
lcp-echo-failure 3
lcp-echo-interval 3
nodetach
nomagic
/dev/ttyACM0
115200
crtscts
noauth
noipdefault
ipcp-accept-local
ipcp-accept-remote
usepeerdns
novj
nobsdcomp
novjccomp
nopcomp
noaccomp
lock
connect "/usr/sbin/chat -v -f /root/multitech-connect"
defaultroute

# cat multitech-connect
#!/bin/sh
ABORT "BUSY"
'' AT
#OK ATE0\r
OK AT+CREG?
OK AT+CSQ
OK AT+CGDCONT=1,"IP","M2M.COM.ATTZ"
OK ATD*99***1#
CONNECT ''

# pppd file pppd_script  &
Script /usr/sbin/chat -v -f /root/multitech-connect finished (pid 1661), status = 0x0
Serial connection established.
using channel 28
Using interface ppp0
Connect: ppp0 <--> /dev/ttyACM0
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth pap> <magic 0x754cbce> <pcomp> <accomp>]
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [LCP ConfReq id=0x1 <asyncmap 0x0>]
No auth is possible
sent [LCP ConfRej id=0x1 <auth pap> <magic 0x754cbce> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0>]
rcvd [LCP ConfReq id=0x2 <asyncmap 0x0>]
sent [LCP ConfAck id=0x2 <asyncmap 0x0>]
sent [LCP EchoReq id=0x0 magic=0x0]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP EchoRep id=0x0 magic=0x0]
rcvd [LCP ProtRej id=0x3 80 fd 80 fd 01 01 00 0c 1a 04 78 00]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfNak id=0x1 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 10.61.144.128> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>]
sent [IPCP ConfReq id=0x2 <addr 10.61.144.128> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>]
rcvd [IPCP ConfReq id=0x2 <addr 10.61.144.128>]
sent [IPCP ConfAck id=0x2 <addr 10.61.144.128>]
rcvd [IPCP ConfAck id=0x2 <addr 10.61.144.128> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>]
not replacing existing default route via 172.20.72.1
local  IP address 10.61.144.128
remote IP address 10.61.144.128
primary   DNS address 8.8.8.8
secondary DNS address 8.8.4.4
Script /etc/ppp/ip-up started (pid 1665)
Script /etc/ppp/ip-up finished (pid 1665), status = 0x0

# ifconfig ppp0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500  metric 1
        inet 10.61.144.128  netmask 255.255.255.255  destination 10.61.144.128
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 4  bytes 58 (58.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7  bytes 120 (120.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 0 packets received, 100% packet loss

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.20.72.1     0.0.0.0         UG    0      0        0 wlan0
0.0.0.0         10.0.1.254      0.0.0.0         UG    0      0        0 eth0
10.0.0.2        10.0.1.2        255.255.255.255 UGH   0      0        0 eth0
10.0.1.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.20.72.0     0.0.0.0         255.255.252.0   U     0      0        0 wlan0

暂时忘记 PPP,只使用一些 AT 命令,我可以看到调制解调器能够访问互联网。让我认为这只是我的 PPP 设置的一个问题。

#> AT+CREG?
AT+CREG?
+CREG: 0,1
OK
#> AT#PING="www.google.com"
AT#PING=www.google.com
#PING: 01,"216.58.195.68",27,55
#PING: 02,"216.58.195.68",2,55
#PING: 03,"216.58.195.68",2,55
#PING: 04,"216.58.195.68",1,55
#> AT#PING="8.8.8.8"
AT#PING=8.8.8.8
#PING: 01,"8.8.8.8",17,56
#PING: 02,"8.8.8.8",1,56
#PING: 03,"8.8.8.8",3,56
#PING: 04,"8.8.8.8",1,56

感谢您的任何建议。

4

1 回答 1

0

nodetach您的 ppp 对等或选项文件中删除。

于 2017-04-19T10:38:16.317 回答