Modem
難以與 GSM 提供商建立 ppp 連接
我想
ppp
用我的手機調製解調器建立到 GSM 提供商的連結。調製解調器被辨識,我可以發送 AT 命令就好了,但我無法建立連接。我的
chat
腳本看起來像:####################################### SAY 'Setting the abort string\n' SAY '\n' # Abort String ------------------------------ ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT DELAYED ####################################### SAY 'Initializing modem\n' # Modem Initialization '' AT OK ATZ ####################################### SAY '\n' SAY 'Setting APN\n' # Access Point Name (APN) # Incorrect APN or CGDCONT can often cause errors in connection. # Below are a bunch of different popular APNs #REG:\s1 AT+cgdcont=1,"IP","proxy" #OK 'AT+CGDCONT=0,"IP","proxy"' #OK 'AT+CGDCONT=1,"IP","proxy"' #OK 'AT+CGDCONT=2,"IP","proxy"' OK 'AT+CGDCONT=1,"IP","m2mstatic.apn"' #OK 'AT+CGDCONT=1,"IP","ISP.TELUS.COM"' #OK 'AT+CGDCONT=1,"IP","INTERNET.COM"' #OK 'AT+CGDCONT=1,"IP","ISP.CINGULAR"' #OK 'AT+CGDCONT=2,"IP","ISP.CINGULAR"' ""
在
/var/log/messages
我收到以下消息:Jan 11 04:08:49 ariag25 pppd[2518]: pppd 2.4.5 started by root, uid 0 Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO DIAL TONE) Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO ANSWER) Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO CARRIER) Jan 11 04:08:50 ariag25 chat[2520]: abort on (DELAYED) Jan 11 04:08:50 ariag25 chat[2520]: send (AT^M) Jan 11 04:08:50 ariag25 chat[2520]: expect (OK) Jan 11 04:08:50 ariag25 chat[2520]: AT^M^M Jan 11 04:08:50 ariag25 chat[2520]: OK Jan 11 04:08:50 ariag25 chat[2520]: -- got it Jan 11 04:08:50 ariag25 chat[2520]: send (ATZ^M) Jan 11 04:08:51 ariag25 chat[2520]: expect (OK) Jan 11 04:08:51 ariag25 chat[2520]: ^M Jan 11 04:08:51 ariag25 chat[2520]: ATZ^M^M Jan 11 04:08:51 ariag25 chat[2520]: OK Jan 11 04:08:51 ariag25 chat[2520]: -- got it Jan 11 04:08:51 ariag25 chat[2520]: send (AT+CGDCONT=1,"IP","m2mstatic.apn"^M) Jan 11 04:08:51 ariag25 chat[2520]: expect (OK) Jan 11 04:08:51 ariag25 chat[2520]: ^M Jan 11 04:08:51 ariag25 chat[2520]: AT+CGDCONT=1,"IP","m2mstatic.apn"^M^M Jan 11 04:08:51 ariag25 chat[2520]: OK Jan 11 04:08:51 ariag25 chat[2520]: -- got it Jan 11 04:08:51 ariag25 chat[2520]: send (ATDT*99#^M) Jan 11 04:08:51 ariag25 chat[2520]: expect (CONNECT) Jan 11 04:08:51 ariag25 chat[2520]: ^M Jan 11 04:08:51 ariag25 chat[2520]: ATDT*99#^M^M Jan 11 04:08:51 ariag25 chat[2520]: CONNECT Jan 11 04:08:51 ariag25 chat[2520]: -- got it Jan 11 04:08:51 ariag25 chat[2520]: send (^M) Jan 11 04:08:51 ariag25 pppd[2518]: Serial connection established.
編輯
我不認為我的聊天腳本有問題,而是我的調製解調器有問題。請注意,在消息的底部,上下文從 切換
chat
到pppd
- 為什麼會這樣?我的電源可能太弱了嗎?這就是我現在所懷疑的。有任何想法嗎?另外,如果我
killall pppd
在這之後做一個並嘗試連接螢幕screen /dev/modem 9600
調製解調器不再回复,直到我重新啟動它。
然而,我很驚訝!我將它連接到 2.1A USB 電源。
編輯2
我的
/etc/ppp/options
樣子:debug /dev/ttyUSB1 9600 modem crtscts lock connect /etc/ppp/net-connect asyncmap 0 defaultroute
像這樣
/etc/ppp/peers/provider
:connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99***1#" # Serial device to which the modem is connected. /dev/modem # Speed of the serial line. 9600 # Assumes that your IP address is allocated dynamically by the ISP. noipdefault # Try to get the name server addresses from the ISP. usepeerdns # Use this connection as the default route. defaultroute # Makes pppd "dial again" when the connection is lost. persist # Do not ask the remote to authenticate. noauth
刪除“defaultroute”行,它應該可以工作。
如果必須,您可以手動設置路線,但您可能不必這樣做。看起來您已經掛上了一個腳本,當一個新介面出現並且它正在破壞 pppd 時,它會設置他的路由。
您的
pppd
設置配置錯誤。如果一切正常,您應該會pppd
在日誌中看到類似於以下內容的消息:Oct 5 12:37:35 localhost pppd[1289]: Serial connection established. Oct 5 12:37:35 localhost pppd[1289]: Using interface ppp0 Oct 5 12:37:35 localhost pppd[1289]: Connect: ppp0 <--> /dev/ttyS1 Oct 5 12:37:36 localhost pppd[1289]: Remote message: Welcome! Oct 5 12:37:36 localhost pppd[1289]: PAP authentication succeeded Oct 5 12:37:40 localhost pppd[1289]: local IP address 109.112.53.134 Oct 5 12:37:40 localhost pppd[1289]: remote IP address 109.112.235.129 Oct 5 12:37:40 localhost pppd[1289]: primary DNS address 83.224.66.134 Oct 5 12:37:40 localhost pppd[1289]: secondary DNS address 83.224.65.134
參考